6.4 Example: An AR(2) Model
Auto-regressive models are commonly used in time series analysis and typically are written in the following form,
zt=θ1zt−1+θ2zt−2+⋯+θpzt−p+εt
where the above model would be denoted an autoregressive model of order p or AR(p). While there are a variety of approaches to fitting AR(p) models proposed, we can easily fit them into the state space model framework and use the Kalman filter machinery to do maximum likelihood estimation.
Consider an AR(2) model of the form
zt=ϕ1zt−1+ϕ2zt−2+wt For now, let’s assume that the time series zt has mean 0 and wt∼N(0,τ2).
We can write the state vector as
xt=[ztϕ2zt−1]
and
xt−1=[zt−1ϕ2zt−2]
We can furthermore write
Θ=[ϕ11ϕ20]
so that we have
[ztϕ2zt−1]=[ϕ11ϕ20][zt−1ϕ2zt−2]+[10]wt which follows the form
xt=Θxt−1+Bwt
Although it seems weird and totally artificial, it does work. Sometimes you have to take a step back before you take a step forward!
Finally, the observation equation is simply
yt=Axt
where
A=[10]
In this case, there is no variance term for the observation equation.
Because this model is slightly different from what we’ve had previously, we need to alter the update step in the Kalman filter. Here, the update step is now
xt−1t=Θxt−1t−1Pt−1t=ΘPt−1t−1Θ′+τ2BB′
[1] 19000.06
[1] 8.996889e-01 -8.296826e-02 4.528905e+00 -3.030640e-12 -3.914266e-12
Here are the point estimates for the autoregressive parameters.
[1] 0.89968888 -0.08296826
And here are their asymptotic standard errors.
[1] 0.03675802 0.03676557