To estimate the variance of a statistic (such as the mean or the standard deviation) using the bootstrap method in R, we can follow these steps:
my_stat.main.r100 chars6 lines
boot function from the boot package to do this. The R argument specifies the number of resamples to generate.main.r113 chars7 lines
boot function returns a list with several elements, including the bootstrap estimates of the statistic (t) and its variance (t0).main.r281 chars10 lines
By repeating this procedure many times, we obtain a good estimate of the variance of the statistic, which is often more robust than the theoretical or asymptotic formulae.
gistlibby LogSnag