MATLAB Examples

Specify an AR(2) Model

To illustrate assigning property values, consider specifying the AR(2) model

$$y_t=0.8y_{t-1}-0.2y_{t-2}+\varepsilon_t,$$

where the innovations are independent and identically distributed normal random variables with mean 0 and variance 0.2. This is a conditional mean model, so use arima. Assign values to model properties using name-value pair arguments.

This model has two AR coefficients, 0.8 and -0.2. Assign these values to the property AR as a cell array, {0.8,-0.2}. Assign the value 0.2 to Variance, and 0 to Constant. You do not need to assign a value to Distribution because the default innovation distribution is 'Gaussian'. There are no MA terms, seasonal terms, or degrees of integration, so do not assign values to these properties. You cannot specify values for the properties P and Q.

In summary, specify the model as follows:

Mdl = arima('AR',{0.8,-0.2},'Variance',0.2,'Constant',0)
Mdl = 

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

The output displays the value of the created model, Mdl. Notice that the property Seasonality is not in the output. Seasonality only displays for models with seasonal integration. The property is still present, however, as seen in the Variable Editor.

Mdl has values for every arima property, even though the specification included only three. arima assigns default values for the unspecified properties. The values of SAR, MA, and SMA are empty cell arrays because the model has no seasonal or MA terms. The values of D and Seasonality are 0 because there is no nonseasonal or seasonal differencing. arima sets:

  • P equal to 2, the number of presample observations needed to initialize an AR(2) model.
  • Q equal to 0 because there is no MA component to the model (i.e., no presample innovations are needed).