Learn R Programming

FitAR (version 1.94)

BackcastResidualsAR: Innovation Residuals in AR

Description

Obtains the residuals (estimated innovations). The residuals for t=1,...,p are obtained using the backforecasting algorithm of Box and Jenkins (1970).

Usage

BackcastResidualsAR(y, phi, Q = 100, demean=TRUE)

Arguments

y
a time series or vector
phi
AR coefficients, lags 1,...,p
Q
for backcasting, the AR is approximated by an MA(Q)
demean
subtract sample mean

Value

Vector of residuals

Details

The backforecasting algorithm is described in detail in the book of Box and Jenkins (1970). The idea is to compute the expected value of the innovation assuming a high-order MA(q).

References

Box and Jenkins (1970). Time Series Analysis: Forecasting and Control.

See Also

InvertibleQ, FitAR

Examples

Run this code
#compare residuals obtained using backcasting with fitted parameters and
# the residuals extracted from output of FitAR.  They are identical.
p<-11
out<-FitAR(log(lynx), p)
phi<-out$phiHat #fitted parameters
resphi<-BackcastResidualsAR(log(lynx), phi)
sum(abs(resphi-resid(out)))

Run the code above in your browser using DataLab