Skip to content

Instantly share code, notes, and snippets.

@kperry2215
Created July 20, 2019 02:50
Show Gist options
  • Save kperry2215/a1dac8cebd99d9720614281b0ecef8fa to your computer and use it in GitHub Desktop.
Save kperry2215/a1dac8cebd99d9720614281b0ecef8fa to your computer and use it in GitHub Desktop.
#Convert the dataframe to a numpy array
master_array=np.array(master_df[['Electricity_Price_Transformed_Differenced',
'Nat_Gas_Price_MCF_Transformed_Differenced']].dropna())
#Generate a training and test set for building the model: 95/5 split
training_set = master_array[:int(0.95*(len(master_array)))]
test_set = master_array[int(0.95*(len(master_array))):]
#Fit to a VAR model
model = VAR(endog=training_set)
model_fit = model.fit()
#Print a summary of the model results
model_fit.summary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment