[Rd] [R] computing the variance

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Mon Dec 5 21:08:41 CET 2005


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 at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 05-Dec-05                                       Time: 20:08:38
------------------------------ XFMail ------------------------------



More information about the R-devel mailing list