Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Extend the first order case of the AR(1) model to the AR(2) case. Detail how the variance of the predictions is computed. Simulate this with
Extend the first order case of the AR(1) model to the AR(2) case. Detail how the variance of the predictions is computed. Simulate this with an empirical example where Ptt+1 is computed for one-step ahead under a Gaussian error. AR(1) Example: # Number of observations N <- 500 # Simulation x <- arima.sim(list(ar=0.9), n=N) # Durbin-Levinson algorithm DLalgo <- function(x) { T <- length(x) # MSE matrix P <- matrix(0,T,1) # Phi matrix phi <- matrix(0,T,1) # Get the rhos rhos <- acf(x, lag.max=length(x), plot=FALSE)$acf # Intialize for an AR(1) phi[1,1] <- rhos[1,1,1] P[1,1] <- var(x)/(1-phi[1,1]^2) # Now loop over the computation for(i in 2:length(x)) { phi[i-1,1] <- (rhos[i-1,1,1] sum(phi[(T-i-1)]*rhos[T-i,1,1])) / (1-sum(rhos[-i,1,1])) } # print out the results print(DLalgo(x)[1:10]) > print(DLalgo(x)[1:10]) [1] 0.7162427 0.6905250 0.6612465 0.6315899 0.5995472 0.5495968 0.5181615 [8] 0.4748376 0.4370178 0.3894195
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started