In this analysis we will examine the seasonal components of Publish MRR. We will take a look at how MRR tends to change by week and month. We’ll include Publish MRR since the beginning of 2016 in this analysis.
We’ll read the daily Publish MRR data from a CSV downloaded from ChartMogul.
# read data from csv mrr <- read_csv(file = "~/Downloads/publish_daily_mrr.csv")
Now let’s plot total Publish MRR over time.
Seasonal Components with Prophet
First we will examine the seasonal components of daily MRR growth with the Prophet package. We need to prepare a dataframe that has two columns,
y to use Prophet.
# create dataframe for prophet prophet_df <- mrr %>% mutate(growth = mrr - lag(mrr, 1)) %>% filter(!is.na(growth)) %>% select(date, growth) %>% rename(ds = date, y = growth)
Now we call the
prophet function to fit the model. We specify that we want to include weekly and yearly seasonal components.
# fit model m <- prophet(prophet_df, weekly.seasonality = TRUE, yearly.seasonality = TRUE) # make future dataframe future <- make_future_dataframe(m, periods = 90) # create forecast for future dates fcast <- predict(m, future)
Now we can plot the seasonal decomposition.
This plot shows us how MRR growth tends to change by the day of the week and over the course of the year. MRR growth tends to be highest on Mondays and Tuesdays, and decreases in the remaining days of the week.
Over the course of the year, MRR has tended to fluctuate with the seasons. MRR growth has tended to increase in the beginning of the year before dipping in the summer. MRR growth picks up in the fall and decreases at the end of the year.
Seasonal Plots with Forecast Package
Now we’ll look at some interesting seasonal plots using functions in the
forecast package. To do so we’ll first need to save our data as a time series
Seasonal plots allow the underlying seasonal pattern to be seen more clearly, and is especially useful in identifying years in which the pattern changes. In the case of Publish MRR, we see that the Spring of 2019 is really where growth was below what could be expected.
# save as a time series object ts <- ts(monthly_mrr$mrr, start = c(2016, 1), frequency = 12)
A useful variation on the seasonal plot uses polar coordinates, though it doesn’t appear to be too useful to is here.
An alternative plot that emphasises the seasonal patterns is where the data for each season are collected together in separate mini time plots. This shows how monthly growth has changed over time.
The horizontal lines indicate the means for each month. This form of plot enables the underlying seasonal pattern to be seen clearly, and also shows the changes in seasonality over time. We can see that monthly MRR growth has declined year over year for most months since the start of 2016.
MRR growth has tended to be highest in May and lowest in July and December.
This decomposition graph shows us the trend in MRR growth and the monthly seasonal component. The remainder can be quite large, probably due to product changes that we’ve made that affect MRR growth. The seasonal component again indicates that MRR growth is highest in the spring, decreases in the summer and picks up in the fall before decreasing at the end of the year.