Documentation

This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

armairf

Generate ARMA model impulse responses

Syntax

``armairf(ar0,ma0)``
``armairf(ar0,ma0,Name,Value)``
``Y = armairf(ar0,ma0)``
``Y = armairf(ar0,ma0,Name,Value)``

Description

example

````armairf(ar0,ma0)` returns a tiered plot of the impulse response function, or dynamic response of the system, that results from applying a one standard deviation shock to each of the `numVars` time series variables composing an ARMA(p,q) model. The autoregressive and moving average coefficients of the ARMA(p,q) model are `ar0` and `ma0`, respectively.The `armairf` function Accepts: Vectors or cell vectors of matrices in difference-equation notation. `LagOp` lag operator polynomials corresponding to the AR and MA polynomials in lag operator notation. Accommodates time series models that are univariate or multivariate, stationary or integrated, structural or in reduced form, and invertible or noninvertible.Assumes that the model constant c is 0. ```

example

````armairf(ar0,ma0,Name,Value)` returns a tiered plot of the impulse response function with additional options specified by one or more `Name,Value` pair arguments. For example, you can specify the number of periods to plot the impulse response function or the computation method to use.```

example

````Y = armairf(ar0,ma0)` returns the impulse responses (`Y`) that result from applying a one standard deviation shock to each of the `numVars` time series variables in an ARMA(p,q) model. The autoregressive coefficients `ar0` and the moving average coefficients `ma0` compose the ARMA model.```

example

````Y = armairf(ar0,ma0,Name,Value)` returns the impulse responses with additional options specified by one or more `Name,Value` pair arguments.```

Examples

collapse all

Plot the entire impulse response function of the univariate ARMA(2,1) model

Create vectors for the autoregressive and moving average coefficients as you encounter them in the model expressed in difference-equation notation.

```AR0 = [0.3 -0.1]; MA0 = 0.05;```

Plot the orthogonalized impulse response function of .

```figure; armairf(AR0,MA0);```

Because is univariate, you see one impulse response function in the plot. The impulse response dies after four periods.

Alternatively, create an ARMA model that represents . Specify that the variance of the innovations is 1, and that there is no model constant.

`Mdl = arima('AR',AR0,'MA',MA0,'Variance',1,'Constant',0);`

`Mdl` is an `arima` model object.

Plot the impulse response function using `Mdl`.

`impulse(Mdl);`

`impulse` uses a stem plot, whereas `armairf` uses a line plot. However, the impulse response functions between the two implementations are equivalent.

Plot the entire impulse response function of the univariate ARMA(2,1) model

Because the model is in lag operator form, create the polynomials using the coefficients as you encounter them in the model.

`AR0Lag = LagOp([1 -0.3 0.1])`
```AR0Lag = 1-D Lag Operator Polynomial: ----------------------------- Coefficients: [1 -0.3 0.1] Lags: [0 1 2] Degree: 2 Dimension: 1 ```
`MA0Lag = LagOp([1 0.05])`
```MA0Lag = 1-D Lag Operator Polynomial: ----------------------------- Coefficients: [1 0.05] Lags: [0 1] Degree: 1 Dimension: 1 ```

`AR0Lag` and `MA0Lag` are `LagOp` lag operator polynomials representing the autoregressive and moving average lag operator polynomials, respectively.

Plot the generalized impulse response function by passing in the lag operator polynomials.

```figure; armairf(AR0Lag,MA0Lag,'Method','generalized');```

The impulse response function is equivalent to the impulse response function in Plot Orthogonalized Impulse Response Function of Univariate ARMA Model.

Plot the entire impulse response function of the structural VARMA(8,4) model

