# definition of the sdfun when not supplied to boott # taken from inside boott version 1.0-11 sdfunboot <- function(x, nboot, theta, ...) { n <- length(x) junk <- matrix(sample(x, size = n * nboot, replace = TRUE), nrow = nboot) return(sqrt(var(apply(junk, 1, theta, ...)))) } # example from bottom of boott on-line help > library(bootstrap) > xdata <- matrix(rnorm(30),ncol=2) > n <- 15 > theta <- function(x, xdata){ cor(xdata[x,1],xdata[x,2]) } > results <- boott(1:n,theta, xdata) > > results $confpoints 0.001 0.01 0.025 0.05 0.1 0.5 0.9 [1,] -0.7792764 -0.609625 -0.4698053 -0.4142358 -0.279691 -0.03848143 0.2255475 0.95 0.975 0.99 0.999 [1,] 0.3302312 0.4630966 0.5468772 0.6367309 # slightly modified example > library(MASS) > xdata <- mvrnorm(30, c(0, 0), matrix(c(1, 0.75, 0.75, 1), 2)) > dim(xdata) [1] 30 2 > apply(xdata, 2, mean) [1] -0.04375371 0.11137158 > 1 / sqrt(30) [1] 0.1825742 > cor(xdata) [,1] [,2] [1,] 1.0000000 0.7906614 [2,] 0.7906614 1.0000000 > results <- boott(1:n,theta, xdata) > results $confpoints 0.001 0.01 0.025 0.05 0.1 0.5 0.9 [1,] -0.2415211 0.1093383 0.3227335 0.4639302 0.5766922 0.7820482 0.908461 0.95 0.975 0.99 0.999 [1,] 0.9420723 0.9639241 0.993209 1.023637