commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: [math] variance result
Date Sat, 22 Oct 2011 15:49:44 GMT
On 10/22/11 8:34 AM, entity@gmx.com 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: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message