> albuterol <- read.table("/group/ftp/pub/kcowles/datasets/albuterl.txt", + header = T) > medstat function( df, ind) { median( df[ind,"after"] - df[ind,"before"] ) } > library(boot) > bootalb.out <- boot( albuterol, medstat, 1999) > bootalb.out ORDINARY NONPARAMETRIC BOOTSTRAP Call: boot(data = albuterol, statistic = medstat, R = 1999) Bootstrap Statistics : original bias std. error t1* -1.1 -0.01176588 0.2508711 > boot.ci( bootalb.out) BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS Based on 1999 bootstrap replicates CALL : boot.ci(boot.out = bootalb.out) Intervals : Level Normal Basic 95% (-1.580, -0.597 ) (-1.628, -0.628 ) Level Percentile BCa 95% (-1.572, -0.572 ) (-1.798, -0.816 ) Calculations and Intervals on Original Scale #The bootstrap unbiased estimate is # -1.1 - (-0.01177) = -1.088 #The estimated bias is on the order of 1%, so bias correction probably # isn't needed. #The standard error is 0.251. # The four confidence intervals are given above. > hist(bootalb.out$t) > abline( v = bootalb.out$t0 ) #Since all the confidence intervals lie strictly to the left of 0, we # conclude that albuterol does reduce the work of breathing in the #population of interest.