Sunday, May 9, 2010

Variance of Sample Means

I was always curious and try to understand what does it mean by \[Var(\overline X ) = \frac{{{\sigma ^2}}}{n}\]
My simple MATLAB script can show that if we take 100 samples and compute the mean of them, then do it again 1000 times:

>> dat=poissrnd(5,100,1000);
>> meandat=mean(dat);

the variance of their means are:

>> var(meandat)

ans =

    0.0506

and if we take the variance of all samples (100 x 1000), divide by sample size (100), we got:

>> var(dat(:))/100

ans =

    0.0502

These two numbers are very close!

No comments:

Post a Comment