--- title: "Stat. 474 Midterm" author: "<<< Put your name here >>>" date: "3/3/2021" output: pdf_document: default html_document: default --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ## **Instructions:** The midterm investigates three time series datasets, simulated white noise, *hh_budget* and *aus_retail*. The questions ask about the ACF, decompsition methods, forecasting, and the use of training and test datasets to measure forecast accuracy. ```{r} library(pacman) p_load(tidyverse, fpp3) ``` ### Question 1 Simulate a white noise time series with 250 data points. Plot the time series and the ACF of the time series. Is there are trend? Is there a seasonal pattern? Are there any meaningful statistically significant correlations? Use a seed of 1234. #### Answer <<< Write your answer here. >>> #### Provide your code here. ```{r} ``` ### Question 2 Try the X11, SEATS, and STL Decomposition methods on the Household Budget data, *hh_budget* to estimate the tends in Wealth for the different countries in the dataset. a) Which methods work? If not, why does the method fail? b) Is there are seasonal component in these times series? #### Answer <<< Write your answer here. >>> #### Provide your code here. ```{r} data(hh_budget) View(hh_budget) ``` a) Hint: Plot the time series, set up the model, etc. ```{r} ``` b) ```{r} ``` ### Question 3 Try different forecasting methods to forecast 12 steps into the future the Turnover in the Liquor Industry in New South Wales, Australia using the *aus_retail* dataset. Try the following: MEAN, RW, TSLM(Turnover ~ trend(), TSLM(Turnover ~ trend() + season(), NAIVE, SNAIVE a) Try all of the methods and determine a best method by visual inspection of forecasts for one year. b) Now split the data into *training* and *testing* subsets of the data. Use the data until Jan 2019 as the *training* data. Using the method you have selected measure its error for forecasting the *testing* data, which is 2020 data. Hint: Read Section 5.8 #### Answer <<< Write your answer here. >>> #### Provide your code here. ```{r} data(aus_retail) View(aus_retail) ``` a) ```{r} # Step 1 Tidy aus_retail_sw <- aus_retail %>% filter(State == "New South Wales" & str_detect(Industry, "^L")) # Step 2 Visualize # Step 3 Specify model() # Step 4 Evaluate # Hint: fit %>% gg_tsresiduals() # Step 5 Visualize ``` b) ```{r} ```