Create Regression Models with AR Errors
These examples show how to create regression models with AR errors using regARIMA
. For details on specifying regression models with AR errors using
the Econometric
Modeler app, see Specify Regression Model with ARMA Errors Using Econometric Modeler App.
Default Regression Model with AR Errors
This example shows how to apply the shorthand regARIMA(p,D,q)
syntax to specify a regression model with AR errors.
Specify the default regression model with AR(3) errors:
Mdl = regARIMA(3,0,0)
Mdl = regARIMA with properties: Description: "ARMA(3,0) Error Model (Gaussian Distribution)" SeriesName: "Y" Distribution: Name = "Gaussian" Intercept: NaN Beta: [1×0] P: 3 Q: 0 AR: {NaN NaN NaN} at lags [1 2 3] SAR: {} MA: {} SMA: {} Variance: NaN
The software sets the innovation distribution to Gaussian
, and each parameter to NaN
. The AR coefficients are at lags 1 through 3.
Pass Mdl
into estimate
with data to estimate the parameters set to NaN
. Though Beta
is not in the display, if you pass a matrix of predictors () into estimate
, then estimate
estimates Beta
. The estimate
function infers the number of regression coefficients in Beta
from the number of columns in .
Tasks such as simulation and forecasting using simulate
and forecast
do not accept models with at least one NaN
for a parameter value. Use dot notation to modify parameter values.
AR Error Model Without an Intercept
This example shows how to specify a regression model with AR errors without a regression intercept.
Specify the default regression model with AR(3) errors:
Mdl = regARIMA('ARLags',1:3,'Intercept',0)
Mdl = regARIMA with properties: Description: "ARMA(3,0) Error Model (Gaussian Distribution)" SeriesName: "Y" Distribution: Name = "Gaussian" Intercept: 0 Beta: [1×0] P: 3 Q: 0 AR: {NaN NaN NaN} at lags [1 2 3] SAR: {} MA: {} SMA: {} Variance: NaN
The software sets Intercept
to 0, but all other estimable parameters in Mdl
are NaN
values by default.
Since Intercept
is not a NaN
, it is an equality constraint during estimation. In other words, if you pass Mdl
and data into estimate
, then estimate
sets Intercept
to 0 during estimation.
You can modify the properties of Mdl
using dot notation.
AR Error Model with Nonconsecutive Lags
This example shows how to specify a regression model with AR errors, where the nonzero AR terms are at nonconsecutive lags.
Specify the regression model with AR(4) errors:
Mdl = regARIMA('ARLags',[1,4])
Mdl = regARIMA with properties: Description: "ARMA(4,0) Error Model (Gaussian Distribution)" SeriesName: "Y" Distribution: Name = "Gaussian" Intercept: NaN Beta: [1×0] P: 4 Q: 0 AR: {NaN NaN} at lags [1 4] SAR: {} MA: {} SMA: {} Variance: NaN
The AR coefficients are at lags 1 and 4.
Verify that the AR coefficients at lags 2 and 3 are 0.
Mdl.AR
ans=1×4 cell array
{[NaN]} {[0]} {[0]} {[NaN]}
The software displays a 1-by-4 cell array. Each consecutive cell contains the corresponding AR coefficient value.
Pass Mdl
and data into estimate
. The software estimates all parameters that have the value NaN
. Then, estimate
holds = 0 and = 0 during estimation.
Known Parameter Values for a Regression Model with AR Errors
This example shows how to specify values for all parameters of a regression model with AR errors.
Specify the regression model with AR(4) errors:
where is Gaussian with unit variance.
Mdl = regARIMA('AR',{0.2,0.1},'ARLags',[1,4], ... 'Intercept',0,'Beta',[-2;0.5],'Variance',1)
Mdl = regARIMA with properties: Description: "Regression with ARMA(4,0) Error Model (Gaussian Distribution)" SeriesName: "Y" Distribution: Name = "Gaussian" Intercept: 0 Beta: [-2 0.5] P: 4 Q: 0 AR: {0.2 0.1} at lags [1 4] SAR: {} MA: {} SMA: {} Variance: 1
There are no NaN
values in any Mdl
properties, and therefore there is no need to estimate Mdl
using estimate
. However, you can simulate or forecast responses from Mdl
using simulate
or forecast
.
Regression Model with AR Errors and t Innovations
This example shows how to set the innovation distribution of a regression model with AR errors to a distribution.
Specify the regression model with AR(4) errors:
where has a distribution with the default degrees of freedom and unit variance.
Mdl = regARIMA('AR',{0.2,0.1},'ARLags',[1,4],... 'Intercept',0,'Beta',[-2;0.5],'Variance',1,... 'Distribution','t')
Mdl = regARIMA with properties: Description: "Regression with ARMA(4,0) Error Model (t Distribution)" SeriesName: "Y" Distribution: Name = "t", DoF = NaN Intercept: 0 Beta: [-2 0.5] P: 4 Q: 0 AR: {0.2 0.1} at lags [1 4] SAR: {} MA: {} SMA: {} Variance: 1
The default degrees of freedom is NaN
. If you don't know the degrees of freedom, then you can estimate it by passing Mdl
and the data to estimate
.
Specify a distribution.
Mdl.Distribution = struct('Name','t','DoF',10)
Mdl = regARIMA with properties: Description: "Regression with ARMA(4,0) Error Model (t Distribution)" SeriesName: "Y" Distribution: Name = "t", DoF = 10 Intercept: 0 Beta: [-2 0.5] P: 4 Q: 0 AR: {0.2 0.1} at lags [1 4] SAR: {} MA: {} SMA: {} Variance: 1
You can simulate or forecast responses using simulate
or forecast
because Mdl
is completely specified.
In applications, such as simulation, the software normalizes the random innovations. In other words, Variance
overrides the theoretical variance of the random variable (which is DoF
/(DoF
- 2)), but preserves the kurtosis of the distribution.
See Also
Apps
Objects
Functions
Related Examples
- Analyze Time Series Data Using Econometric Modeler
- Specifying Univariate Lag Operator Polynomials Interactively
- Create Regression Models with ARIMA Errors
- Specify Default Regression Model with ARIMA Errors
- Create Regression Models with MA Errors
- Create Regression Models with ARMA Errors
- Create Regression Models with SARIMA Errors
- Specify ARIMA Error Model Innovation Distribution