MATLAB Examples

# Dot Notation

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

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.

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