HW2_q1

.pdf

School

University of Texas *

*We aren’t endorsed by this school

Course

123A

Subject

Statistics

Date

Apr 3, 2024

Type

pdf

Pages

1

Uploaded by hs.jeong on coursehero.com

Question 1 a. For every combination of AR and MA orders {1, 2, 3} excluding model, fit the model to the data. Report the AICc values corresponding to each fitted model and identify the model that best fits the time series using the AICc criterion. In answering this question, you should fit the various models to the full data set ( do not split it into a training/test split) and assume that . fit11 <- sarima(arma1, 1 , 0 , 1 , no.constant = TRUE , details = FALSE ) print(paste( 'The AICc value for ARMA(1,1) is' , format(fit11$AICc, digit= 5 ))) ## [1] "The AICc value for ARMA(1,1) is 3.9071" fit12 <- sarima(arma1, 1 , 0 , 2 , no.constant = TRUE , details = FALSE ) print(paste( 'The AICc value for ARMA(1,2) is' , format(fit12$AICc, digit= 5 ))) ## [1] "The AICc value for ARMA(1,2) is 3.4569" fit13 <- sarima(arma1, 1 , 0 , 3 , no.constant = TRUE , details = FALSE ) print(paste( 'The AICc value for ARMA(1,3) is' , format(fit13$AICc, digit= 5 ))) ## [1] "The AICc value for ARMA(1,3) is 3.3869" fit21 <- sarima(arma1, 2 , 0 , 1 , no.constant = TRUE , details = FALSE ) print(paste( 'The AICc value for ARMA(2,1) is' , format(fit21$AICc, digit= 5 ))) ## [1] "The AICc value for ARMA(2,1) is 3.1126" fit23 <- sarima(arma1, 2 , 0 , 3 , no.constant = TRUE , details = FALSE ) print(paste( 'The AICc value for ARMA(2,3) is' , format(fit23$AICc, digit= 5 ))) ## [1] "The AICc value for ARMA(2,3) is 3.0207" fit31 <- sarima(arma1, 3 , 0 , 1 , no.constant = TRUE , details = FALSE ) print(paste( 'The AICc value for ARMA(3,1) is' , format(fit31$AICc, digit= 5 ))) ## [1] "The AICc value for ARMA(3,1) is 2.9642" fit32 <- sarima(arma1, 3 , 0 , 2 , no.constant = TRUE , details = FALSE ) print(paste( 'The AICc value for ARMA(3,2) is' , format(fit32$AICc, digit= 5 ))) ## [1] "The AICc value for ARMA(3,2) is 2.9695" fit33 <- sarima(arma1, 3 , 0 , 3 , no.constant = TRUE , details = FALSE ) print(paste( 'The AICc value for ARMA(3,3) is' , format(fit33$AICc, digit= 5 ))) ## [1] "The AICc value for ARMA(3,3) is 2.971" Answer The best model that fits the data is ARMA(3,1). The AICc value of this model is 2.9642. fit31 ## $fit ## ## Call: ## arima(x = xdata, order = c(p, d, q), seasonal = list(order = c(P, D, Q), period = S), ## xreg = xmean, include.mean = FALSE, transform.pars = trans, fixed = fixed, ## optim.control = list(trace = trc, REPORT = 1, reltol = tol)) ## ## Coefficients: ## ar1 ar2 ar3 ma1 ## 0.7996 0.5480 -0.7759 0.5535 ## s.e. 0.1142 0.1638 0.0832 0.1940 ## ## sigma^2 estimated as 1.028: log likelihood = -217.17, aic = 444.35 ## ## $degrees_of_freedom ## [1] 146 ## ## $ttable ## Estimate SE t.value p.value ## ar1 0.7996 0.1142 7.0025 0.0000 ## ar2 0.5480 0.1638 3.3454 0.0010 ## ar3 -0.7759 0.0832 -9.3226 0.0000 ## ma1 0.5535 0.1940 2.8537 0.0049 ## ## $AIC ## [1] 2.962315 ## ## $AICc ## [1] 2.964154 ## ## $BIC ## [1] 3.06267 b. For the particular model you selected in Part a, provide the equation for the fitted model (i.e. the model for with the estimated values of ’s and ’s plugged in, including the estimated value of ). Answer , where c. Separate the new time series into training and testing sets, where the first 150 observations belong to the training set and the remaining are the test set. Consider the model. Fit this model to the training set and report the corresponding AICc value. fit_model_train ## $fit ## ## Call: ## arima(x = xdata, order = c(p, d, q), seasonal = list(order = c(P, D, Q), period = S), ## xreg = xmean, include.mean = FALSE, transform.pars = trans, fixed = fixed, ## optim.control = list(trace = trc, REPORT = 1, reltol = tol)) ## ## Coefficients: ## ar1 ar2 ma1 ma2 ## 1.6317 -0.8776 -0.3199 0.3214 ## s.e. 0.0488 0.0449 0.0967 0.0818 ## ## sigma^2 estimated as 1.105: log likelihood = -222.44, aic = 454.88 ## ## $degrees_of_freedom ## [1] 146 ## ## $ttable ## Estimate SE t.value p.value ## ar1 1.6317 0.0488 33.4583 0.0000 ## ar2 -0.8776 0.0449 -19.5527 0.0000 ## ma1 -0.3199 0.0967 -3.3096 0.0012 ## ma2 0.3214 0.0818 3.9294 0.0001 ## ## $AIC ## [1] 3.032532 ## ## $AICc ## [1] 3.034371 ## ## $BIC ## [1] 3.132886 print(paste( 'The AICc value for ARMA(2, 2) is' , format(fit_model_train$AICc, digit= 5 ))) ## [1] "The AICc value for ARMA(2, 2) is 3.0344" d. Using the model fitted to the training set in Part c, generate predictions for the values of the time series in the test set. Plot the full time series (training and test sets) and superimpose the predictions of the test set portion of the time series, along with 95% predictive interval bands. How well do the predictions match the test set? How does the quality of the predictions change over time? (Hint: Consider using the geom_ribbon function within ggplot2 to create predictive interval bands) pt_fit The initial predicted data can capture more accurate values. However, the predicted data are eventually averaged values. Therefore, the quality of the predictions become poor. p , q ARMA (2, 2) ARMA ( p , q ) α = 0 ARMA ( p , q ) x t θ ϕ σ 2 w = 0.7996 + 0.5480 0.7759 0.5535 + x t x t 1 x t 2 x t 3 w t 1 w t N (0, 1.028) w t ARMA (2, 2)
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help