Maple gives also 4. I've computed the variance from definition and it is
really 4 :-)

x_avg = average( x ) = 6

var(X) = average( x - x_avg)^2 ) = ( 1 + 1 + 1 + 1 + 4*4 ) / 5 = 20 / 5
= 4

var(X) = average( x^2 ) - average(x) ^ 2 = ( 5^2 + 5^2 + 5^2 + 5^2 +
10^2 ) / 5 - 6^2 = 200/5 - 36 = 4

The problem is that you calculate the biased corrected sample variance
instead of sample variance. See the form (5) and read the article that
follows this equation in http://mathworld.wolfram.com/Variance.html.
WolframAlpha implements the biased corrected version a variance, Maple
the not corrected version. I've tested it in Excel and it gives also the
corrected version (i.e. 5). You should probably at least give some note
to the help of the function list to avoid such confusion.


** Attachment added: "variance.png"
   http://launchpadlibrarian.net/29562673/variance.png

-- 
wrong result of var() function
https://bugs.launchpad.net/bugs/404001
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to