# [R] Variance Computing - HELP

Thomas W Blackwell tblackw at umich.edu
Tue Aug 19 20:06:19 CEST 2003

```The variance of Xbar decreases as 1/n;  the sample variance
of X does not.

-  tom blackwell  -  u michigan medical school  -  ann arbor  -

On Tue, 19 Aug 2003, Padmanabhan, Sudharsha wrote:

> I am running a few simulations for clinical trial anlysis. I want some help
> regarding the following.
>
> We know trhat as the sample size increases, the variance should decrease, but
> I am getting some unexpected results. SO I ran a code (shown below) to check
> the validity of this.
>
> large<-array(1,c(1000,1000))
> small<-array(1,c(100,1000))
> for(i in 1:1000){large[i,]<-rnorm(1000,0,3)}
> for(i in 1:1000){small[i,]<-rnorm(100,0,3)}}
> yy<-array(1,100)
> for(i in 1:100){yy[i]<-var(small[i,])}
> y1y<-array(1,1000)
> for(i in 1:1000){y1y[i]<-var(large[i,])}
> mean(yy);mean(y1y);
> [1] 8.944
> [1] 9.098
>
> This shows that on an average,for 1000 such samples of 1000 Normal numbers,
> the variance is higher than that of a 100 samples of 1000 random numbers.
>
> Why is this so?