Main Content

arima

Convert regression model with ARIMA errors to ARIMAX model

Description

The arima object function converts a specified regression model with ARIMA errors (regARIMA model object) to the equivalent ARIMAX model (arima model object). To create an ARIMAX model directly, see the arima function.

example

ARIMAXMdl = arima(Mdl) returns the fully specified arima model object ARIMAXMdl, which is the ARIMAX model representation of the input regression model with ARIMA time series errors Mdl, a fully specified regARIMA model object.

example

[ARIMAXMdl,XNew] = arima(Mdl,X=X) specifies predictor data X for the regression component of the input regression model with ARIMA errors, and returns the transformed predictor data XNew for the output ARIMAX model.

Examples

collapse all

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

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

yt=1+0.5Xt+utut=0.8ut-1-0.4ut-4+εt+0.3εt-1,

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

Mdl = regARIMA(AR={0.8 -0.4},ARLags=[1 4],MA=0.3, ...
    Intercept=1,Beta=0.5,Variance=1)
Mdl = 
  regARIMA with properties:

     Description: "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 are 1 and 4 in the AR row.

Generate random predictor data.

rng(1); % For reproducibility
T = 20;
Pred = randn(T,1);

Convert Mdl to an ARIMAX model. Supply the random set of predictor data Pred for Mdl and return the predictor data for the converted model.

[ARIMAXMdl,XNew] = arima(Mdl,X=Pred);
ARIMAXMdl
ARIMAXMdl = 
  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 output arima model ARIMAXMdl is

yt=0.6+ZtΓ+0.8yt-1-0.4yt-4+εt+0.3εt-1,

where

ZtΓ=[0.5x1NaNNaN0.5x20.5x1NaN0.5x30.5x2NaN0.5x40.5x3NaN0.5x50.5x40.5x10.5T0.5xT-10.5xT-4][1-0.80.4]

and xj is row j of Pred. Because the product of the autoregressive and integration polynomials is ϕ(L)=(1-0.8L+0.4L4), ARIMAX.Beta is [1; -0.8; 0.4]. Note that the software carries over the autoregressive and moving average coefficients from Mdl to ARIMAX. Also, Mdl.Intercept = 1 and ARIMAX.Constant = (1 - 0.8 + 0.4)(1) = 0.6, i.e., the regARIMA model intercept and arima model constant are generally unequal.

Convert a regression model with seasonal ARIMA errors to an ARIMAX model using the arima converter.

Specify the regression model with ARIMA(2,1,1)×(1,1,0)2 errors:

yt=Xt[-21]+ut(1-0.3L+0.15L2)(1-L)(1-0.2L2)(1-L2)ut=(1+0.1L)ε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,Seasonality=2,D=1, ...
    Intercept=0,Beta=[-2; 1],Variance=1)
Mdl = 
  regARIMA with properties:

     Description: "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 reproducibility
T = 20;
Pred = randn(T,2);

Convert Mdl to an ARIMAX model. Supply the random set of predictor data Pred for Mdl and return the predictor data for the converted model.

[ARIMAX,XNew] = arima(Mdl,X=Pred);
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.Beta has length 2, but ARIMAX.Beta has length 8. This is because the product of the autoregressive and integration polynomials, ϕ(L)(1-L)Φ(L)(1-Ls), is

1-1.3L-0.75L2+1.41L3-0.34L4-0.08L5+0.09L6-0.03L7.

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

Input Arguments

collapse all

Fully specified regression model with ARIMA time series errors, specified as a regARIMA model object created by regARIMA or estimate.

Predictor data for the regression component of the input regression model with ARIMA time series errors Mdl, specified as a T-by-k1 numeric matrix, where k1 is numel(Mdl.Beta).

The last row of X contains the latest observation of each series.

Each column of X is a separate time series.

Data Types: double

Output Arguments

collapse all

ARIMAX model equivalent to the input regression model with ARIMA time series errors Mdl, returned as a fully specified model object of type arima.

Converted predictor data matrix for the regression component of the output ARIMAX model ARIMAXMdl, returned as a T-by-k2 numeric matrix, where k2 is one plus the number of nonzero autoregressive coefficients in the difference equation of Mdl. To return XNew, you must supply X.

The last row of XNew contains the latest observation of each series.

Each column of XNew is a separate time series.

Data Types: double

Algorithms

Let X denote 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 specify X, arima returns XNew in a certain format. Suppose that the nonzero autoregressive lag term degrees of Mdl are 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)(1L)DΦ(L)(1Ls).

    • The first column of XNew is .

    • The second column of XNew is a sequence of a1 NaNs, and then the product Xa1β, where Xa1β=La1Xβ.

    • Column j of XNew is a sequence of aj NaNs, and then the product Xajβ, where Xajβ=LajXβ.

    • The last column of XNew is a sequence of ap NaNs, and then the product Xpβ, where Xpβ=LpXβ.

    Suppose that Mdl is 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

    (10.2L0.05L3)(1L)=11.2L+0.02L20.05L3+0.05L4.

    This implies that ARIMAXMdl.Beta is [1 -1.2 0.02 -0.05 0.05] and XNew is

    [x1βNaNNaNNaNNaNx2βx1βNaNNaNNaNx3βx2βx1βNaNNaNx4βx3βx2βx1βNaNx5βx4βx3βx2βx1βxTβxT1βxT2βxT3βxT4β],

    where xj is row j of X.

  • If you do not specify X, arima returns XNew as an empty matrix without rows and one plus the number of nonzero autoregressive coefficients in the difference equation of Mdl columns.

Version History

Introduced in R2013b