Skip to contents

Functions to create an autoregressive model (ar) or a modified autoregressive model (ar2)

Usage

ar(
  name,
  ar,
  fixedar = FALSE,
  variance = 0.01,
  fixedvariance = FALSE,
  nlags = 0,
  zeroinit = FALSE
)

ar2(
  name,
  ar,
  fixedar = FALSE,
  variance = 0.01,
  fixedvariance = FALSE,
  nlags = 0,
  nfcasts = 0
)

Arguments

ar

vector of the AR coefficients (\(\varphi_1, \dots, \varphi_p\)).

fixedar

boolean that triggers the estimation of the AR coefficients (FALSE) or fixed it (TRUE) to a pre-specified value set by the parameter ar.

variance

the variance (\(\sigma^2_{ar}\)).

fixedvariance

boolean that triggers the estimation of the variance (FALSE) or fixed it (TRUE) to a pre-specified value set by the parameter variance.

nlags

integer specifying how many lags of the state variable are needed

zeroinit

boolean determining the initial condition for the state variable, which is equal to zero if zeroinit = TRUE. The default (zeroinit = FAKSE) triggers the an initialization based on the unconditional mean and variance of the AR(p) process.

nfcasts

integer specifying how many forecasts of the state variable are needed

Details

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.