Why does the function VarianceMLE give a different result from Variance?

Why does the function VarianceMLE give a different result from Variance?

And what is it in Mathematica 11.3? Please see the picture above t665he MLE is 621 and the other is 665.

• In Mathematica 11.3, << Statistics  produces an error message and Variance@data // N gives 665.524 – m_goldberg Jan 14 at 7:47
• I'm going to guess that VarianceMLE is the maximum likelihood variance estimator rather than the unbiased one (assuming normally distributed data). The difference between the two is that Variance divides by N-1 (N == Length[data]) while the MLE estimator divides by N. – Sjoerd Smit Jan 14 at 9:22
• And for future reference: please post copyable code in your question rather than a screenshot. This makes it much easier for someone else to copy your code and try things out. – Sjoerd Smit Jan 14 at 9:23
• Which book did you see this in? It looks like a scan. – Szabolcs Jan 14 at 11:45

I just checked my guess in my comment and I was right. VarianceMLE is the maximum likelihood variance estimator (see, e.g. here).

data = {34, 56, 28, 62, 32, 90, 20, 10, 12, 35, 63, 78, 12, 25, 68};
Variance[data]


13976/21

myVariance[lst_List] := Total[(lst - Mean[lst])^2]/(Length[lst] - 1);
myVarianceMLE[lst_List] := Total[(lst - Mean[lst])^2]/Length[lst];

myVariance[data]
myVarianceMLE[data]


13976/21

27952/45

VarianceMLE computes a biased, maximum likelihood estimate of the population variance. Variance computes an unbiased estimate of the population variance. It can be shown that VarianceMLE underestimates the variance of the population.

Let $$\{y_i : 1 \leq i \leq n\}$$ be a sample of $$n$$ values from a population. The variance (central second moment) of the sample is $$\sigma_y^2 = \frac{1}{n} \sum_{i=1}^n (y_i - \bar{y}) \text{,}$$ where $$\bar{y} = \frac{1}{n} \sum_{i=1}^n y_i$$ is the sample mean. This $$\sigma_y^2$$ is computed by VarianceMLE.

If $$\sigma^2$$ is the population variance, with some work, one can show that the expected value of $$\sigma_y^2$$ is $$\frac{n-1}{n} \sigma^2$$, so the sample variance is a biased estimator of the population variance. We can make this an unbiased estimator via $$s^2 = \frac{n}{n-1} \sigma_y^2 = \frac{1}{n-1}\sum_{i=1}^n (y_i - \bar{y}) \text{.}$$ This $$s^2$$ is computed by Variance. From the documentation (in the Details):

"Variance[list] is equivalent to Total[(list-Mean[list])^2]/(Length[list]-1) for real-valued data."

The very sparse documentation for VarianceMLE indicates that it is implemented in terms of Variance`:

"VarianceMLE[data_] := Variance[data] (Length[data] - 1)/Length[data]"