Time Series Homework: Chapter 6 Lesson 1 Key

Please_put_your_name_here

Data

gdp_ts <- rio::import("https://byuistats.github.io/timeseries/data/gdp_fred.csv") |>
  mutate(year_over_year = gdp_millions / lag(gdp_millions, 4)-1) |>
  mutate(quarter = yearquarter(mdy(quarter))) |>
  filter(quarter >= yearquarter(my("Jan 1990")) & quarter < yearquarter(my("Jan 2025"))) |>
  na.omit() |>
  mutate(t = 1:n()) |>
  mutate(std_t = (t - mean(t)) / sd(t)) |>
  as_tsibble(index = quarter)

Questions

Question 1 - Stationary Model Comparison (20 points)

We have worked with AR(p), MA(q), ARMA(p,q) stochastic processes. The theoretical ACF and PACF functions of each model can help us identify which of the three models would be a good fit for a particular time series. From the Time Series Notebook:

ACF and PACF of an \(AR(p)\) Process
AR(p) MA(q) ARMA(p,q)
ACF Tails off Cuts off after lag \(q\) Tails off
PACF Cuts off after lag \(p\) Tails off Tails off

The table above summarizes the theoretical functions. Each time series is a realization of the stochastic process, so our sample estimates of these functions might be different. The following questions will walk you through the simulation of each of them to illustrate this point.

AR(3) Simulation

n <- 10000  # Number of observations
p <- c(0.5, 0.3, 0.1)  # AR coefficients

# Simulate the AR(3) process
set.seed(123)  # Setting seed for reproducibility
ar3_process <- arima.sim(n = n, model = list(ar = p), sd = 1)
ar3_df <- tibble(time = 1:n, value = ar3_process)# Convert the df to a tibble
ar_3 <- as_tsibble(ar3_df, index = time) # Convert the tibble to a tsibble

MA(3) Simulation

n <- 10000  # Number of observations
q <- c(-0.7, -0.5, 0.2)  # MA coefficients

# Simulate the MA(3) process
set.seed(123)  # For reproducibility
ma3_process <- arima.sim(n = n, model = list(ma = q), sd = 1)
ma_3 <- as_tsibble(tibble(Time = 1:n, value = ma3_process), index = Time) # Convert the simulated MA(3) process to a tsibble
a) Plot the ACFs for the AR(3) and MA(3) simulations side by side.
Answer
acf(ar_3)

acf(ma_3)

b) Plot the PACFs for the AR(3) and MA(3) simulations side by side.
Answer
pacf(ar_3)

pacf(ma_3)

c) Does the theoretical ACF and PACF functions described above in Table 1 match with the plots you created? Please change the seed for the simulation multiple times before answering this question.
Answer

In the charts above, notice the simillarities in the ACF of the plot for the AR process and the PACF plot of the MA process. Also take notice to how in both of those plots tail off.

Rubric

Criteria
Mastery (5) Incomplete (0)
Question 1a: ACF Plots Students produce clear and well-labeled plots of the autocorrelation functions (ACFs) for the AR(2), MA(2), and ARMA(2,2) simulations. Submissions have low-quality visualizations or unclear labeling.
Mastery (5) Incomplete (0)
Question 1b: PACF Students produce clear and well-labeled plots of the partial autocorrelation functions (PACFs) for the AR(2), MA(2), and ARMA(2,2) simulations. Submissions have low-quality visualizations or unclear labeling.
Mastery (10) Incomplete (0)
Question 1c: Evaluation of Theoretical functions Students contrast the theoretical description provided in the question prompt and compare it with the plots they created from multiple simulations with different seeds. They accurately identify and explain any discrepancies or agreements between the theoretical description and the observed patterns in the plots. Their analysis demonstrates a clear understanding of sampling distributions and their representations on ACF and PACF plots. Students contrast doesn’t provide sufficient evidence of understanding of simulation procedures or the theoretical understanding of ACF and PACF. There is not enough content to evaluation whether students understand the sampling process and estimation of ACF and PACF.
Mastery (5) Incomplete (0)
Question 2a: Plot Students plot the yearly percentage change in US Real GDP, ensuring that the plot is clear, properly labeled, and accurately represents the data. They provide appropriate axis labels, a title, and a legend if necessary to enhance interpretability. Submissions have low-quality visualizations or unclear labeling.
Mastery (5) Incomplete (0)
Question 2b: ACF and PACF Students produce clear and well-labeled plots of the ACF and PACF Submissions have low-quality visualizations or unclear labeling.
Mastery (15) Incomplete (0)
Question 2c: Best fit speculation Students analyze the ACF and PACF plots to speculate on the best stationary model for the data. They provide clear reasoning supported by observations from the plots, identifying any significant autocorrelation or partial autocorrelation patterns that suggest a particular model. Their speculation demonstrates a solid understanding of time series analysis concepts and the relationship between ACF, PACF, and model selection. Students attempt to speculate on the best stationary model based on the ACF and PACF plots but may struggle to provide clear reasoning or insights. Their analysis lacks coherence or depth, with limited discussion of relevant autocorrelation or partial autocorrelation patterns. They may overlook significant features in the plots or misinterpret their implications for model selection.
Mastery (5) Incomplete (0)
Question 2d: AR(p) fitted Students proficiently fit an AR(p) model to the yearly percentage change in US Real GDP. They correctly select an appropriate lag order p based on the ACF and PACF analysis or other model selection criteria, estimate the model parameters using appropriate methods, and interpret the results effectively. They may have difficulty selecting an appropriate lag order
p, estimating the model parameters accurately, or interpreting the results effectively. Their interpretation may lack depth or clarity, indicating a limited understanding of the modeling process
Mastery (5) Incomplete (0)
Question 2e: MA(q) fitted Students proficiently fit an MA(q) model to the yearly percentage change in US Real GDP. They correctly select an appropriate lag order p based on the ACF and PACF analysis or other model selection criteria, estimate the model parameters using appropriate methods, and interpret the results effectively. They may have difficulty selecting an appropriate lag order p, estimating the model parameters accurately, or interpreting the results effectively. Their interpretation may lack depth or clarity, indicating a limited understanding of the modeling process
Mastery (5) Incomplete (0)
Question 2f: ARMA(p,q) fitted Students proficiently fit an ARMA(p,q) model to the yearly percentage change in US Real GDP. They appropriately select the orders p and q based on the ACF and PACF analysis or other model selection criteria, estimate the model parameters using appropriate methods, and interpret the results effectively. Their interpretation demonstrates a clear understanding of the the underlying dynamics of the data. They may have difficulty selecting an appropriate lag order p and q estimating the model parameters accurately, or interpreting the results effectively. Their interpretation may lack depth or clarity, indicating a limited understanding of the modeling process



Mastery (10) Incomplete (0)
Question 2g: Model selection Students effectively use AIC, AICc, and BIC to compare and evaluate models, presenting results in a clear table format similar to the one found in the Model Comparison section of the Time Series Notebook Ch5 Lesson 3. Their discussions on the nuance model selection evidences they understand the importance of considering the context and data generating process that is part of model specification. Students struggle to effectively use AIC, AICc, and BIC to compare and evaluate models, resulting in unclear or incomplete presentation of results or failure to address the dangers of relying solely on algorithms for model selection.




Total Points 70