[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Covariance Question

From: Bob Meeks
Subject: RE: Covariance Question
Date: Mon, 3 Mar 2003 11:33:01 -0700

The n vs. n-1 issue has to do with degrees-of-freedom.  In the example, if 
both x and y are random samples and hence their respective population means 
are implicitly being estimated the denominator should be n-1.  If they are 
functions (e. g. populations) the denominator should be n.

If they really are functions, however, a better approach would be to calculate 
the correlation using the orthogonality integral (or sum) which would use n! 
to reflect the fact that teh entire population of values is known.

If x and y are just a subset of "p" variables in a large set of predictor 
functions in a regression problem for example, there would be still a 
different denominator, n-p-1.

Bottom line - know what you're doing but the default behavior is reasonable!

>===== Original Message From Mike Miller <address@hidden> =====
>On Sun, 2 Mar 2003, Dirk Eddelbuettel wrote:
>> address@hidden:~> octave2.1 -q
>> octave2.1:1> x=[3;1;3;9];
>> octave2.1:2> y=[4;4;8;8];
>> octave2.1:3> cov(x,y)*(length(x)-1)/length(x)
>> ans = 4
>> The difference depends on whether you "know" that your data comes from
>> a sample versus a population. See e.g.
>Right.  It's the N v. N-1 effect.  Use of N produces the maximum
>likelihood estimator for multivariate normal data.  It has good properties
>and is, in some ways, superior to use of N-1.  That's another reason to
>use N sometimes, not just because the entire population is known.  Still,
>N-1 is used much more often, and Octave uses N-1.  I think it's the right
>choice for the default behavior of the cov function.  It's also what
>MATLAB does.
>Octave is freely available under the terms of the GNU GPL.
>Octave's home on the web:
>How to fund new projects:
>Subscription information:

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]