Bootstrapping and the boot package in R

May 21, 2009

(This article was first published on Jeromy Anglim's Blog: Psychology, Statistics, & Research Design, and kindly contributed to R-bloggers)

I was recently asked about options for bootstrapping. The following post sets out some applications of bootstrapping and strategies for implementing it in R.

I’ve found bootstrapping useful in several settings:

  • where the statistic I’m interested in is a little unusual: the average R-square across five separate regressions; the difference in the average correlation of a set of variables between two groups
  • non parametric statistics, such as the median
  • when assumptions such as normality of homoscedasticity are not satisfied

Bootstrapping in R
R is very cool for bootstrapping. I’ve mainly used the boot package and found it very good. In fact, it is a classic example of something that R makes easy. It’s easy to run loops in R, and R is excellent at taking output from one function and using it as input to another. This is the essence of bootstrapping: taking different samples of your data, getting a statistic for each sample (e.g., the mean, median, correlation, regression coefficient, etc.), and using the variability in the statistic across samples to indicate something about the standard error and confidence intervals for the statistic.

Bootstrapping in SPSS
You can do bootstrapping with SPSS. I seem to remember there being some Python add-on package that’s designed to make bootstrapping easier. I’ve never used it and I don’t imagine that it would be as easy to use as R given how difficult it is in SPSS to take SPSS output and process it further programmatically (even if the OMS is trying to make this easier). For certain specific tests you might be able to find already available macros (e.g., for indirect effects ).

Related Posts:

To leave a comment for the author, please follow the link and comment on their blog: Jeromy Anglim's Blog: Psychology, Statistics, & Research Design. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Mango solutions

RStudio homepage

Zero Inflated Models and Generalized Linear Mixed Models with R

Dommino data lab

Quantide: statistical consulting and training



CRC R books series

Six Sigma Online Training

Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)