MATLAB Examples

AR Model with Nonconsecutive Lags

This example shows how to specify an AR(p) model with nonzero coefficients at nonconsecutive lags.

Specify an AR(4) model with nonzero AR coefficients at lags 1 and 4 (and no constant term),

$${y_t} = 0.2 + 0.8{y_{t - 1}} - 0.1{y_{t - 4}} + {\varepsilon _t},$$

where the innovation distribution is Gaussian with constant variance.

model = arima('ARLags',[1,4],'Constant',0)
model = 

    ARIMA(4,0,0) Model:
    Distribution: Name = 'Gaussian'
               P: 4
               D: 0
               Q: 0
        Constant: 0
              AR: {NaN NaN} at Lags [1 4]
             SAR: {}
              MA: {}
             SMA: {}
        Variance: NaN

The output shows the nonzero AR coefficients at lags 1 and 4, as specified. The property P is equal to 4, the number of presample observations needed to initialize the AR model. The unconstrained parameters are equal to NaN.

Display the value of AR:

ans =

  1x4 cell array

    {[NaN]}    {[0]}    {[0]}    {[NaN]}

The AR cell array returns four elements. The first and last elements (corresponding to lags 1 and 4) have value NaN, indicating these coefficients are nonzero and need to be estimated or otherwise specified by the user. arima sets the coefficients at interim lags equal to zero to maintain consistency with MATLAB® cell array indexing.