Discussion:
[Matplotlib-users] Difference in cross correlation in R & Matplotlib
Sudheer Joseph
2016-01-07 09:29:45 UTC
Permalink
*************************************************************** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:***@gmail.com;***@yahoo.com Web- http://oppamthadathil.tripod.com ***************************************************************

------------------------------------------------------------------------------
Sudheer Joseph
2016-01-07 09:34:35 UTC
Permalink
Dear experts,
I tried to use the matplotlib function plt.xcorr for calculating cross correlation between to check its
functionality using the data from a standard example given in R web site example.
https://onlinecourses.science.psu.edu/stat510/node/74

However when the example given above is replicated using python I get a totally different graph.
Any idea why this happens?
I tried normed=True but do not appears to have any effect. Any advice on this will be of extreme help


import urllib as web
from matplotlib import pylab as plt
f=web.urlopen('http://anson.ucdavis.edu/~shumway/soi.dat')
soi=[]
for line in f: soi.append(float(line.strip()))
f.close()
rec=[]
f=web.urlopen('http://anson.ucdavis.edu/~shumway/recruit.dat')
for line in f: rec.append(float(line.strip()))
ax=plt.figure()
anl_ccf=plt.xcorr(soi,rec,maxlags=30)
plt.show()


With best regards,
Sudheer

------------------------------------------------------------------------------
Loading...