where and .

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 in lag operator notation, start with the coefficient of and enter the rest in order by lag. 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 in lag operator notation, start with the coefficient of 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];```

Construct separate lag operator polynomials that describe the VAR and VMA components of the VARMA model.

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

Plot the impulse response function of the VARMA model.

```figure; armairf(VARLag,VMALag,'Method','generalized');```

The figure contains three subplots. The top plot contains the impulse responses of all variables resulting from an innovation shock to . The second plot from the top contains the impulse responses of all variables resulting from an innovation shock to , and so on. Because the impulse responses die out after a finite number of periods, the VARMA model is stable.

Compute the entire, orthogonalized impulse response function of the univariate ARMA(2,1) model

Create vectors for the autoregressive and moving average coefficients as you encounter them in the model, which is expressed in difference-equation notation.

```AR0 = [0.3 -0.1]; MA0 = 0.05;```

Plot the orthogonalized impulse response function of .

`y = armairf(AR0,MA0)`
```y = 1.0000 0.3500 0.0050 -0.0335 -0.0105 ```

`y` is a 5-by-1 vector of impulse responses. `y(1)` is the impulse response for time , `y(2)` is the impulse response for time , and so on. The impulse response function dies out after period .

Alternatively, create an ARMA model that represents . Specify that the variance of the innovations is 1, and that there is no model constant.

`Mdl = arima('AR',AR0,'MA',MA0,'Variance',1,'Constant',0);`

`Mdl` is an `arima` model object.

Plot the impulse response function using `Mdl`.

`y = impulse(Mdl)`
```y = 1.0000 0.3500 0.0050 -0.0335 -0.0105 ```

The impulse response functions between the two implementations are equivalent.

Compute the generalized impulse response function of the two-dimensional VAR(3) model

In the equation, , , and, for all t, is Gaussian with mean zero and covariance matrix

Create a cell vector of matrices for the autoregressive coefficients as you encounter them in the model expressed in difference-equation notation. Specify the innovation covariance matrix.

```AR1 = [1 -0.2; -0.1 0.3]; AR2 = -[0.75 -0.1; -0.05 0.15]; AR3 = [0.55 -0.02; -0.01 0.03]; ar0 = {AR1 AR2 AR3}; InnovCov = [0.5 -0.1; -0.1 0.25];```

Compute the entire, generalized impulse response function of . Because no MA terms exist, specify an empty array (`[]`) for the second input argument.

```Y = armairf(ar0,[],'Method','generalized','InnovCov',InnovCov); size(Y)```
```ans = 31 2 2 ```

`Y` is a 31-by-2-2 array of impulse responses. Rows correspond to periods, columns correspond to variables, and pages correspond to the variable that `armairf` shocks. `armairf` satisfies the stopping criterion after 31 periods. You can specify to stop sooner using the `'NumObs'` name-value pair argument. This practice is beneficial when the system has many variables.

Compute and display the generalized impulse responses for the first 10 periods.

```Y20 = armairf(ar0,[],'Method','generalized','InnovCov',InnovCov,... 'NumObs',10)```
```Y20 = Y20(:,:,1) = 0.7071 -0.1414 0.7354 -0.1131 0.2135 -0.0509 0.0526 0.0058 0.2929 0.0040 0.3717 -0.0300 0.1872 -0.0325 0.0730 -0.0082 0.1360 -0.0001 0.1841 -0.0116 Y20(:,:,2) = -0.2000 0.5000 -0.3000 0.1700 -0.1340 -0.0040 -0.0112 -0.0113 -0.0772 -0.0003 -0.1435 0.0100 -0.0936 0.0133 -0.0301 0.0054 -0.0388 -0.0003 -0.0674 0.0028 ```

The impulse responses appear to die out with increasing time, suggesting a stable system.

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 (in other words, 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. In other words, `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 an `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. In other words, `ar0{j}` is the coefficient matrix of vector 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.

• `armairf` composes the model using lag operator notation. In other words, 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 ${y}_{t}=0.5{y}_{t-1}-0.8{y}_{t-2}+{\epsilon }_{t}-0.6{\epsilon }_{t-1}+0.08{\epsilon }_{t-2}$. The model is in difference-equation form. To compute the impulse responses, enter the following into the command window.

`y = armairf([0.5 -0.8], [-0.6 0.08]);`

The ARMA model written in lag-operator notation is $\left(1-0.5L+0.8{L}^{2}\right){y}_{t}=\left(1-0.6L+0.08{L}^{2}\right){\epsilon }_{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}); y = armairf(ar0, ma0);```

