arima

Class: regARIMA

Convert regression model with ARIMA errors to ARIMAX model

Syntax

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

Description

ARIMAX = arima(Mdl) converts the univariate regression model with ARIMA time series errors Mdl to a model of type arima including 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 more Name,Value pair arguments.

Input Arguments

Mdl

Regression model with ARIMA time series errors, as created by regARIMA or estimate.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'X'

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

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

Each column of X is a separate time series.

Output Arguments

ARIMAX

ARIMAX model equivalent to the regression model with ARIMA errors Mdl, returned as a model of type arima.

XNew

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

XNew has the same number of rows as X. The last row of XNew contains the latest observation of each series.

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

Examples

expand all

Convert a Regression Model with ARMA Errors to an ARIMAX Model

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:

$$\begin{array}{l}
{y_t} = 1 + 0.5{X_t} + {u_t}\\
{u_t} = 0.8{u_{t - 1}} - 0.4{u_{t - 4}} + {\varepsilon _t} + 0.3{\varepsilon _{t - 1}},
\end{array}$$

where $\varepsilon_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 = 

    Regression with ARIMA(4,0,1) Error Model:
    ------------------------------------------
    Distribution: Name = 'Gaussian'
       Intercept: 1
            Beta: [0.5]
               P: 4
               D: 0
               Q: 1
              AR: {0.8 -0.4} at Lags [1 4]
             SAR: {}
              MA: {0.3} at Lags [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;
X = randn(T,1);

Convert Mdl to an ARIMAX model.

[ARIMAX,XNew] = arima(Mdl,'X',X);
ARIMAX
ARIMAX = 

    ARIMAX(4,0,1) Model:
    ---------------------
    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 Lags [1]
             SMA: {}
            Beta: [1 -0.8 0.4]
        Variance: 1

The new arima model, ARIMAX, is

$${y_t} = 0.6 + {Z_t}\Gamma  + 0.8{y_{t - 1}} - 0.4{y_{t - 4}} + {\varepsilon _t} + 0.3{\varepsilon _{t - 1}},$$

where

$${Z_t}\Gamma  = \left[ {\begin{array}{*{20}{c}}
{0.5{x_1}}&{NaN}&{NaN}\\
{0.5{x_2}}&{0.5{x_1}}&{NaN}\\
{0.5{x_3}}&{0.5{x_2}}&{NaN}\\
{0.5{x_4}}&{0.5{x_3}}&{NaN}\\
{0.5{x_5}}&{0.5{x_4}}&{0.5{x_1}}\\
 \vdots & \vdots & \vdots \\
{{{0.5}_T}}&{0.5{x_{T - 1}}}&{0.5{x_{T - 4}}}
\end{array}} \right]\left[ \begin{array}{c}
1\\
 - 0.8\\
0.4
\end{array} \right]$$

and $x_{j}$ is row j of X. Since the product of the autoregressive and integration polynomials is $\phi (L) = (1 - 0.8L + 0.4{L^4}),$ ARIMAX.Beta is simply [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 ARIMA Errors to an ARIMAX Model

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

Specify the regression model with $\rm{ARIMA(2,1,1)}\times\rm{(1,1,0)}_2$ errors:

$$\begin{array}{c}
{y_t} = {X_t}\left[ \begin{array}{c}
 - 2\\
1
\end{array} \right] + {u_t}\\
(1 - 0.3L + 0.15{L^2})(1 - L)(1 - 0.2{L^2})(1 - {L^2}){u_t} = (1 + 0.1L){\varepsilon _t},
\end{array}$$

where $\varepsilon_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 = 

    Regression with ARIMA(2,1,1) Error Model Seasonally Integrated with Seasonal AR(2):
    -------------------------------------------------------------------------------------
    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 Lags [2]
              MA: {0.1} at Lags [1]
             SMA: {}
     Seasonality: 2
        Variance: 1

Generate predictor data.

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

Convert Mdl to an ARIMAX model.

[ARIMAX,XNew] = arima(Mdl,'X',X);
ARIMAX
ARIMAX = 

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

Mdl.Beta has length 2, but ARIMAX.Beta has length 8. This is because the product of the autoregressive and integration polynomials, $\phi (L)(1 - L)\Phi (L)(1 - {L^s})$, is

$$1 - 1.3L - 0.75{L^2} + 1.41{L^3} - 0.34{L^4} - 0.08{L^5} + 0.09{L^6} - 0.03{L^7}.$$

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.

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, then 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β.

    • The jth column 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 ARIMAX.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 the jth row of X.

  • If you do not specify X, then 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.

Was this topic helpful?