atsa5.pdf - K.PRAVALLIKA|CE15B079 ASSIGNMENT-5 1(a Given process = 1 1 0.2 1 0.1 3 library(forecast set.seed(3 ek = rnorm(600 vk = arima.sim(n = 600

atsa5.pdf - K.PRAVALLIKA|CE15B079 ASSIGNMENT-5 1(a Given...

This preview shows page 1 - 5 out of 21 pages.

1 K.PRAVALLIKA|CE15B079 ASSIGNMENT-5 1 (a) Given process, ?[?] = 1 1 − 0.2? −1 − 0.1? −3 ?[?] library (forecast) set.seed ( 3 ) ek = rnorm ( 600 ) vk = arima.sim ( n = 600 , list ( ar = c ( - 0.2 , 0 , -0.1 ), order = c ( 3 , 0 , 0 )), innov = ek) acf (vk) pacf (vk)
Image of page 1
2 K.PRAVALLIKA|CE15B079 ## b) Generating ARMA models To generate best AR model, aic<- Inf BmodAR<- NULL for (i in c ( 1 , 2 , 3 , 4 , 5 )){ modAR = arima (vk, order= c (i, 0 , 0 )) if (modAR $ aic < aic){ aic<-modAR $ aic BmodAR<-modAR } } print (BmodAR) ## ## Call: ## arima(x = vk, order = c(i, 0, 0)) ## ## Coefficients: ## ar1 ar2 ar3 intercept ## -0.2003 -0.0202 -0.0924 0.0141 ## s.e. 0.0407 0.0415 0.0407 0.0313 ## ## sigma^2 estimated as 1.014: log likelihood = -855.68, aic = 1721.36 aic<- Inf BmodMA<- NULL
Image of page 2
3 K.PRAVALLIKA|CE15B079 for (i in c ( 1 , 2 )){ modMA = arima (vk, order= c ( 0 , 0 ,i)) if (modMA $ aic < aic){ aic<-modMA $ aic BmodMA<-modMA } } print (BmodMA) ## ## Call: ## arima(x = vk, order = c(0, 0, i)) ## ## Coefficients: ## ma1 intercept ## -0.2018 0.014 ## s.e. 0.0401 0.033 ## ## sigma^2 estimated as 1.023: log likelihood = -858.3, aic = 1722.61 aic<- Inf BmodARMA<- NULL for (i in c ( 1 , 2 , 3 , 4 , 5 )){ for (j in c ( 1 , 2 )){ modARMA = arima (vk, order= c (i, 0 ,j)) if (modARMA $ aic < aic){ aic<-modARMA $ aic BmodARMA<-modARMA } } } print (BmodARMA) ## ## Call: ## arima(x = vk, order = c(i, 0, j)) ## ## Coefficients: ## ar1 ar2 ar3 ma1 intercept ## -0.6705 -0.1145 -0.0935 0.4756 0.0140 ## s.e. 0.2583 0.0686 0.0430 0.2579 0.0323 ## ## sigma^2 estimated as 1.012: log likelihood = -854.92, aic = 1721.84 (c) Choosing a model It is observed that AR(3) Model has the least aic. print (BmodAR)
Image of page 3
4 K.PRAVALLIKA|CE15B079 ## ## Call: ## arima(x = vk, order = c(i, 0, 0)) ## ## Coefficients: ## ar1 ar2 ar3 intercept ## -0.2003 -0.0202 -0.0924 0.0141 ## s.e. 0.0407 0.0415 0.0407 0.0313 ## ## sigma^2 estimated as 1.014: log likelihood = -855.68, aic = 1721.36 (d) c = 0 for (k in c ( 1 : 100 )) { aic = Inf bmodel = NULL ek = rnorm ( 600 ) vk = arima.sim ( n = 600 , list ( ar = c ( - 0.2 , 0 , -0.1 ), order = c ( 3 , 0 , 0 )), innov = ek) for (i in c ( 0 : 5 )) { for (j in c ( 0 : 2 )) { if (i != 0 || j != 0 ){ model = arima (vk, order = c (i, 0 , j), optim.control = list ( maxit = 1000 ), method = "ML" ) if (model $ aic < aic){ aic = model $ aic bmodel = model I = i J = j } } } } if (I == 3 && J == 0 ){ c = c + 1 } } print (c) ## [1] 23 Identified model matches 23 times with the true process.
Image of page 4
Image of page 5

You've reached the end of your free preview.

Want to read all 21 pages?

  • Summer '19
  • Maximum likelihood, Likelihood function, AIC, log likelihood, K.PRAVALLIKA|CE15B079

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture