Main Content

arma2ar

Convert ARMA model to AR model

Description

ar = arma2ar(ar0,ma0) returns the coefficients of the truncated, infinite-order AR model approximation to an ARMA model with input AR and MA coefficients.

arma2ar:

  • Accepts:

  • Accommodates time series models that are univariate or multivariate (i.e., numVars variables compose the model), stationary or integrated, structural or in reduced form, and invertible.

  • Assumes that the model constant c is 0.

example

ar = arma2ar(ar0,ma0,numLags) returns the first nonzero numLags lag-term coefficients of the infinite-order AR model approximation of an ARMA model having the input AR and MA coefficients.

example

Examples

collapse all

Find the lag coefficients of the truncated, AR approximation of this univariate, stationary, and invertible ARMA model

yt=0.2yt-1-0.1yt-2+εt+0.5εt-1.

The ARMA model is in difference-equation notation because the left side contains only yt and its coefficient 1. Create a vector containing the AR lag term coefficients in order starting from t - 1.

ar0 = [0.2 -0.1];

Alternatively, you can create a cell vector of the scalar coefficients.

Create a vector containing the MA lag term coefficient.

ma0 = 0.5;

Convert the ARMA model to an AR model by obtaining the coefficients of the truncated approximation of the infinite-lag polynomial.

ar = arma2ar(ar0,ma0)
ar = 1×7

    0.7000   -0.4500    0.2250   -0.1125    0.0562   -0.0281    0.0141

ar is a numeric vector because ar0 and ma0 are numeric vectors.

The approximate AR model truncated at 7 lags is

yt=0.7yt-1-0.45yt-2+0.225yt-3-0.1125yt-4+0.0562yt-5+...-0.0281yt-6+0.0141yt-7+εt

Find the first five lag coefficients of the AR approximation of this univariate and invertible MA(3) model

yt=εt-0.2εt-1+0.5εt-3.

The MA model is in difference-equation notation because the left side contains only yt and its coefficient of 1. Create a cell vector containing the MA lag term coefficient in order starting from t - 1. Because the second lag term of the MA model is missing, specify a 0 for its coefficient.

ma0 = {-0.2 0 0.5};

Convert the MA model to an AR model with at most five lag coefficients of the truncated approximation of the infinite-lag polynomial. Because there is no AR contribution, specify an empty cell ({}) for the AR coefficients.

numLags = 5;
ar0 = {}; 
ar = arma2ar(ar0,ma0,numLags)
ar=1×5 cell array
    {[-0.2000]}    {[-0.0400]}    {[0.4920]}    {[0.1984]}    {[0.0597]}

ar is a cell vector of scalars because at least one of ar0 and ma0 is a cell vector.

The approximate AR(5) model is

yt=-0.2yt-1-0.04yt-2+0.492yt-3+0.1984yt-4+0.0597yt-5+εt

Find the coefficients of the truncated, structural VAR equivalent of the structural, stationary, and invertible VARMA model

{[10.2-0.10.031-0.150.9-0.251]-[-0.50.20.10.30.1-0.1-0.40.20.05]L4-[-0.050.020.010.10.010.001-0.040.020.005]L8}yt={[100010001]+[-0.020.030.30.0030.0010.010.30.010.01]L4}εt

where yt=[y1ty2ty3t] and εt=[ε1tε2tε3t].

The VARMA model is in lag operator notation because the response and innovation vectors are on opposite sides of the equation.

Create a cell vector containing the VAR matrix coefficients. Because this model is a structural model, start with the coefficient of yt and enter the rest in order by lag. Because the equation is in lag operator notation, include the sign in front of each matrix. Construct a vector that indicates the degree of the lag term for the corresponding coefficients.

var0 = {[1 0.2 -0.1; 0.03 1 -0.15; 0.9 -0.25 1],...
    -[-0.5 0.2 0.1; 0.3 0.1 -0.1; -0.4 0.2 0.05],...
    -[-0.05 0.02 0.01; 0.1 0.01 0.001; -0.04 0.02 0.005]};
var0Lags = [0 4 8];

Create a cell vector containing the VMA matrix coefficients. Because this model is a structural model, start with the coefficient of εt and enter the rest in order by lag. Construct a vector that indicates the degree of the lag term for the corresponding coefficients.

vma0 = {eye(3),...
    [-0.02 0.03 0.3; 0.003 0.001 0.01; 0.3 0.01 0.01]};
vma0Lags = [0 4];

arma2ar requires LagOp lag operator polynomials for input arguments that comprise structural VAR or VMA models. Construct separate LagOp polynomials that describe the VAR and VMA components of the VARMA model.

VARLag = LagOp(var0,'Lags',var0Lags);
VMALag = LagOp(vma0,'Lags',vma0Lags);

VARLags and VMALags are LagOp lag operator polynomials that describe the VAR and VMA components of the VARMA model.

Convert the VARMA model to a VAR model by obtaining the coefficients of the truncated approximation of the infinite-lag polynomial.

VAR = arma2ar(VARLag,VMALag)
VAR = 
    3-D Lag Operator Polynomial:
    -----------------------------
        Coefficients: [Lag-Indexed Cell Array with 4 Non-Zero Coefficients]
                Lags: [0 4 8 12]
              Degree: 12
           Dimension: 3

VAR is a LagOP lag operator polynomial. All coefficients except those corresponding to lags 0, 4, 8, and 12 are 3-by-3 matrices of zeros.

Convert the coefficients to difference-equation notation by reflecting the VAR lag operator polynomial around lag zero.

VARDiffEqn = reflect(VAR);

Display the nonzero coefficients of the resulting VAR models.

lag2Idx = VAR.Lags + 1; % Lags start at 0.  Add 1 to convert to indices.

varCoeff = toCellArray(VAR);
varDiffEqnCoeff = toCellArray(VARDiffEqn);

fprintf    ('          Lag Operator     |   Difference Equation\n')
          Lag Operator     |   Difference Equation
