[R] Variance Computing- - HELP!!!!!!!!!!!!!!!!!!
Richard A. O'Keefe
ok at cs.otago.ac.nz
Wed Aug 20 04:32:26 CEST 2003
"Padmanabhan, Sudharsha" <sudAR_80 at neo.tamu.edu>
We know trhat as the sample size increases, the variance should
I can paraphrase his test case thus:
v100 <- sapply(1:100, function(i) var(rnorm(100, 0, 3)))
# We expect the elements of v100 to cluster around 3^2
v1000 <- sapply(1:1000, function(i) var(rnorm(1000, 0, 3)))
# We expect the elements of v1000 to cluster around 3^2 too.
=>  6.469134 7.884637 8.916314 10.189463 13.897817
=>  7.874345 8.692326 8.967684 9.268955 10.503038
The population parameter sigma-squared is 3^2 = 9.
The estimates are 8.92 in one case and 8.97 in the other;
sounds about right to me.
Looking at density(v100) and density(v1000) is enlightening.
Means and standard deviations:
=> 9.080676 2.376193
=> 8.98147 0.1721246
Are these not pretty much as expected? Not that a t-test is the
ideal test for the distributions involved, but it's familiar and
since the distribution is pretty bell-shaped, it may be usable as
a rough guide to whether to be worried or not.
> t.test(v100, v1000)
Welch Two Sample t-test
data: v100 and v1000
t = 0.6413, df = 100.439, p-value = 0.5228
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
mean of x mean of y
More information about the R-help