The prediction variance of the forecast for lead times l=1,...,maxLead is computed given theoretical autocovariances.
PredictionVariance(r, maxLead =1, DLQ =TRUE)
Arguments
r: the autocovariances at lags 0, 1, 2, ...
maxLead: maximum lead time of forecast
DLQ: Using Durbin-Levinson if TRUE. Otherwise Trench algorithm used.
Details
Two algorithms are available which are described in detail in McLeod, Yu and Krougly (2007). The default method, DLQ=TRUE, uses the autocovariances provided in r to determine the optimal linear mean-square error predictor of order length(r)-1. The mean-square error of this predictor is the lead-one error variance. The moving-average expansion of this model is used to compute any remaining variances (McLeod, Yu and Krougly, 2007). With the other Trench algorithm, when DLQ=FALSE, a direct matrix representation of the forecast variances is used (McLeod, Yu and Krougly, 2007). The Trench method is exact. Provided the length of r is large enough, the two methods will agree.
Returns
vector of length maxLead containing the variances
References
McLeod, A.I., Yu, Hao, Krougly, Zinovi L. (2007). Algorithms for Linear Time Series Analysis, Journal of Statistical Software.
Author(s)
A.I. McLeod
See Also
predict.Arima, TrenchForecast, exactLoglikelihood
Examples
#Example 1. Compare using DL method or Trench methodva<-PredictionVariance(0.9^(0:10), maxLead=10)vb<-PredictionVariance(0.9^(0:10), maxLead=10, DLQ=FALSE)cbind(va,vb)# #Example 2. Compare with predict.Arima#general script, just change z, p, q, MLz<-sqrt(sunspot.year)n<-length(z)p<-9q<-0ML<-10#for different data/model just reset aboveout<-arima(z, order=c(p,0,q))sda<-as.vector(predict(out, n.ahead=ML)$se)#phi<-theta<-numeric(0)if(p>0) phi<-coef(out)[1:p]if(q>0) theta<-coef(out)[(p+1):(p+q)]zm<-coef(out)[p+q+1]sigma2<-out$sigma2
r<-sigma2*tacvfARMA(phi, theta, maxLag=n+ML-1)sdb<-sqrt(PredictionVariance(r, maxLead=ML))cbind(sda,sdb)## #Example 3. DL and Trench method can give different results# when the acvf is slowly decaying. Trench is always# exact based on a finite-sample.L<-5r<-1/sqrt(1:(L+1))va<-PredictionVariance(r, maxLead=L)vb<-PredictionVariance(r, maxLead=L, DLQ=FALSE)cbind(va,vb)#results are slightly differentr<-1/sqrt(1:(1000))#larger number of autocovariancesva<-PredictionVariance(r, maxLead=L)vb<-PredictionVariance(r, maxLead=L, DLQ=FALSE)cbind(va,vb)#results now agree