7.8.4.8. statsmodels.tsa.arima_process.arma_impulse_response

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

get the impulse response function (MA representation) for ARMA process

Parameters:

ma : array_like, 1d

moving average lag polynomial

ar : array_like, 1d

auto regressive lag polynomial

nobs : int

number of observations to calculate

Returns:

ir : array, 1d

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, nobs=100) ar_representation = arma_impulse_response(ma, ar, nobs=100)

fully tested against matlab

Examples

AR(1)

>>> arma_impulse_response([1.0, -0.8], [1.], nobs=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], nobs=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], nobs=10)
array([ 1.        ,  1.3       ,  1.24      ,  0.992     ,  0.7936    ,
        0.63488   ,  0.507904  ,  0.4063232 ,  0.32505856,  0.26004685])