If the ARMA model is strictly an MA model, then specify an empty array or cell (`[]` or `{}`).

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 (in other words, 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. In other words, `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 an `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. In other words, `ma0{j}` is the coefficient matrix of yt-j.

• Row k of an MA coefficient matrix contains the MA coefficients in the equation of the variable yk. Subsequently, column k must correspond to variable yk, and the 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 ε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.

If the ARMA model is strictly an AR model, then specify an empty array or cell (`[]` or `{}`).

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`.

Example: `'Method','generalized','NumObs',10` specifies to compute generalized impulse responses for 10 periods.

collapse all

Covariance matrix of the ARMA(p,q) model innovations εt, specified as the comma-separated pair consisting of `'InnovCov'` and a numeric scalar or an `numVars`-by-`numVars` numeric matrix. `InnovCov` must be a positive scalar or a positive definite matrix.

The default value is `eye(numVars)`, where `numVars` is the number of variables in the time series.

Example: `'InnovCov',0.2`

Data Types: `double`

Number of periods in the impulse response function to return, specified as the comma-separated pair consisting of `'NumObs'` and a positive integer. `NumObs` specifies the number of rows in the output argument `Y`.

By default, `armairf` determines `NumObs` by the stopping criteria of `mldivide`.

Example: `'NumObs',10`

Data Types: `double`

Impulse response function computation method, specified as the comma-separated pair consisting of `'Method'` and a value in this table.

ValueDescription
`'generalized'`Compute impulse responses using one standard deviation innovation shocks.
`'orthogonalized'`Compute impulse responses using orthogonalized, one standard deviation innovation shocks. `armairf` uses the Cholesky factorization of `InnovCov` for orthogonalization.

Example: `'Method','generalized'`

Data Types: `char` | `string`

Output Arguments

collapse all

Impulse responses, returned as a numeric column vector or array.

If `Y` is a vector, then `Y(t)` is the impulse response at period t, where t = 0,1,...,`NumObs`.

Otherwise, `Y(t,j,k)` is the period-t impulse response of variable j shocked by a one standard impulse originating in variable k. t = 0,1,...,`NumObs`, j = 1,2,...,`numVars`, and k = 1,2,...,`numVars`. The variable order in `Y` corresponds to the variable order in `ar0` and `ma0`.

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

`${\Phi }_{0}{y}_{t}=c+{\Phi }_{1}{y}_{t-1}+...+{\Phi }_{p}{y}_{t-p}+{\Theta }_{0}{\epsilon }_{t}+{\Theta }_{1}{\epsilon }_{t-1}+...+{\Theta }_{q}{\epsilon }_{t-q},$`
where

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

• εt is an `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.

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

Impulse Response Function

An impulse response function of a time series model measures the changes in the future responses of all variables in the system when a variable is shocked by an impulse.

Suppose yt is the ARMA(p,q) model containing `numVars` response variables

`$\Phi \left(L\right){y}_{t}=\Theta \left(L\right){\epsilon }_{t}.$`

• Φ(L) is the lag operator polynomial of the autoregressive coefficients, in other words, $\Phi \left(L\right)={\Phi }_{0}-{\Phi }_{1}L-{\Phi }_{2}{L}^{2}-...-{\Phi }_{p}{L}^{p}.$

• Θ(L) is the lag operator polynomial of the moving average coefficients, in other words, $\Theta \left(L\right)={\Theta }_{0}+{\Theta }_{1}L+{\Theta }_{2}{L}^{2}+...+{\Theta }_{q}{L}^{q}.$

• εt is the vector of `numVars` innovations at time t. Assume that the innovations have zero mean and the constant, positive-definite covariance matrix Σ for all t.

The infinite-lag MA representation of yt is

`${y}_{t}={\Phi }^{-1}\left(L\right)\Theta \left(L\right){\epsilon }_{t}=\Omega \left(L\right){\epsilon }_{t}.$`
Then, the general form of the impulse response function of yt shocked by an impulse to variable j by one standard deviation of its innovation m periods into the future is

`${\psi }_{j}\left(m\right)={C}_{m}{e}_{j}.$`
• ej is a selection vector of length `numVars` containing a one in element j and zeros elsewhere.

• For orthogonalized impulse responses, ${C}_{m}={\Omega }_{m}P,$ where P is the lower triangular factor in the Cholesky factorization of Σ.

• For generalized impulse responses, ${C}_{m}={\sigma }_{j}^{-1}{\Omega }_{m}\Sigma ,$ where σj is the standard deviation of innovation j.

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

`$\Phi \left(L\right){y}_{t}=c+\Theta \left(L\right){\epsilon }_{t},$`
where

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

• $\Phi \left(L\right)={\Phi }_{0}-{\Phi }_{1}L-{\Phi }_{2}{L}^{2}-...-{\Phi }_{p}{L}^{p}$, which is the autoregressive, lag operator polynomial.

• L is the back-shift operator, in other words, ${L}^{j}{y}_{t}={y}_{t-j}$.

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

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

• $\Theta \left(L\right)={\Theta }_{0}+{\Theta }_{1}L+{\Theta }_{2}{L}^{2}+...+{\Theta }_{q}{L}^{q}$, 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.

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

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.

Algorithms

• If `Method` is `'orthogonalized'`, then the resulting impulse response function depends on the order of the variables in the time series model. If `Method` is `'generalized'`, then the resulting impulse response function is invariant to the order of the variables. Therefore, the two methods generally produce different results.

• If `InnovCov` is a diagonal matrix, then the resulting generalized and orthogonal impulse response functions are identical. Otherwise, the resulting generalized and orthogonal impulse response functions are identical when the first variable shocks all variables only (in other words, `Y(:,:,1)`).

References

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

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

[3] Pesaran, H. H. and Y. Shin. “Generalized Impulse Response Analysis in Linear Multivariate Models.” Economic Letters. Vol. 58, 1998, 17–29.