Python statsmodels 无法获取拟合的模型参数 [英] Python statsmodels trouble getting fitted model parameters

查看:29
本文介绍了Python statsmodels 无法获取拟合的模型参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 AR 模型来拟合我的数据,我认为我已经成功地做到了,但现在我想实际查看拟合的模型参数是什么,但我遇到了一些麻烦.这是我的代码

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

我收到错误

AssertionError: Index length did not match values

推荐答案

我无法用当前的主人重现这个.

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

这篇关于Python statsmodels 无法获取拟合的模型参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