Python 2.7 在statsmodels中使用向量自回归VAR

Python 2.7 在statsmodels中使用向量自回归VAR,python-2.7,time-series,var,Python 2.7,Time Series,Var,我正在尝试使用以下脚本运行VAR模型 import statsmodels import statsmodels.tsa.api as sm from statsmodels.tsa.api import VAR tsBitcoin_frame = tsBitcoin.to_frame() tsSP500_frame = tsSP500.to_frame() forVar = [tsBitcoin_frame, tsSP500_frame] dataForVar = pd.concat(for

我正在尝试使用以下脚本运行VAR模型

import statsmodels
import statsmodels.tsa.api as sm
from statsmodels.tsa.api import VAR

tsBitcoin_frame = tsBitcoin.to_frame()
tsSP500_frame = tsSP500.to_frame()
forVar = [tsBitcoin_frame, tsSP500_frame]
dataForVar = pd.concat(forVar, axis =1)

model = VAR(dataForVar)    
results = model.fit(2)
results.summary()
但是python给了我以下错误“名称'VAR'未定义”


我使用的是statsmodels版本0.8.0。我甚至尝试使用命令sm.VAR代替VAR,但python不会打印VAR模型的统计数据。有人知道为什么会发生这种情况吗?我如何解决它,或者如何在python中实现VAR模型?谢谢

对不起,我弄错了。我没有把打印放在results.summary之前,应该离开statsmodels.tsa.api import VAR的行。不过谢谢