[SciPy-user] Cov of 2 vectors
Thu May 28 02:48:54 CDT 2009
> How do i compute the covar of 2 vectors. The cov module in scipy always
> returns a 2 by 2matrix even if the vectors are of len >2 , how is this
> However for the covariance of x and y i need a single number, are there any
> built in functions for this??
You're getting the full covariance matrix from cov. Since you only
have two vectors this is always a 2x2 matrix. The off-diagonal terms
[at locations (0, 1) & (1, 0)] are the covariance of your two vectors
and the on-diagonal terms represent the variance of each vector.
More information about the SciPy-user