Re: [Numpy-discussion] Question on lstsq and correlation coeff

2009-02-25 Thread Anthony Kong
josef.p...@gmail.com Sent: Thursday, 26 February 2009 11:09 AM To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] Question on lstsq and correlation coeff On Wed, Feb 25, 2009 at 6:21 PM, Anthony Kong wrote: > Hi, all, > > It is probably a newbie question. > > I tryi

[Numpy-discussion] Question on lstsq and correlation coeff

2009-02-25 Thread Anthony Kong
Hi, all, It is probably a newbie question. I trying to use scipy/numpy in a finanical context. I want to compute the correlation coeff of two series (returns vs index returns). I tried two appoarches Firstly, from scipy.linalg import lstsq coeffs,a,b,c = lstsq(matrix, returns) # matrix con

[Numpy-discussion] Example of numpy cov() not correct?

2008-07-29 Thread Anthony Kong
Hi, all, I am trying out the example here (http://www.scipy.org/Numpy_Example_List_With_Doc#cov) >>> from numpy import * ... >>> T = array([1.3, 4.5, 2.8, 3.9]) >>> P = array([2.7, 8.7, 4.7, 8.2]) >>> cov(T,P) The answer is supposed to be 3.95416