
 Martin Weis - 2006-01-17 14:40:42
 
Great work, thanks!
I recommend to compute the standard deviation from variance using the sqrt, now you compute the variance as the power of a square, which might be less accurate if the value is small. This is also a little more expensive.
Changes should be little:
    function standardDeviation($theSamples)
    {
//[...] do this in function variance($theSamples)
//        return sqrt($theSum/(count($theSamples) - 1)) ;
        return sqrt($this-> variance($theSamples)) ;
    }
    
    function variance($theSamples)
    {
        // put stuff here from above
        //return pow(Numerical::standardDeviation($theSamples), 2) ;
    }