简体   繁体   中英

Stationarity issue when fitting an ARMA() model to a supposedly stationary time series

When trying to fit an ARMA(1,2) with statsmodels to the log-returns of a time series of stock data I get an error "The computed initial AR coefficients are not stationary"

The time series I try ton analyze is itself stationary I think and is very similar to white noise. When I apply the augmented Dickey Fuller test the p-value is around e-14. I thought I couldalways fit an ARMA model to a stationary time series. Indeed I can fit some models like ARMA(2,1), ARMA(1,1) without a problem. For some combinations of ARMA(p,q), however, I get a warning that the Hessian matrix cannot be inverted and some of the output gives 'nan'. For the specific model of ARMA(1,2), estimation fails entirely.

Why is it that some models cannot be fit to the data? Any help is much appreciated! I am also happy to provide more information / plots / whatever is needed.

In similar questions on stackoverflow the issue usually seemed to be that the original time series is not stationary. In this particular question ( Running Arima in python after using ADFfuller giving me error ) OP seems to have the same problem as me but unfortunately did not get an answer.

Reproducible example:

import yfinance as yf
import numpy as np
import statsmodels.tsa.api as smt

def get_daily_historic_data_yahoo(ticker,
                                  start_date='2012-1-1',
                                  end_date='2017-12-31'):
    daily_data = yf.download(ticker, start_date, end_date)
    return daily_data

stocks_df = get_daily_historic_data_yahoo('V')

log_returns = np.log(stocks_df['Adj Close'] / stocks_df['Adj Close'].shift(1))[1:]

model = smt.ARMA(log_returns, (1,2))
model_fit = model.fit()
print(model_fit.summary())

My guess is that the Hessian Matrix is likely required to compute standard errors. So you might try to bootstrap the se to bypass this computational error.

I don't use python, so I cannot test your code, unfortunately.

In any case, check your phi and psi estimates that they are in |.| < 1 to fulfill the stationary and invertible condition. See page 7-8. https://math.unice.fr/~frapetti/CorsoP/chapitre_23_IMEA_1.pdf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM