On 10/22/11 8:34 AM, [email protected] wrote:
> I'm utterly sorry to pose such a dumb question, but:
>
> the variance of the values 2, 4, and 6: shouldn't that be 2.67 ? The 
> StatUtils and DescriptveStatistics give me 4.
>
> My calculation (that I checked a dozen times) is: 
> (2-4)^2 * 1/3 + (4-4)^2 * 1/3 + (6-4)^2 * 1/3

The implementations in the classes above use the bias-corrected
formula for the variance, which makes the denominator above equal to
2.  If you want the non-bias-corrected version, you have to use the
Variance class directly and set the biasCorrected property to
false.  The javadoc could be clearer here and it would probably be
good to add a populationVariance method or a version of getVariance
in these classes that takes a boolean to determine whether or not
the result is bias-corrected.  I will open a JIRA for that.

Phil


>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to