Time Series Analysis in Python
Rob Reider
Adjunct Professor, NYU-Courant Consultant, Quantopian
Correlation = 0.9
Correlation = -0.9
Correlation = 0.4
Corelation = 1.0
Dow Jones Industrial Average and UFO Sightings (www.nuforc.org)
Correlation of levels: 0.94
df['SPX_Ret'] = df['SPX_Prices'].pct_change()
df['R2000_Ret'] = df['R2000_Prices'].pct_change()
plt.scatter(df['SPX_Ret'], df['R2000_Ret'])
plt.show()
correlation = df['SPX_Ret'].corr(df['R2000_Ret'])
print("Correlation is: ", correlation)
Correlation is: 0.868
Time Series Analysis in Python