Main Content

arima

Class:regARIMA

Convert regression model with ARIMA errors to ARIMAX model

Syntax

ARIMAX = arima(Mdl)
[ARIMAX,XNew] = arima(Mdl,Name,Value)

Description

Thearimaobject function converts a specified regression model with ARIMA errors (regARIMAmodel object) to the equivalent ARIMAX model (arimamodel object). To create an ARIMAX model directly, seearima

ARIMAX= arima(Mdl)converts the univariate regression model with ARIMA time series errorsMdlto a model of typearimaincluding a regression component (ARIMAX).

[ARIMAX,XNew] = arima(Mdl,Name,Value)returns an updated regression matrix of predictor data using additional options specified by one or moreName,Valuepair arguments.

Input Arguments

Mdl

Regression model with ARIMA time series errors, as created byregARIMAorestimate

Name-Value Arguments

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, whereNameis the argument name andValueis the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and encloseNamein quotes.

X

Predictor data for the regression component ofMdl, specified as the comma-separated pair consisting of'X'and a matrix.

The last row ofXcontains the latest observation of each series.

Each column ofXis a separate time series.

Output Arguments

ARIMAX

ARIMAX model equivalent to the regression model with ARIMA errorsMdl, returned as a model of typearima

XNew

Updated predictor data matrix for the regression component ofARIMAX, returned as a matrix.

XNewhas the same number of rows asX。The last row ofXNewcontains the latest observation of each series.

Each column ofXNewis a separate time series. The number of columns ofXNewis one plus the number of nonzero autoregressive coefficients in the difference equation ofMdl

Examples

expand all

Convert a regression model with ARMA(4,1) errors to an ARIMAX model using thearimaconverter.

Specify the regression model with ARMA(4,1) errors:

y t = 1 + 0 5 X t + u t u t = 0 8 u t - 1 - 0 4 u t - 4 + ε t + 0 3 ε t - 1 ,

where ε t is Gaussian with mean 0 and variance 1.

Mdl = regARIMA('AR',{0.8, -0.4},'MA',0.3,。..'ARLags',[1 4],'Intercept',1,'Beta',0.5,。..'Variance',1)
Mdl = regARIMA属性:描述:“Regression with ARMA(4,1) Error Model (Gaussian Distribution)" Distribution: Name = "Gaussian" Intercept: 1 Beta: [0.5] P: 4 Q: 1 AR: {0.8 -0.4} at lags [1 4] SAR: {} MA: {0.3} at lag [1] SMA: {} Variance: 1

You can verify that the lags of the autoregressive terms are1and4in theARrow.

Generate random predictor data.

rng(1);% For reproducibilityT = 20; X = randn(T,1);

ConvertMdlto an ARIMAX model.

[ARIMAX,XNew] = arima(Mdl,'X',X); ARIMAX
ARIMAX = arima with properties: Description: "ARIMAX(4,0,1) Model (Gaussian Distribution)" Distribution: Name = "Gaussian" P: 4 D: 0 Q: 1 Constant: 0.6 AR: {0.8 -0.4} at lags [1 4] SAR: {} MA: {0.3} at lag [1] SMA: {} Seasonality: 0 Beta: [1 -0.8 0.4] Variance: 1

The newarimamodel,ARIMAX, is

y t = 0 6 + Z t Γ + 0 8 y t - 1 - 0 4 y t - 4 + ε t + 0 3 ε t - 1 ,

where

Z t Γ = [ 0 5 x 1 N a N N a N 0 5 x 2 0 5 x 1 N a N 0 5 x 3 0 5 x 2 N a N 0 5 x 4 0 5 x 3 N a N 0 5 x 5 0 5 x 4 0 5 x 1 0 5 T 0 5 x T - 1 0 5 x T - 4 ] [ 1 - 0 8 0 4 ]

and x j is rowjofX。自自回归和的产物integration polynomials is ϕ ( L ) = ( 1 - 0 8 L + 0 4 L 4 ) , ARIMAX.Betais simply[1 -0.8 0.4]。Note that the software carries over the autoregressive and moving average coefficients fromMdltoARIMAX。Also,Mdl.Intercept= 1 andARIMAX.Constant= (1 - 0.8 + 0.4)(1) = 0.6, i.e., theregARIMAmodel intercept andarimamodel constant are generally unequal.

Convert a regression model with seasonal ARIMA errors to an ARIMAX model using thearimaconverter.

Specify the regression model with A R I M A ( 2 , 1 , 1 ) × ( 1 , 1 , 0 ) 2 errors:

y t = X t [ - 2 1 ] + u t ( 1 - 0 3 L + 0 1 5 L 2 ) ( 1 - L ) ( 1 - 0 2 L 2 ) ( 1 - L 2 ) u t = ( 1 + 0 1 L ) ε t ,

where ε t is Gaussian with mean 0 and variance 1.

Mdl = regARIMA('AR',{0.3, -0.15},'MA',0.1,。..'ARLags',[1 2],'SAR',0.2,'SARLags',2,。..'Intercept',0,'Beta',[-2; 1],'Variance',1,'D',1,。..'Seasonality',2)
Mdl = regARIMA属性:描述:“Regression with ARIMA(2,1,1) Error Model Seasonally Integrated with Seasonal AR(2) (Gaussian Distribution)" Distribution: Name = "Gaussian" Intercept: 0 Beta: [-2 1] P: 7 D: 1 Q: 1 AR: {0.3 -0.15} at lags [1 2] SAR: {0.2} at lag [2] MA: {0.1} at lag [1] SMA: {} Seasonality: 2 Variance: 1

Generate predictor data.

rng(1);% For reproducibilityT = 20; X = randn(T,2);

ConvertMdlto an ARIMAX model.

[ARIMAX,XNew] = arima(Mdl,'X',X); ARIMAX
ARIMAX = arima with properties: Description: "ARIMAX(2,1,1) Model Seasonally Integrated with Seasonal AR(2) (Gaussian Distribution)" Distribution: Name = "Gaussian" P: 7 D: 1 Q: 1 Constant: 0 AR: {0.3 -0.15} at lags [1 2] SAR: {0.2} at lag [2] MA: {0.1} at lag [1] SMA: {} Seasonality: 2 Beta: [1 -1.3 -0.75 1.41 -0.34 -0.08 0.09 -0.03] Variance: 1

Mdl.Betahas length 2, butARIMAX.Betahas length 8. This is because the product of the autoregressive and integration polynomials, ϕ ( L ) ( 1 - L ) Φ ( L ) ( 1 - L s ) , is

1 - 1 3 L - 0 7 5 L 2 + 1 4 1 L 3 - 0 3 4 L 4 - 0 0 8 L 5 + 0 0 9 L 6 - 0 0 3 L 7

You can see that when you add seasonality, seasonal lag terms, and integration to a model, the size ofXNewcan grow quite large. A conversion such as this might not be ideal for analyses involving small sample sizes.

Algorithms

LetXdenote the matrix of concatenated predictor data vectors (or design matrix) andβdenote the regression component for the regression model with ARIMA errors,Mdl

  • If you specifyX, thenarimareturnsXNewin a certain format. Suppose that the nonzero autoregressive lag term degrees ofMdlare 0 <a1<a2< ...<P, which is the largest lag term degree. The software obtains these lag term degrees by expanding and reducing the product of the seasonal and nonseasonal autoregressive lag polynomials, and the seasonal and nonseasonal integration lag polynomials

    ϕ ( L ) ( 1 L ) D Φ ( L ) ( 1 L s )

    • The first column ofXNewis

    • The second column ofXNewis a sequence ofa1NaNs, and then the product X a 1 β , where X a 1 β = L a 1 X β

    • Thejth column ofXNewis a sequence ofajNaNs, and then the product X a j β , where X a j β = L a j X β

    • The last column ofXNewis a sequence ofapNaNs, and then the product X p β , where X p β = L p X β

    Suppose thatMdlis a regression model with ARIMA(3,1,0) errors, andϕ1= 0.2 andϕ3= 0.05. Then the product of the autoregressive and integration lag polynomials is

    ( 1 0.2 L 0.05 L 3 ) ( 1 L ) = 1 1.2 L + 0.02 L 2 0.05 L 3 + 0.05 L 4

    This implies thatARIMAX.Betais[1 -1.2 0.02 -0.05 0.05]andXNewis

    [ x 1 β N a N N a N N a N N a N x 2 β x 1 β N a N N a N N a N x 3 β x 2 β x 1 β N a N N a N x 4 β x 3 β x 2 β x 1 β N a N x 5 β x 4 β x 3 β x 2 β x 1 β x T β x T 1 β x T 2 β x T 3 β x T 4 β ] ,

    wherexjis thejth row ofX

  • If you do not specifyX, thenarimareturnsXNewas an empty matrix without rows and one plus the number of nonzero autoregressive coefficients in the difference equation ofMdlcolumns.