Python statsmodels trouble getting fitted model parameters

落爺英雄遲暮 提交于 2019-12-11 05:07:33

问题


I'm using an AR model to fit my data and I think that I have done that successfully, but now I want to actually see what the fitted model parameters are and I am running into some trouble. Here is my code

model=ar.AR(df['price'],freq='M')
ar_res=model.fit(maxlags=50,ic='bic')

which runs without any error. However when I try to print the model parameters with the following code

print ar_res.params

I get the error

AssertionError: Index length did not match values

回答1:


I am unable to reproduce this with current master.

import statsmodels.api as sm
from pandas.util import testing
df = testing.makeTimeDataFrame()
mod = sm.tsa.AR(df['A'])
res = mod.fit(maxlags=10, ic='bic')
res.params


来源:https://stackoverflow.com/questions/19895131/python-statsmodels-trouble-getting-fitted-model-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!