rsc05
rsc05

Reputation: 3820

How to plot cross-correlation function in python jupyter notebook

I am trying to do something like plotting the Sample cross-correlation function as described in http://www.michaeljgrogan.com/cross-correlation-r/

However, I do not want to use the function from R or using the rpy2 library. I was wondering whether there is already a built-in function in one of the libraries in Python like sm.tsa.stattools. Something that is embedded in Jupyter notebook.

Additionally, where could I find python built-in libraries for VAR models and estimating VAR or Structural VAR model in python?

Thank you so much

Upvotes: 2

Views: 2186

Answers (1)

rsc05
rsc05

Reputation: 3820

Although, I am not quite happy with this solution since there are no dotted lines

This does the job however

import matplotlib.pyplot as plt
plt.xcorr(df.ix[:,2],df.ix[:,3],maxlags=15, usevlines=1)
plt.show()

But I was wondering whether there are any better figures

Upvotes: 1

Related Questions