This function provides a simple front-end to the
boot function in the
package also called
boot is very general and therefore
has many arguments, the
Boot function has very few arguments, but should
meet the needs of many users.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
## Default S3 method: Boot(object, f=coef, labels=names(coef(object)), R=999, method=c("case", "residual")) ## S3 method for class 'lm' Boot(object, f=coef, labels=names(coef(object)), R=999, method=c("case", "residual")) ## S3 method for class 'glm' Boot(object, f=coef, labels=names(coef(object)), R=999, method=c("case", "residual")) ## S3 method for class 'nls' Boot(object, f=coef, labels=names(coef(object)), R=999, method=c("case", "residual"))
A regression object of class
A function whose one argument is the name of a regression object that will be applied to the updated regression object to
compute the statistics of interest. The default is
Provides labels for the statistics computed by
Number of bootstrap samples. The number of bootstrap samples actually computed may be smaller than
this value if either the fitting method is iterative, or if the rank of a fittle
The bootstrap method, either “case” for resampling
cases or “residuals” for a residual bootstrap. See the details
below. The residual bootstrap is available only for
boot function is
Boot is very specific. It takes the information from a
regression object and the choice of
method, and creates a function that is
passed as the
statistic argument to
boot. The argument
is also passed to
boot. All other arguments to
kept at their default values.
The methods available for
nls objects are “case” and
“residual”. The case bootstrap resamples from the joint distribution
of the terms in the model and the response. The residual bootstrap fixes the
fitted values from the original data, and creates bootstraps by adding a
bootstrap sample of the residuals to the fitted values to get a bootstrap
response. It is an implementation of Algorithm 6.3, page 271, of
Davison and Hinkley (1997). For
nls objects ordinary residuals are used
in the resampling rather than the standardized residuals used in the
method. The residual bootstrap for
generalized linear models has several competing approaches, but none are
without problems. If you want to do a residual bootstrap for a glm, you
will need to write your own call to
An attempt to model fit to a bootstrap sample may fail. In a
glm fit, the bootstrap sample could have a different rank from the original
fit. In an
nls fit, convergence may not be obtained for some bootstraps.
In either case,
NA are returned for the value of the function
The summary methods handle the
boot for the returned value from this function. The car
package includes additional generic functions summary, confint and hist that works
with boot objects.
Sanford Weisberg, firstname.lastname@example.org.
Davison, A, and Hinkley, D. (1997) Bootstrap Methods and their Applications. Oxford: Oxford University Press.
Fox, J. and Weisberg, S. (2011) Companion to Applied Regression, Second Edition. Thousand Oaks: Sage.
Fox, J. and Weisberg, S. (2012) Bootstrapping, http://socserv.mcmaster.ca/jfox/Books/Companion/appendix/Appendix-Bootstrapping.pdf.
Weisberg, S. (2014) Applied Linear Regression, Fourth Edition, Wiley Wiley, Chapters 4 and 11.
1 2 3 4 5 6 7 8 9
m1 <- lm(Fertility ~ ., swiss) betahat.boot <- Boot(m1, R=199) # 199 bootstrap samples--too small to be useful summary(betahat.boot) # default summary confint(betahat.boot) hist(betahat.boot) # Bootstrap for the estimated residual standard deviation: sigmahat.boot <- Boot(m1, R=199, f=sigmaHat, labels="sigmaHat") summary(sigmahat.boot) confint(sigmahat.boot)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.