# [R] Variance Computing- - HELP!!!!!!!!!!!!!!!!!!

James MacDonald jmacdon at med.umich.edu
Tue Aug 19 20:17:25 CEST 2003

```I think you are confused. As sample size increases, the variance of an
estimate based on that sample will decrease asymtotically to zero (e.g.,
the standard error of the mean will go to zero). However the variance of
the sample itself will not change. Any difference you see in your data
is simply due to chance. If you repeat, the larger set may or may not
have a larger variance.

> var(rnorm(10000, 0, 3))
 8.958727
> var(rnorm(10000, 0, 3))
 9.155332
> var(rnorm(10000, 0, 3))
 9.050894
> var(rnorm(10000, 0, 3))
 9.282509
> var(rnorm(100000, 0, 3))
 8.990778
> var(rnorm(100000, 0, 3))
 9.024343
> var(rnorm(100000, 0, 3))
 8.999064
>
> var(rnorm(100000, 0, 3))
 9.088034

HTH

Jim

James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623

>>> "Padmanabhan, Sudharsha" <sudAR_80 at neo.tamu.edu> 08/19/03 01:42PM
>>>

Hello,

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);
 8.944
 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?

Thanks.

Regards

~S.

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

```