Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

AR Model Specifications

Default AR Model

This example shows how to use the shorthand arima(p,D,q) syntax to specify the default AR() model,

By default, all parameters in the created model object have unknown values, and the innovation distribution is Gaussian with constant variance.

Specify the default AR(2) model:

model = arima(2,0,0)
model = 
  arima with properties:

     Description: "ARIMA(2,0,0) Model (Gaussian Distribution)"
    Distribution: Name = "Gaussian"
               P: 2
               D: 0
               Q: 0
        Constant: NaN
              AR: {NaN NaN} at lags [1 2]
             SAR: {}
              MA: {}
             SMA: {}
     Seasonality: 0
            Beta: [1×0]
        Variance: NaN

The output shows that the created model object, model, has NaN values for all model parameters: the constant term, the AR coefficients, and the variance. You can modify the created model object using dot notation, or input it (along with data) to estimate.

AR Model with No Constant Term

This example shows how to specify an AR(p) model with constant term equal to zero. Use name-value syntax to specify a model that differs from the default model.

Specify an AR(2) model with no constant term,

where the innovation distribution is Gaussian with constant variance.

model = arima('ARLags',1:2,'Constant',0)
model = 
  arima with properties:

     Description: "ARIMA(2,0,0) Model (Gaussian Distribution)"
    Distribution: Name = "Gaussian"
               P: 2
               D: 0
               Q: 0
        Constant: 0
              AR: {NaN NaN} at lags [1 2]
             SAR: {}
              MA: {}
             SMA: {}
     Seasonality: 0
            Beta: [1×0]
        Variance: NaN

The ARLags name-value argument specifies the lags corresponding to nonzero AR coefficients. The property Constant in the created model object is equal to 0, as specified. The model object has default values for all other properties, including NaN values as placeholders for the unknown parameters: the AR coefficients and scalar variance.

You can modify the created model object using dot notation, or input it (along with data) to estimate.

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),

where the innovation distribution is Gaussian with constant variance.

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

     Description: "ARIMA(4,0,0) Model (Gaussian Distribution)"
    Distribution: Name = "Gaussian"
               P: 4
               D: 0
               Q: 0
        Constant: 0
              AR: {NaN NaN} at lags [1 4]
             SAR: {}
              MA: {}
             SMA: {}
     Seasonality: 0
            Beta: [1×0]
        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:

model.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.

ARMA Model with Known Parameter Values

This example shows how to specify an ARMA(p, q) model with known parameter values. You can use such a fully specified model as an input to simulate or forecast.

Specify the ARMA(1,1) model

where the innovation distribution is Student's t with 8 degrees of freedom, and constant variance 0.15.

tdist = struct('Name','t','DoF',8);
model = arima('Constant',0.3,'AR',0.7,'MA',0.4,...
						'Distribution',tdist,'Variance',0.15)
model = 
  arima with properties:

     Description: "ARIMA(1,0,1) Model (t Distribution)"
    Distribution: Name = "t", DoF = 8
               P: 1
               D: 0
               Q: 1
        Constant: 0.3
              AR: {0.7} at lag [1]
             SAR: {}
              MA: {0.4} at lag [1]
             SMA: {}
     Seasonality: 0
            Beta: [1×0]
        Variance: 0.15

Because all parameter values are specified, the created model has no NaN values. The functions simulate and forecast don't accept input models with NaN values.

AR Model with a t Innovation Distribution

This example shows how to specify an AR() model with a Student's t innovation distribution.

Specify an AR(2) model with no constant term,

where the innovations follow a Student's t distribution with unknown degrees of freedom.

model = arima('Constant',0,'ARLags',1:2,'Distribution','t')
model = 
  arima with properties:

     Description: "ARIMA(2,0,0) Model (t Distribution)"
    Distribution: Name = "t", DoF = NaN
               P: 2
               D: 0
               Q: 0
        Constant: 0
              AR: {NaN NaN} at lags [1 2]
             SAR: {}
              MA: {}
             SMA: {}
     Seasonality: 0
            Beta: [1×0]
        Variance: NaN

The value of Distribution is a struct array with field Name equal to 't' and field DoF equal to NaN. The NaN value indicates the degrees of freedom are unknown, and need to be estimated using estimate or otherwise specified by the user.

Specify AR Model Using Econometric Modeler

In the Econometric Modeler app, you can specify the lag structure, presence of a constant, and innovation distribution of an AR(p) model by following these steps. All specified coefficients are unknown, estimable parameters.

  1. In the Data Browser, select the response time series to which the model will be fit.

  2. On the Econometric Modeler tab, in the Models section, click AR.

    The AR Model Parameters dialog box appears.

  3. Specify the lag structure. To specify an AR(p) model that includes all AR lags from 1 through p, use the Lag Order tab. For the flexibility to specify the inclusion of particular lags, use the Lag Vector tab. For more details, see Specifying Lag Operator Polynomials Interactively. Regardless of the tab you use, you can verify the model form by inspecting the equation in the Model Equation section.

For example:

  • To specify an AR(2) model that includes a constant, includes the first lag, and has a Gaussian innovation distribution, in the Autoregressive Order box, type 2.

  • To specify an AR(2) model that includes the first lag, has a Gaussian distribution, but does not include a constant:

    1. In the Autoregressive Order box, type 2.

    2. Clear the Include Constant Term box.

  • To specify the AR(4) model containing nonconsecutive lags

    yt=ϕ1yt1+ϕ4yt4+εt,

    where εt is a series of IID Gaussian innovations,

    1. Click the Lag Vector tab.

    2. In the Autoregressive Lags box, type 1 4.

    3. Clear the Include Constant Term box.

  • To specify an AR(2) model that includes the first lag and a constant term, and has a t innovations distribution:

    1. In the Autoregressive Lags box, type 2.

    2. Click Innovation Distribution > t.

    The degrees of freedom parameter of the t distribution is an unknown, but estimable parameter.

After you specify a model, click Estimate to estimate all unknown parameters.

See Also

Apps

Objects

Functions

Related Examples

More About

Was this topic helpful?