Skip to content
Prev 25516 / 398502 Next

boot vs. bootstrap summary

Dear listers -

Thanks to all for the insight and help on defining the statistic term in 
the boot() function from the boot library in R - it "obviously" differs 
from the bootstrap function in SPLUS - hence my question about translating 
the syntax from the SPLUS example to R - but what i did not realize is that 
the boot library exisits in SPLUS as well.  Many thanks to those who took 
the time to explain the syntax to me... the list, as usual, was most 
helpful (even for the incesant reminders to try ?boot (how could I have 
known about the statisitic portion of boot without looking at that?).

Prof Ripley suggested reading the help more closely and examples in 
Venables and Ripley's MASS book which I did not realize covers the boot 
library as well... my oversight - its page 175 in the 3rd edition for 
linear models.

John Fox suggested his R and S-PLUS Companion which has an on-line appendix 
on bootstrapping regression models that might be of help. You can find it 
(and other appendices) at 
<http://www.socsci.mcmaster.ca/jfox/Books/Companion/appendix.html>.

Angelo Cany provided this advice
...statistic must be an R function (not an expression) and must
take 2 arguments, the original data and a vector of indices defining
the bootstrap replicate.  Your second error is that the number of
bootstrap replicates does not have a default (deliberately so) and
you must specify the number required.

Your example could be done as follows assuming that you want row
resampling.   Let data.model be the original lm fit.
bootcoef <- function(data, i, model) {
     coef(update(model, data=data[i,]))
}
boot(data.frame, statistic=bootcoef,R=999, model=data.model)

And Roger Peng, noting as all others did my confusion (inability to 
uderstand the ?boot text - hence my post) with the statistic term in 
boot(), said:

I wrote a very simple package for bootstrapping in a few classical
situations, including linear models.  You can resample rows and residuals.
It's available at http://department.stat.ucla.edu/~rpeng/uclaboot.  The
interface is (in my opinion, of course!) a little easier to use than the
boot library.

Hope these are of help to others.

cheers
andrew
----------------------------------------------------------
Dr. Andrew Beckerman
Institute of Biological Science
University of Stirling
Stirling FK9 4LA
+44 (0)1786 then wk-467808 fx-464994
(APB is not responsible for anything below this)