for j = 1:numel(lag2Idx)
    fprintf('_________________________Lag %d_________________________\n',...
        lag2Idx(j) - 1)
    fprintf('%8.3f %8.3f %8.3f | %8.3f %8.3f %8.3f\n',...
        [varCoeff{lag2Idx(j)} varDiffEqnCoeff{lag2Idx(j)}]')
    fprintf('_______________________________________________________\n')
end
_________________________Lag 0_________________________
   1.000    0.200   -0.100 |    1.000    0.200   -0.100
   0.030    1.000   -0.150 |    0.030    1.000   -0.150
   0.900   -0.250    1.000 |    0.900   -0.250    1.000
_______________________________________________________
_________________________Lag 4_________________________
   0.249   -0.151   -0.397 |   -0.249    0.151    0.397
  -0.312   -0.099    0.090 |    0.312    0.099   -0.090
   0.091   -0.268   -0.029 |   -0.091    0.268    0.029
_______________________________________________________
_________________________Lag 8_________________________
   0.037    0.060   -0.012 |   -0.037   -0.060    0.012
  -0.101   -0.007    0.000 |    0.101    0.007   -0.000
  -0.033    0.029    0.114 |    0.033   -0.029   -0.114
_______________________________________________________
_________________________Lag 12_________________________
   0.014   -0.007   -0.034 |   -0.014    0.007    0.034
   0.000   -0.000   -0.001 |   -0.000    0.000    0.001
  -0.010   -0.018    0.002 |    0.010    0.018   -0.002
_______________________________________________________

The coefficients of lags 4, 8, and 12 are opposites between VAR and VARDiffEqn.

Find the lag coefficients and constant of the truncated AR approximation of this univariate, stationary, and invertible ARMA model.

yt=1.5+0.2yt-1-0.1yt-2+εt+0.5εt-1.

The ARMA model is in difference-equation notation because the left side contains only yt and its coefficient of 1. Create separate vectors for the AR and MA lag term coefficients in order starting from t - 1.

ar0 = [0.2 -0.1];
ma0 = 0.5;

Convert the ARMA model to an AR model by obtaining the first five coefficients of the truncated approximation of the infinite-lag polynomial.

numLags = 5;
ar = arma2ar(ar0,ma0,numLags)
ar = 1×5

    0.7000   -0.4500    0.2250   -0.1125    0.0562

To compute the constant of the AR model, consider the ARMA model in lag operator notation.

(1-0.2L+0.1L2)yt=1.5+(1+0.5L)εt

or

Φ(L)yt=1.5+Θ(L)εt

Part of the conversion involves premultiplying both sides of the equation by the inverse of the MA lag operator polynomial, as in this equation.

Θ-1(L)Φ(L)yt=Θ-1(L)1.5+εt

To compute the inverse of MA lag operator polynomial, use the lag operator left-division object function mldivide.

Theta = LagOp([1 0.5]);
ThetaInv = mldivide(Theta,1,'RelTol',1e-5);

ThetaInv is a LagOp lag operator polynomial.

The application of lag operator polynomials to constants results in the product of the constant with the sum of the coefficients. Apply ThetaInv to the ARMA model constant to obtain the AR model constant.

arConstant = 1.5*sum(cell2mat(toCellArray(ThetaInv)))
arConstant = 
1.0000

The approximate AR model is

yt=1+0.7yt-1-0.45yt-2+0.225yt-3-0.1125yt-4+0.0562yt-5+εt.

Input Arguments

collapse all

Autoregressive coefficients of the ARMA(p,q) model, specified as a numeric vector, cell vector of square, numeric matrices, or a LagOp lag operator polynomial object. If ar0 is a vector (numeric or cell), then the coefficient of yt is the identity. To specify a structural AR polynomial (i.e., the coefficient of yt is not the identity), use LagOp lag operator polynomials.

  • For univariate time series models, ar0 is a numeric vector, cell vector of scalars, or a one-dimensional LagOp lag operator polynomial. For vectors, ar0 has length p and the elements correspond to lagged responses composing the AR polynomial in difference-equation notation. That is, ar0(j) or ar0{j} is the coefficient of yt-j.

  • For numVars-dimensional time series models, ar0 is a cell vector of numVars-by-numVars numeric matrices or a numVars-dimensional LagOp lag operator polynomial. For cell vectors:

    • ar0 has length p.

    • ar0 and ma0 must contain numVars-by-numVars matrices.

    • The elements of ar0 correspond to the lagged responses composing the AR polynomial in difference equation notation. That is, ar0{j} is the coefficient matrix of yt-j.

    • Row k of an AR coefficient matrix contains the AR coefficients in the equation of the variable yk. Subsequently, column k must correspond to variable yk, and the column and row order of all autoregressive and moving average coefficients must be consistent.

  • For LagOp lag operator polynomials:

    • The first element of the Coefficients property corresponds to the coefficient of yt (to accommodate structural models). All other elements correspond to the coefficients of the subsequent lags in the Lags property.

    • To construct a univariate model in reduced form, specify 1 for the first coefficient. For numVars-dimensional multivariate models, specify eye(numVars) for the first coefficient.

    • When you work from a model in difference-equation notation, negate the AR coefficients of the lagged responses to construct the lag-operator polynomial equivalent. For example, consider yt=0.5yt10.8yt2+εt0.6εt1+0.08εt2. The model is in difference-equation form. To convert to an AR model, enter the following into the command window.

      ar = arma2ar([0.5 -0.8], [-0.6 0.08]);

      The ARMA model written in lag-operator notation is (10.5L+0.8L2)yt=(10.6L+0.08L2)εt. The AR coefficients of the lagged responses are negated compared to the corresponding coefficients in difference-equation format. In this form, to obtain the same result, enter the following into the command window.

      ar0 = LagOp({1 -0.5 0.8});
      ma0 = LagOp({1 -0.6 0.08});
      ar = arma2ar(ar0, ma0);

It is a best practice for ar0 to constitute a stationary or unit-root stationary (integrated) time series model.

If the ARMA model is strictly an MA model, then specify [] or {} for ar0.

Moving average coefficients of the ARMA(p,q) model, specified as a numeric vector, cell vector of square, numeric matrices, or a LagOp lag operator polynomial object. If ma0 is a vector (numeric or cell), then the coefficient of εt is the identity. To specify a structural MA polynomial (i.e., the coefficient of εt is not the identity), use LagOp lag operator polynomials.

  • For univariate time series models, ma0 is a numeric vector, cell vector of scalars, or a one-dimensional LagOp lag operator polynomial. For vectors, ma0 has length q and the elements correspond to lagged innovations composing the AR polynomial in difference-equation notation. That is, ma0(j) or ma0{j} is the coefficient of εt-j.

  • For numVars-dimensional time series models, ma0 is a cell vector of numeric numVars-by-numVars numeric matrices or a numVars-dimensional LagOp lag operator polynomial. For cell vectors:

    • ma0 has length q.

    • ar0 and ma0 must both contain numVars-by-numVars matrices.

    • The elements of ma0 correspond to the lagged responses composing the AR polynomial in difference equation notation. That is, ma0{j} is the coefficient matrix of yt-j.

  • For LagOp lag operator polynomials:

    • The first element of the Coefficients property corresponds to the coefficient of εt (to accommodate structural models). All other elements correspond to the coefficients of the subsequent lags in the Lags property.

    • To construct a univariate model in reduced form, specify 1 for the first coefficient. For numVars-dimensional multivariate models, specify eye(numVars) for the first coefficient.

It is a best practice for ma0 to constitute an invertible time series model.

Maximum number of lag-term coefficients to return, specified as a positive integer.

If you specify 'numLags', then arma2ar truncates the output polynomial at a maximum of numLags lag terms, and then returns the remaining coefficients. As a result, the output vector has numLags elements or is at most a degree numLags LagOp lag operator polynomial.

By default, arma2ar determines the number of lag coefficients to return by the stopping criteria of mldivide.

Data Types: double

Output Arguments

collapse all

Coefficients of the truncated AR model approximation of the ARMA model, returned as a numeric vector, cell vector of square, numeric matrices, or a LagOp lag operator polynomial object. ar has numLags elements, or is at most a degree numLags LagOp lag operator polynomial.

The data types and orientations of ar0 and ma0 determine the data type and orientation of ar. If ar0 or ma0 are of the same data type or have the same orientation, then ar shares the common data type or orientation. If at least one of ar0 or ma0 is a LagOp lag operator polynomial, then ar is a LagOp lag operator polynomial. Otherwise, if at least one of ar0 or ma0 is a cell vector, then ar is a cell vector. If ar0 and ma0 are cell or numeric vectors and at least one is a row vector, then ar is a row vector.

If ar is a cell or numeric vector, then the order of the elements of ar corresponds to the order of the coefficients of the lagged responses in difference-equation notation starting with the coefficient of yt-1. The resulting AR model is in reduced form.

If ar is a LagOp lag operator polynomial, then the order of the coefficients of ar corresponds to the order of the coefficients of the lagged responses in lag operator notation starting with the coefficient of yt. If Φ0InumVars, then the resulting AR model is structural. To view the coefficients in difference-equation notation, pass ar to reflect.

More About

collapse all

Difference-Equation Notation

A linear time series model written in difference-equation notation positions the present value of the response and its structural coefficient on the left side of the equation. The right side of the equation contains the sum of the lagged responses, present innovation, and lagged innovations with corresponding coefficients.

In other words, a linear time series written in difference-equation notation is

Φ0yt=c+Φ1yt1+...+Φpytp+Θ0εt+Θ1εt1+...+Θqεtq,

where

  • yt is a numVars-dimensional vector representing the responses of numVars variables at time t, for all t and for numVars ≥ 1.

  • εt is a numVars-dimensional vector representing the innovations at time t.

  • Φj is the numVars-by-numVars matrix of AR coefficients of the response yt-j, for j = 0,...,p.

  • Θk is the numVars-by-numVars matrix of MA coefficients of the innovation εt-k., k = 0,...,q.

  • c is the n-dimensional model constant.

  • Φ0 = Θ0 = InumVars, which is the numVars-dimensional identity matrix, for models in reduced form.

Lag Operator Notation

A time series model written in lag operator notation positions a p-degree lag operator polynomial on the present response on the left side of the equation. The right side of the equation contains the model constant and a q-degree lag operator polynomial on the present innovation.

In other words, a linear time series model written in lag operator notation is

Φ(L)yt=c+Θ(L)εt,

where

  • yt is a numVars-dimensional vector representing the responses of numVars variables at time t, for all t and for numVars ≥ 1.

  • Φ(L)=Φ0Φ1LΦ2L2...ΦpLp, which is the autoregressive, lag operator polynomial.

  • L is the back-shift operator, in other words, Ljyt=ytj.

  • Φj is the numVars-by-numVars matrix of AR coefficients of the response yt-j, for j = 0,...,p.

  • εt is a numVars-dimensional vector representing the innovations at time t.

  • Θ(L)=Θ0+Θ1L+Θ2L2+...+ΘqLq, which is the moving average, lag operator polynomial.

  • Θk is the numVars-by-numVars matrix of MA coefficients of the innovation εt-k., k = 0,...,q.

  • c is the numVars-dimensional model constant.

  • Φ0 = Θ0 = InumVars, which is the numVars-dimensional identity matrix, for models in reduced form.

When comparing lag operator notation to difference-equation notation, the signs of the lagged AR coefficients appear negated relative to the corresponding terms in difference-equation notation. The signs of the moving average coefficients are the same and appear on the same side.

For more details on lag operator notation, see Lag Operator Notation.

Tips

  • To accommodate structural ARMA models, specify the input arguments ar0 and ma0 as LagOp lag operator polynomials.

  • To access the cell vector of the lag operator polynomial coefficients of the output argument ar, enter toCellArray(ar).

  • To convert the model coefficients of the output argument from lag operator notation to the model coefficients in difference-equation notation, enter

    arDEN = toCellArray(reflect(ar));
    arDEN is a cell vector containing at most numLags + 1 coefficients corresponding to the lag terms in ar.Lags of the AR model equivalent of the input ARMA model in difference-equation notation. The first element is the coefficient of yt, the second element is the coefficient of yt–1, and so on.

Algorithms

  • The software computes the infinite-lag polynomial of the resulting AR model according to this equation in lag operator notation:

    Θ1(L)Φ(L)yt=εt,

    where Φ(L)=j=0pΦjLj and Θ(L)=k=0qΘkLk.

  • arma2ar approximates the AR model coefficients whether ar0 and ma0 compose a stable polynomial (a polynomial that is stationary or invertible). To check for stability, use isStable.

    isStable requires a LagOp lag operator polynomial as input. For example, if ar0 is a vector, enter the following code to check ar0 for stationarity.

    ar0LagOp = LagOp([1 -ar0]);
    isStable(ar0LagOp)

    A 0 indicates that the polynomial is not stable.

    You can similarly check whether the AR approximation to the ARMA model (ar) is stationary.

References

[1] Box, G. E. P., G. M. Jenkins, and G. C. Reinsel. Time Series Analysis: Forecasting and Control 3rd ed. Englewood Cliffs, NJ: Prentice Hall, 1994.

[2] Hamilton, J. D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.

[3] Lutkepohl, H. New Introduction to Multiple Time Series Analysis. Springer-Verlag, 2007.

Version History

Introduced in R2015a