Documentation |
On this page… |
---|
MA Model with No Constant Term MA Model with Nonconsecutive Lags |
This example shows how to use the shorthand arima(p,D,q) syntax to specify the default MA
By default, all parameters in the created model object have unknown values, and the innovation distribution is Gaussian with constant variance.
Specify the default MA(3) model:
model = arima(0,0,3)
model = ARIMA(0,0,3) Model: -------------------- Distribution: Name = 'Gaussian' P: 0 D: 0 Q: 3 Constant: NaN AR: {} SAR: {} MA: {NaN NaN NaN} at Lags [1 2 3] SMA: {} Variance: NaN
The output shows that the created model object, model, has NaN values for all model parameters: the constant term, the MA coefficients, and the variance. You can modify the created model object using dot notation, or input it (along with data) to estimate.
This example shows how to specify an MA(q) model with constant term equal to zero. Use name-value syntax to specify a model that differs from the default model.
Specify an MA(2) model with no constant term,
where the innovation distribution is Gaussian with constant variance.
model = arima('MALags',1:2,'Constant',0)
model = ARIMA(0,0,2) Model: -------------------- Distribution: Name = 'Gaussian' P: 0 D: 0 Q: 2 Constant: 0 AR: {} SAR: {} MA: {NaN NaN} at Lags [1 2] SMA: {} Variance: NaN
The MALags name-value argument specifies the lags corresponding to nonzero MA 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 MA coefficients and scalar variance.
You can modify the created model variable, or input it (along with data) to estimate.
This example shows how to specify an MA(q) model with nonzero coefficients at nonconsecutive lags.
Specify an MA(4) model with nonzero MA coefficients at lags 1 and 4 (an no constant term),
where the innovation distribution is Gaussian with constant variance.
model = arima('MALags',[1,4],'Constant',0)
model = ARIMA(0,0,4) Model: -------------------- Distribution: Name = 'Gaussian' P: 0 D: 0 Q: 4 Constant: 0 AR: {} SAR: {} MA: {NaN NaN} at Lags [1 4] SMA: {} Variance: NaN
The output shows the nonzero AR coefficients at lags 1 and 4, as specified. The property Q is equal to 4, the number of presample innovations needed to initialize the MA model. The unconstrained parameters are equal to NaN.
Display the value of MA:
model.MA
ans = [NaN] [0] [0] [NaN]
The MA 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.
This example shows how to specify an MA(q) model with known parameter values. You can use such a fully specified model as an input to simulate or forecast.
Specify the MA(4) model
where the innovation distribution is Gaussian with constant variance 0.15.
model = arima('Constant',0.1,'MA',{0.7,0.2},... 'MALags',[1,4],'Variance',0.15)
model = ARIMA(0,0,4) Model: -------------------- Distribution: Name = 'Gaussian' P: 0 D: 0 Q: 4 Constant: 0.1 AR: {} SAR: {} MA: {0.7 0.2} at Lags [1 4] SMA: {} Variance: 0.15
Because all parameter values are specified, the created model object has no NaN values. The functions simulate and forecast don't accept input models with NaN values.
This example shows how to specify an MA(q) model with a Student's t innovation distribution.
Specify an MA(2) model with no constant term,
where the innovation process follows a Student's t distribution with eight degrees of freedom.
tdist = struct('Name','t','DoF',8); model = arima('Constant',0,'MALags',1:2,'Distribution',tdist)
model = ARIMA(0,0,2) Model: -------------------- Distribution: Name = 't', DoF = 8 P: 0 D: 0 Q: 2 Constant: 0 AR: {} SAR: {} MA: {NaN NaN} at Lags [1 2] SMA: {} Variance: NaN
The value of Distribution is a struct array with field Name equal to 't' and field DoF equal to 8. When you specify the degrees of freedom, they aren't estimated if you input the model to estimate.
arima | estimate | forecast | simulate | struct