For Programmers: Free Programming Magazines  


Home > Archive > Matlab > April 2005 > Matlab Covariance Matrices









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Matlab Covariance Matrices
Bob Conroy

2005-04-25, 8:59 pm

Hi there, I have been experimenting today with Matlabs cov function
to produce covariance matrices ... it seems to consistently produces
results where each element is exactly scaled 1.5 times the value I
work out on paper. I was hoping someone could give me and indication
why this maybe?

I am calculating the matrices according to the common method
presented by places such as wikipedia etc. Thanks.
Tom Lane

2005-04-25, 8:59 pm

> Hi there, I have been experimenting today with Matlabs cov function
> to produce covariance matrices ... it seems to consistently produces
> results where each element is exactly scaled 1.5 times the value I
> work out on paper.


Bob, are you working on a matrix with three rows?
[color=darkred]
ans =
1[color=darkred]
ans =
0.666666666666667

The first one is computing an unbiased estimate of the variance of the
population from which the vector was taken. It uses n-1 in the denominator
of the variance formula, where n is the number of observations.

The second one is computing the variance as if the vector represents the
entire population. It uses n in the denominator. Their ratio, of course,
is 3/2 for a sample of size 3.

-- Tom


Bob Conroy

2005-04-26, 4:06 am

excellent thanks that clears my problem up. Much appreciated.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com