statsmodels.tsa.arima_process.arma_impulse_response

statsmodels.tsa.arima_process.arma_impulse_response(ar, ma, leads=100)[source]

Compute the impulse response function (MA representation) for ARMA process.

Parameters:
ararray_like, 1d

The auto regressive lag polynomial.

maarray_like, 1d

The moving average lag polynomial.

leadsint

The number of observations to calculate.

Returns:
ndarray

The impulse response function with nobs elements.

Notes

This is the same as finding the MA representation of an ARMA(p,q). By reversing the role of ar and ma in the function arguments, the returned result is the AR representation of an ARMA(p,q), i.e

ma_representation = arma_impulse_response(ar, ma, leads=100) ar_representation = arma_impulse_response(ma, ar, leads=100)

Fully tested against matlab

Examples

AR(1)

>>> arma_impulse_response([1.0, -0.8], [1.], leads=10)
array([ 1.        ,  0.8       ,  0.64      ,  0.512     ,  0.4096    ,
        0.32768   ,  0.262144  ,  0.2097152 ,  0.16777216,  0.13421773])

this is the same as

>>> 0.8**np.arange(10)
array([ 1.        ,  0.8       ,  0.64      ,  0.512     ,  0.4096    ,
        0.32768   ,  0.262144  ,  0.2097152 ,  0.16777216,  0.13421773])

MA(2)

>>> arma_impulse_response([1.0], [1., 0.5, 0.2], leads=10)
array([ 1. ,  0.5,  0.2,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ])

ARMA(1,2)

>>> arma_impulse_response([1.0, -0.8], [1., 0.5, 0.2], leads=10)
array([ 1.        ,  1.3       ,  1.24      ,  0.992     ,  0.7936    ,
        0.63488   ,  0.507904  ,  0.4063232 ,  0.32505856,  0.26004685])