Esempio n. 1
0
    print(lpol_fiar(0.4, n=20))
    print(lpol_fima(-0.4, n=20))
    print(np.sum((lpol_fima(-0.4, n=n)[1:] + riinv[1:])**2))  #different signs
    print(np.sum((lpol_fiar(0.4, n=n)[1:] - riinv[1:])**2))  #corrected signs

    #test is now in statsmodels.tsa.tests.test_arima_process
    from statsmodels.tsa.tests.test_arima_process import test_fi
    test_fi()

    ar_true = [1, -0.4]
    ma_true = [1, 0.5]

    ar_desired = arma_impulse_response(ma_true, ar_true)
    ar_app, ma_app, res = ar2arma(ar_desired,
                                  2,
                                  1,
                                  n=100,
                                  mse='ar',
                                  start=[0.1])
    print(ar_app, ma_app)
    ar_app, ma_app, res = ar2arma(ar_desired,
                                  2,
                                  2,
                                  n=100,
                                  mse='ar',
                                  start=[-0.1, 0.1])
    print(ar_app, ma_app)
    ar_app, ma_app, res = ar2arma(ar_desired, 2, 3, n=100,
                                  mse='ar')  #, start = [-0.1, 0.1])
    print(ar_app, ma_app)

    slow = 1
Esempio n. 2
0
    '''
    print(lpol_fiar(0.4, n=20))
    print(lpol_fima(-0.4, n=20))
    print(np.sum((lpol_fima(-0.4, n=n)[1:] + riinv[1:])**2)) #different signs
    print(np.sum((lpol_fiar(0.4, n=n)[1:] - riinv[1:])**2)) #corrected signs

    #test is now in statsmodels.tsa.tests.test_arima_process
    from statsmodels.tsa.tests.test_arima_process import test_fi
    test_fi()

    ar_true = [1, -0.4]
    ma_true = [1, 0.5]


    ar_desired = arma_impulse_response(ma_true, ar_true)
    ar_app, ma_app, res = ar2arma(ar_desired, 2,1, n=100, mse='ar', start=[0.1])
    print(ar_app, ma_app)
    ar_app, ma_app, res = ar2arma(ar_desired, 2,2, n=100, mse='ar', start=[-0.1, 0.1])
    print(ar_app, ma_app)
    ar_app, ma_app, res = ar2arma(ar_desired, 2,3, n=100, mse='ar')#, start = [-0.1, 0.1])
    print(ar_app, ma_app)

    slow = 1
    if slow:
        ar_desired = lpol_fiar(0.4, n=100)
        ar_app, ma_app, res = ar2arma(ar_desired, 3, 1, n=100, mse='ar')#, start = [-0.1, 0.1])
        print(ar_app, ma_app)
        ar_app, ma_app, res = ar2arma(ar_desired, 10, 10, n=100, mse='ar')#, start = [-0.1, 0.1])
        print(ar_app, ma_app)