Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

A model created by `arima`

has values assigned to all model properties. To change any of these property values, you do not need to reconstruct the whole model. You can modify property values of an existing model using dot notation. That is, type the model name, then the property name, separated by `'.'`

(a period).

For example, start with this model specification:

Mdl = arima(2,0,0)

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

Modify the model to remove the constant term:

Mdl.Constant = 0

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

The updated constant term now appears in the model output.

Be aware that every model property has a data type. Any modifications you make to a property value must be consistent with the data type of the property. For example, `AR`

, `MA`

, `SAR`

, and `SMA`

are all cell vectors. This mean you must index them using cell array syntax.

For example, start with the following model:

Mdl = arima(2,0,0)

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

To modify the property value of `AR`

, assign `AR`

a cell array. Here, assign known AR coefficient values:

Mdl.AR = {0.8,-0.4}

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

The updated model now has AR coefficients with the specified equality constraints.

Similarly, the data type of `Distribution`

is a data structure. The default data structure has only one field, `Name`

, with value `'Gaussian'`

.

Distribution = Mdl.Distribution

Distribution = struct with fields: Name: 'Gaussian'

To modify the innovation distribution, assign `Distribution`

a new name or data structure. The data structure can have up to two fields, `Name`

and `DoF`

. The second field corresponds to the degrees of freedom for a Student's *t* distribution, and is only required if `Name`

has the value `'t'`

.

To specify a Student's *t* distribution with unknown degrees of freedom, enter:

```
Mdl.Distribution = 't'
```

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

The updated model has a Student's *t* distribution with `NaN`

degrees of freedom. To specify a *t* distribution with eight degrees of freedom, say:

Mdl.Distribution = struct('Name','t','DoF',8)

Mdl = ARIMA(2,0,0) Model: -------------------- Distribution: Name = 't', DoF = 8 P: 2 D: 0 Q: 0 Constant: NaN AR: {0.8 -0.4} at Lags [1 2] SAR: {} MA: {} SMA: {} Variance: NaN

The degrees of freedom property of the model is updated. Note that the `DoF`

field of `Distribution`

is not directly assignable. For example, `Mdl.Distribution.DoF = 8`

is not a valid assignment. However, you can get the individual fields:

Mdl.Distribution.DoF

ans = 8

You can modify `Mdl`

to include, for example, two coefficients
and
corresponding to two predictor series. Since `Beta`

has not been specified yet, you have not seen it in the output. To include it, enter:

Mdl.Beta=[0.2 4]

Mdl = ARIMAX(2,0,0) Model: --------------------- Distribution: Name = 't', DoF = 8 P: 2 D: 0 Q: 0 Constant: NaN AR: {0.8 -0.4} at Lags [1 2] SAR: {} MA: {} SMA: {} Beta: [0.2 4] Variance: NaN

Not all model properties are modifiable. You cannot change these properties in an existing model:

`P`

. This property updates automatically when any of*p*(degree of the nonseasonal AR operator), (degree of the seasonal AR operator),*D*(degree of nonseasonal differencing), or*s*(degree of seasonal differencing) changes.`Q`

. This property updates automatically when either*q*(degree of the nonseasonal MA operator), or (degree of the seasonal MA operator) changes.

Not all name-value pair arguments you can use for model creation are properties of the created model. Specifically, you can specify the arguments `ARLags`

, `MALags`

, `SARLags`

, and `SMALags`

during model creation. These are not, however, properties of `arima`

models. This means you cannot retrieve or modify them in an existing model.

The nonseasonal and seasonal AR and MA lags update automatically if you add any elements to (or remove from) the coefficient cell arrays `AR`

, `MA`

, `SAR`

, or `SMA`

.

For example, specify an AR(2) model:

Mdl = arima(2,0,0)

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

The model output shows nonzero AR coefficients at lags 1 and 2.

Add a new AR term at lag 12:

Mdl.AR{12} = NaN

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

The three nonzero coefficients at lags 1, 2, and 12 now display in the model output. However, the cell array assigned to `AR`

returns twelve elements:

Mdl.AR

ans = 1×12 cell array Columns 1 through 10 [NaN] [NaN] [0] [0] [0] [0] [0] [0] [0] [0] Columns 11 through 12 [0] [NaN]

`AR`

has zero coefficients at all the interim lags to maintain consistency with traditional MATLAB® cell array indexing.

Was this topic helpful?