Re: [Rd] [R] computing the variance

From: Ted Harding <Ted.Harding_at_nessie.mcc.ac.uk>
Date: Mon 05 Dec 2005 - 20:08:41 GMT


On 05-Dec-05 Duncan Murdoch wrote:

>> The variance of X is (or damn well should be) defined as
>> 
>>   Var(X) = E(X^2) - (E(X))^2
>> 
>> and this comes to (Sum(X^2) - (Sum(X)/N)^2))/(N-1).

>
> I don't follow this. I agree with the first line (though I prefer to
> write it differently), but I don't see how it leads to the second. For
> example, consider a distribution which is equally likely to be +/- 1,
> and a sample from it consisting of a single 1 and a single -1. The
> first formula gives 1 (which is the variance), the second gives 2.
>
> The second formula is unbiased because in a random sample I am just as
> likely to get a 0 from the second formula, but I'm curious about what
> you mean by "this comes to".
>
> Duncan

Sorry, you're of course right -- I was being a bit hasty and maganed to tangle this with a standard definition of the "variance" of a finite population which uses the 1/(N-1) divisor!



E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861
Date: 05-Dec-05                                       Time: 20:08:38
------------------------------ XFMail ------------------------------

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue Dec 06 07:20:37 2005

This archive was generated by hypermail 2.1.8 : Mon 05 Dec 2005 - 21:21:15 GMT