urpi
urpi

Reputation: 309

Using Vector AutoRegression VAR in statsmodels

I am trying to run a VAR model with the following script.

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()

However python is giving me the following error "name 'VAR' is not defined"

I am using statsmodels version 0.8.0. I even tried using command sm.VAR instead VAR but then python wouldn't print the statistics of VAR model. Does anyone know why this is happening, how can I solve it or how can implement the VAR model in python? Thanks!

Upvotes: 0

Views: 1323

Answers (1)

urpi
urpi

Reputation: 309

Sorry I figured out my mistake. I was not putting print before results.summary and should have left the line from statsmodels.tsa.api import VAR. Thanks though!

Upvotes: 1

Related Questions