This example shows how to calculate and plot the impulse response function for a moving average (MA) model. The MA(*q*) model is given by

where
is a *q*-degree MA operator polynomial,

The impulse response function for an MA model is the sequence of MA coefficients,

**Step 1. Specify the MA model.**

Specify a zero-mean MA(3) model with coefficients , , and

modelMA = arima('Constant',0,'MA',{0.8,0.5,-0.1});

**Step 2. Plot the impulse response function.**

impulse(modelMA)

For an MA model, the impulse response function cuts off after *q* periods. For this example, the last nonzero coefficient is at lag *q* = 3.

This example shows how to compute and plot the impulse response function for an autoregressive (AR) model. The AR(*p*) model is given by

where is a -degree AR operator polynomial, .

An AR process is stationary provided that the AR operator polynomial is stable, meaning all its roots lie outside the unit circle. In this case, the infinite-degree inverse polynomial, , has absolutely summable coefficients, and the impulse response function decays to zero.

**Step 1. Specify the AR model.**

Specify an AR(2) model with coefficients and .

```
modelAR = arima('AR',{0.5,-0.75});
```

**Step 2. Plot the impulse response function.**

Plot the impulse response function for 30 periods.

impulse(modelAR,30)

The impulse function decays in a sinusoidal pattern.

This example shows how to plot the impulse response function for an autoregressive moving average (ARMA) model. The ARMA(*p*, *q*) model is given by

where
is a *q*-degree MA operator polynomial,
, and
is a *p*-degree AR operator polynomial,
.

An ARMA process is stationary provided that the AR operator polynomial is stable, meaning all its roots lie outside the unit circle. In this case, the infinite-degree inverse polynomial, , has absolutely summable coefficients, and the impulse response function decays to zero.

**Step 1. Specify an ARMA model.**

Specify an ARMA(2,1) model with coefficients = 0.6, , and .

modelARMA = arima('AR',{0.6,-0.3},'MA',0.4);

**Step 2. Plot the impulse response function.**

Plot the impulse response function for 10 periods.

impulse(modelARMA,10)

`arima`

| `cell2mat`

| `impulse`

| `isStable`

| `LagOp`

| `toCellArray`

Was this topic helpful?