Produce forecasts for the following series using whichever of NAIVE(y), SNAIVE(y) or RW(y ~ drift()) is more appropriate in each case:
Since the original plot for population goes up in a semi straight line without much seasonal or cyclical behavior a RW model is the best fit for this data.
As we can see from the above graph this method is the best at imitating the linear increase in the population data. The RW() modeling method is perfect for this because of the linearity of the data without any seasonality.
Given that production data usually follows a seasonal trend it makes sense to use a SNAIVE modeling method.
Using data from 1990 Q1 to 2000 Q4 we then forecast the data for 2001 Q1 for 18 quarters. We can see that the SNAIVE method worked as intended as it accounts for the seasonal trends in the data. Once the recovery from the dip of 2001 happened our SNAIVE forecast is much closer to the later quarter, 2002 Q4.
Again as with brick production, livestock most likely follows a seasonal trend and therefore a SNAIVE model method works best.
We can see the SNAIVE forecast most closely matches the actual values for lamb counts. It doesn’t account for a lot of the randomness or trend-cycle in the data but I wonder if there are more advanced methods to account for these that we will learn in the future.
Using the previous 6 years we were able to forecast the next 3 years. Using the RW() with the drift() method we were able to use the average increase of historical data up to 2015 to forecast the data for 2016-2018. As we can see it looks like a pretty accurate forecast.
I decided to keep both the RW model and the SNAIVE model in the graph because the true value is somewhere in between the two. The RW does not capture the seasonality of the data, but it does capture the upward trend, while the SNAIVE model captured the seasonality but does not capture the general upward trend and so the values are a little lower than the true values. I wonder if there is a way to merge the two forecasting methods.
Use the Facebook stock price (data set gafa_stock) to do the following: * Produce a time plot of the series.
* Produce forecasts using the drift method and plot them.
* Show that the forecasts are identical to extending the line drawn between the first and last observations.
* Try using some of the other benchmark functions to forecast the same data set. Which do you think is best? Why?
Above we see the graph for both the RW and NAIVE drift methods. They produce the same forecast and therefore only one shows up on the graph. It seems to capture the downward trend of FB stock and that’s about it.
As we can see in the graph, if we draw a theoretical line between the first point on the graph, 0 days, and the end of the forecast, we can clearly see that the RW and NAIVE ~ drift() methods both are just drawing a line from the first point in the data set to the last point in the data set.
The following graph shows all the simple forecasting methods we’ve learned so far in relation to FB stock data for 2018, trying to forecast December 2018. The Drift method is the same as the RW method and therefore, the Drift method does not have a line. The SNAIVE forecast does not show up, as this is daily data and I’m not considering it as seasonal.
For the three forecasts that do show up on the graph, it seems that either the NAIVE or the RW methods are best. The Mean method is so far off the actual value that it isn’t a viable forecasting method. The NAIVE method does predict well the final close of 2018, but that seems like somewhat of a coincidence. The best forecast method is the RW method as it captures the downward trend of the FB stock starting around half way in 2018.
Apply a seasonal naïve method to the quarterly Australian beer production data from 1992. Check if the residuals look like white noise, and plot the forecasts. The following code will help. What do you conclude?
Looking at the first residual plot we can tell that the residuals do not have any correlation and have a constant variance. We also note that the residuals follow a normal distribution centered around 0 as seen from the residual histogram plot. The residual plots and the forecast plot make me conclude that this forecast is good, not to say it cannot be improved.
Repeat the previous exercise using the Australian Exports series from global_economy and the Bricks series from aus_production. Use whichever of NAIVE() or SNAIVE() is more appropriate in each case.
The best method is the NAIVE ~ drift() method as seasonality isn’t captured in yearly data. The residual plots for this method seems to agree as they fulfill all the residual properties. We see that there is no correlation between the residuals and that the residuals center around a 0 mean.
The residuals for the brick production SNAIVE() forecast look a little weird so I ran a box pierce test producing a p-value of 3.9131576^{-8}, meaning that the residuals are distinguishable from white noise, hinting that there is some autocorrelation between the residuals. This means the forecast could be improved.
For your retail time series (from Exercise 8 in Section 2.10):
Part A:
myseries <- read.csv("./myseries.csv") %>%
select(Month,Turnover) %>%
mutate(Month = yearmonth(Month)) %>%
as_tsibble(index = Month)
myseries_train <- myseries %>%
filter(year(Month) < 2011)
Part B:
We can see that the training data goes up until December 2010, which is exactly what we wanted.
myseries_fit <- myseries_train %>%
model(SNAIVE(Turnover))
The residuals seem normally distributed, with a slight left skew, and the innovation residuals show a normal variance. On the other hand the ACF plot shows some serious autocorrelation.
# A tibble: 2 x 6
.type ME RMSE MAE MAPE MASE
<chr> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Training 1.33 2.90 2.22 10.7 1
2 Test 7.12 9.13 7.58 14.4 3.42
Looking at the table above we see that the training data set is much more accurate than the test data set. The mean error for the test data set is about 5 times larger than the training data set. All the accuracy measures are lower for the training data than the test data. This indicates that our training data preformed better than the test data.
The accuracy of a sample is always dependent on the size of the sample. However, there are issues if your sample size is too large for the training data. Mainly you run a risk of creating a model that is over fitted. The other issue you may run into is underfitting the model, that is, there is not enough data to train a model to accurately predict future data.
It is always important to consider this when deciding how much to data to withhold from your training set.