help-octave
[Top][All Lists]
Advanced

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

Re: Covariance Question


From: Dirk Eddelbuettel
Subject: Re: Covariance Question
Date: Sun, 2 Mar 2003 07:47:05 -0600
User-agent: Mutt/1.3.28i

On Sun, Mar 02, 2003 at 07:27:21AM -0500, Al Piszcz 'peesh' wrote:
> 
> Excel provides a covariance of 4 and Octave 5.333, what
> I am doing wrong?
> 
> octave:1> x=[3;1;3;9]
> x =
> 
>   3
>   1
>   3
>   9
> 
> octave:2> y=[4;4;8;8]
> y =
> 
>   4
>   4
>   8
>   8
> 
> octave:3> cov(x,y)
> ans = 5.3333

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. 

http://newton.dep.anl.gov/newton/askasci/1993/math/MATH014.HTM

Dirk

-- 
Prediction is very difficult, especially about the future. 
                                             -- Niels Bohr



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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