# This program uses the predefined commands # in the `bootstrap' package to bootstrap # the median for the Mouse data treatment group. library(bootstrap) # loads library controlgrp <- c(52,104,146,10,50,31,40,27,46) # available as mouse.c in library results <- bootstrap(controlgrp,250,median) show(summary(results)) brep <-results$thetastar hist(brep,breaks=(0:200),freq=FALSE,col="red",axes=FALSE, main="Bootstrap distribution for median",xlab="Median", ylab="Probability") axis(1,at=controlgrp,font=8) axis(2) cat('median of original sample', median(controlgrp), '\n') cat('bootstrap estimate of std dev', sd(brep), '\n')