RJT1990 / pyflux

Open source time series library for Python
BSD 3-Clause "New" or "Revised" License
2.1k stars 240 forks source link

AR(1) with MLE in ARIMAX does not match exogenous coefficients from OLS estimation #150

Open argku opened 4 years ago

argku commented 4 years ago

I estimated a simple AR(1) model with exogenous variables and the constant. Its coefficients are close to the same model estimated with OLS, but they're not the same.

For instance, the constant is 10.5471 while it has to be 10.5488. The model is: 'y ~ 1 + x1 + x2 ...'.

When I estimate it with OLS, I add one more variable 'yL1' which is lagged dependent variable. Then I run OLS from statsmodels. The dataset has one less observation, of course. The code is:

model = pf.ARIMAX(data=data, formula=formula,
                  ar=1, ma=0, family=pf.Normal())

I tried changing 'gtol' and 'ftol', or switching to 'M-H'. This either didn't help or made things worse. I know that in MATLAB if you decrease tolerance the coefficients of this model with the same data converge to OLS estimates.

Any thoughts?