Re: Puzzled by the "Variance"
- To: mathgroup at smc.vnet.net
- Subject: [mg86528] Re: [mg86506] Puzzled by the "Variance"
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Thu, 13 Mar 2008 04:31:33 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200803121029.FAA17511@smc.vnet.net>
- Reply-to: murray at math.umass.edu
"Variance", as being used in Mathematica and in MathWorld, is actually "sample variance", as distinct from "population variance". What you calculated to be 2/3 is actually the population variance. The difference: sampleVar[x_] := Total[(#^2 &) /@ (x - Mean@x)]/(Length[x] - 1) populationVar[x_] := Total[(#^2 &) /@ (x - Mean@x)]/Length[x] { sampleVar[{1,2,3}], populationVar[{1,2,3}] } // InputForm {1, 2/3} Elements wrote: > Greeting all > I'm puzzled by the function "Variance". We can learn how to calculate > variance from this page:http://mathworld.wolfram.com/SampleVariance.html. > For example, calculate the sample variance of {1,2,3}. the average of > {1,2,3} is 2, then the variance should be ((1-2)^2+(2-2)^2+(3-2)^2)/3=2/3. > But mathematica gives that: > > In[10]:= Variance[{1.0,2.0,3.0}] > Out[10]= 1. > > Why?? -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
- References:
- Puzzled by the "Variance"
- From: Elements <philyer@gmail.com>
- Puzzled by the "Variance"