From help-octave-request at bevo dot che dot wisc dot edu Sun Mar 2 13:50:37 2003 Subject: Re: Covariance Question From: Mike Miller To: Dirk Eddelbuettel cc: "Al Piszcz 'peesh'" , help-octave@bevo.che.wisc.edu Date: Sun, 2 Mar 2003 13:49:32 -0600 (CST) On Sun, 2 Mar 2003, Dirk Eddelbuettel wrote: > edd at chibud:~> 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. > > http://newton.dep.anl.gov/newton/askasci/1993/math/MATH014.HTM 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. Mike ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------