I want to bootstrap the rowMeans of a matrix, and then perform a BCa
confidence interval on the resulting means. The help() for bootstrap() says
that it will accept a matrix as data and any statistic or expression that
returns a matrix or vector.
So, I whipped out this simple example to make sure all is well:
.testmat <- rbind(rnorm(10, 2), rnorm(10, 4), rnorm(10, 6))
test.boot <- bootstrap(.testmat, rowMeans, trace=F)
test.boot
Call:
bootstrap(data = .testmat, statistic = rowMeans)
Number of Replications: 1000
Summary Statistics:
Observed Bias Mean SE
rowMeans1 2.094 2.2363 4.330 1.897
rowMeans2 4.097 0.0914 4.189 1.892
rowMeans3 6.696 -2.3454 4.351 1.886
The bootstrap estimates of the mean should be pretty close to the observed
mean, but they aren't. Given this, limits.bca() will yield nonsense. What's
wrong with how I've used bootstrap()?
Kim Elmore
Kim Elmore, Ph.D.
University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
"All of weather is divided into three parts: Yes, No, and Maybe. The
greatest of these is Maybe" The original Latin appears to be garbled.
|