Produce forecasts for the following series using whichever of NAIVE(y), SNAIVE(y) or RW(y ~ drift()) is more appropriate in each case: ### a.Australian Population (global_economy)
## Warning: Removed 20 rows containing missing values (`geom_line()`).
#### Seasonal naïve method
## Warning: Removed 20 rows containing missing values (`geom_line()`).
### NSW Lambs (aus_livestock)
#### Seasonal Naive lambs
Seasonal Naive is the best forecat model in this cases, as it shows peak birthing capacity planning of lambs.
Use the Facebook stock price (data set gafa_stock) to do the following: ### a.Produce a time plot of the series.
## # A tsibble: 1,006 x 9 [1]
## # Key: Symbol [1]
## Symbol Date Open High Low Close Adj_Close Volume day
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <int>
## 1 FB 2015-01-02 78.6 78.9 77.7 78.4 78.4 18177500 1
## 2 FB 2015-01-05 78.0 79.2 76.9 77.2 77.2 26452200 2
## 3 FB 2015-01-06 77.2 77.6 75.4 76.2 76.2 27399300 3
## 4 FB 2015-01-07 76.8 77.4 75.8 76.2 76.2 22045300 4
## 5 FB 2015-01-08 76.7 78.2 76.1 78.2 78.2 23961000 5
## 6 FB 2015-01-09 78.2 78.6 77.2 77.7 77.7 21157000 6
## 7 FB 2015-01-12 77.8 78 76.2 76.7 76.7 19190200 7
## 8 FB 2015-01-13 77.2 78.1 75.8 76.4 76.4 25179600 8
## 9 FB 2015-01-14 76.4 77.2 76.0 76.3 76.3 25741000 9
## 10 FB 2015-01-15 76.4 76.6 73.5 74.1 74.1 34134000 10
## # ℹ 996 more rows
### d.Try using some of the other benchmark functions to forecast the same data set. Which do you think is best? Why?
The best one is using the Drift method.
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.
## Warning: Removed 4 rows containing missing values (`geom_line()`).
## Warning: Removed 4 rows containing missing values (`geom_point()`).
## Warning: Removed 4 rows containing non-finite values (`stat_bin()`).
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.
## Warning: Removed 1 row containing missing values (`geom_line()`).
## Warning: Removed 1 rows containing missing values (`geom_point()`).
## Warning: Removed 1 rows containing non-finite values (`stat_bin()`).
### b.Bricks
## Warning: Removed 21 rows containing missing values (`geom_line()`).
## Warning: Removed 21 rows containing missing values (`geom_point()`).
## Warning: Removed 21 rows containing non-finite values (`stat_bin()`).
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning: Removed 8 rows containing missing values (`()`).
## Warning: Removed 20 rows containing missing values (`geom_line()`).
Conclusion: Good forecast methods should have normally distributed residuals, A model with small residuals will give good forecasts.
For your retail time series (from Exercise 7 in Section 2.10):
Create a training dataset consisting of observations before 2011 using
Check that your data have been split appropriately by producing the following plot. ### c. Fit a seasonal naïve model using SNAIVE() applied to your training data (myseries_train).
Check the residuals.
## Warning: Removed 12 rows containing missing values (`geom_line()`).
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Warning: Removed 12 rows containing non-finite values (`stat_bin()`).
Do the residuals appear to be uncorrelated and normally distributed? Normal distribution is ok.
Produce forecasts for the test data
## Joining with `by = join_by(State, Industry, `Series ID`, Month, Turnover)`
### f. Compare the accuracy of your forecasts against the actual values.
## # A tibble: 1 × 12
## State Industry .model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
## <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Norther… Clothin… SNAIV… Trai… 0.439 1.21 0.915 5.23 12.4 1 1 0.768
## # A tibble: 1 × 12
## .model State Industry .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
## <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 SNAIVE(T… Nort… Clothin… Test 0.836 1.55 1.24 5.94 9.06 1.36 1.28 0.601
How sensitive are the accuracy measures to the amount of training data used?