Autoregressive model of order p
Definition
The AR process is defined by
\[\Phi\left(B\right)y_t=\epsilon_t\]where:
\[\Phi\left(B\right)=1+\varphi_1 B + \cdots + \varphi_p B^p\]is an auto-regressive polynomial.
It conforms to the general SSF by setting the state vector
\[\alpha_t= \begin{pmatrix} y_{t-nlags} \\ \vdots \\ y_{t-1} \\ \hline y_{t} \\ y_{t+1|t} \\ \vdots \\ y_{t+h|t} \end{pmatrix}\]of size $r0=max(p,h+1)$, where $h$ is the forecast horizon desired by the user, and $nlags=0$ by default. If independently of the AR order the user specifies a number of lagged values required ( $nlags$), then the size of the state vector will be $r=r0+nlags$.
The transition matrices are
\[T_t = \begin{pmatrix} 0 &1 & 0 & \cdots & 0 \\0& 0 & 1 & \cdots & 0\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ 0 & 0 & 0 & \cdots & 1\\ -\varphi_r & \cdots & \cdots & \cdots &-\varphi_1 \end{pmatrix}\]with $\varphi_{j}=0$ for $j>p$
\[S_t = \begin{pmatrix} 0 \\ \vdots \\ 0\\ \hline 1 \\ \psi_1 \\ \vdots\\ \psi_s \end{pmatrix}\] \[V_t = \sigma_{ar}^{2} S S'\]Depending on the estimation algorithm used, it may be preferrable to slightly modify the model and set $\sigma_{ar}^2=1$
jd3_ssf_ar2
This R function is used to define an autoregressive model that belongs to the JD+ class JD3_SsfItem
output
Object of the JD+ class JD3_SsfItem
:
usage
jd3_ssf_ar2(name, ar, fixedar, variance, fixedvariance, nlags, zeroinit)
Argument | Definition | Default | Remarks |
---|---|---|---|
name | string with the name of the component | ex. "trend", do not forget the commmas | |
ar | double array of AR coefficients, i.e. $\varphi_1$, $\ldots$, $\varphi_p$ | The autoregressive order is determined by the size of the array, e.g. of your write c(1.5, -0.6), you are implicitely fixing the order of your AR(p) model to $p=2$ with $\varphi_{1}=1.5$ and $\varphi_{2}=-0.6$ | |
fixedar | logical that triggers estimation of the AR coefficients $\varphi_1$, $\ldots$, $\varphi_p$ (FALSE) or fixes them (TRUE) to a pre-specified values above, set by the parameter ar | FALSE | |
variance | double for the value of $\sigma^2_{ar}$ | 1 | variance of the innovation is actually $\sigma^2\sigma^2_{ar}$ |
fixedvariance | logical that triggers estimation of $\sigma^2_{ar}$ (FALSE) or fixes it (TRUE) to a pre-specified value set by the parameter variance | FALSE | |
nlags | integer specifying how many lags of the state variable are needed | 0 | Note that the number of lags desired are independent from the order of the AR model. You may have an order $p=2$ and and do not need to specify any of its lags in the measurement equation (in this case, the default nlags=0 would be sufficient) |
nfcasts | integer specifying how many forecasts of the state variable are needed | 0 | Note that the resulting state space representation stacks the lagged values of the state together with the forecasts, as shown in the state-space representation above |
Examples of use
jd3_ssf_ar2("cycle", c(1.5,-0.4), fixedar=FALSE, variance=1, fixedvariance=TRUE, nlags=4, nfcasts=4) //
jd3_ssf_ar2("cycle", c(1.5,-0.4), fixedar=FALSE, variance=1, fixedvariance=FALSE, nlags=0, , nfcasts=0) // default
jd3_ssf_ar2("cycle", c(1.5,-0.4))