[Python] `AutoReg`'s model roots almost match learned parmaeters but do not match parameters...

Discussão em 'Python' iniciado por Stack, Julho 4, 2025.

  1. Stack

    Stack Membro Participativo

    Minimal working example

    from statsmodels.tsa.arima_process import ArmaProcess
    from statsmodels.tsa.ar_model import AutoReg

    import numpy as np

    roots= 1/np.array([0.1, 0.5, -0.3, 0.9, 0.18, 0.1+0.3j, 0.1-0.3j, -0.5+0.1j, -0.5-0.1j,-0.8])
    proc = ArmaProcess.from_roots([],roots)
    y = proc.generate_sample(150)

    model = AutoReg(y,10).fit()

    print(np.poly(model.roots))
    print(np.flip(model.params)/model.params[-1])
    print(np.poly(roots)/np.poly(roots)[0])


    2 things I find odd here: The very last coefficient returned from np.poly(model.roots) does not match the very last coefficient of np.flip(model.params)/model.params[-1]

    And worst of all, the fitted AutoReg model's coefficients are nowhere near the actual coefficients...

    Any idea what's going on?

    Continue reading...

Compartilhe esta Página