Re: Mathematica: Strange no direct command to find Variance for population. Only for sample?



Nasser Abbasi wrote:
Mathematica 6.0.

Doing help on Variance[], I do not see an option to tell it to obtain Variance for population. (I think this is called Biased estimate).
i.e. I am looking for the definition of Var(x) using N in denominator not N-1. The Variance command uses N-1, and no option to tell it to use N.

In Matlab for example, I do

EDU>> y=[1,2,3];
EDU>> var(y)
ans =

1
EDU>> var(y,1)
ans =

0.6667

The second case above is population variance (divide by N).
In Mathematica

In[12]:= y = {1, 2, 3};
Variance[y]
Out[12]= 1

I find it strange that no option exist to ask for populatio variance.
(ofcourse easy to do such a function, but I would think it should be part of the Variance[] command allready)


Variance[] is such a simple function. It is very easy to reimplement, so the lack of this option is not really a disadvantage:

var[lst_] := #.# & [lst - Mean[lst]] / Length[lst]

Too many redundant options can be just as bad as too few built-in functions.
.



Relevant Pages