statsmodels.sandbox.tsa.fftarma.ArmaFft.impulse_response

ArmaFft.impulse_response(leads=None)

计算ARMA过程的脉冲响应函数(MA表示)。

Parameters:
leadsint

要计算的观测值数量。

Returns:
ndarray

具有nobs个元素的脉冲响应函数。

注释

这与找到ARMA(p,q)的MA表示是相同的。通过在函数参数中反转ar和ma的角色,返回的结果是ARMA(p,q)的AR表示,即

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

完全测试针对matlab

示例

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])

这和

>>> 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])

Last update: Oct 16, 2024