Learn R Programming

car (version 2.0-21)

hist.boot: Generic functions to provide support for boot objects

Description

The Boot function in car uses the boot function from the boot package to do a straightforward case or residual bootstrap for a regression object. These are generic functions to summarize the results of the bootstrap.

Usage

## S3 method for class 'boot':
hist(x, parm, layout = NULL, ask, main = "", freq = FALSE, 
    estPoint = TRUE, point.col = "black", point.lty = 2, point.lwd = 2, 
    estDensity = !freq, den.col = "blue", den.lty = 1, den.lwd = 2, 
    estNormal = !freq, nor.col = "red", nor.lty = 2, nor.lwd = 2, 
    ci = c("bca", "none", "percentile"), level = 0.95, legend = c("top", 
        "none", "separate"), box = TRUE, ...)

## S3 method for class 'boot':
summary(object, parm, high.moments = FALSE, extremes = FALSE, ...) 
    
## S3 method for class 'boot':
confint(object, parm, level = 0.95, type = c("bca", "norm", 
    "basic", "perc", "all"), ...)

Arguments

x, object
An object created by a call to boot of class "boot".
parm
A vector of numbers or coefficient names giving the coefficients for which a histogram or confidence interval is desired. If numbers are used, 1 corresponds to the intercept, if any. The default is all coefficients.
layout
If set to a value like c(1, 1) or c(4, 3), the layout of the graph will have this many rows and columns. If not set, the program will select an appropriate layout. If the number of graphs exceed nine, you must select the lay
ask
If TRUE, ask the user before drawing the next plot; if FALSE, don't ask.
main
Main title for the graphs. The default is main="" for no title.
freq
The usual default for hist is freq=TRUE to give a frequency histogram. The default here is freq=FALSE to give a density histogram. A density estimate and/or a fitted normal density can be added to the graph if <
estPoint, point.col, point.lty, point.lwd
If estPoint=TRUE, the default, a vertical line is drawn on the histgram at the value of the point estimate computed from the complete data. The remaining three optional arguments set the color, line type and line width of the line that is
estDensity, den.col, den.lty, den.lwd
If estDensity=TRUE andfreq=FALSE, the default, a kernel density estimate is drawn on the plot with a call to the density function with no additional arguments. The remaining three optional arguments set the color,
estNormal, nor.col, nor.lty, nor.lwd
If estNormal=TRUE andfreq=FALSE, the default, a normal density with mean and sd computed from the data is drawn on the plot. The remaining three optional arguments set the color, line type and line width of the lines that are
ci
A confidence interval based on the bootstrap will be added to the histogram using the BCa method if ci="bca" or using the percentile method if ci="percentile". No interval is drawn if ci="none". The default is <
legend
A legend can be added to the (array of) histograms. The value "top" puts at the top-left of the plots. The value "separate" puts the legend in its own graph following all the histograms. The value "none"
box
Add a box around each histogram.
...
Additional arguments passed to hist; for other methods this is included for compatibility with the generic method. For example, the argument border=par()$bg in hist will draw the histogram transparently, leaving o
high.moments
Should the skewness and kurtosis be included in the summary? Default is FALSE.
extremes
Should the minimum, maximum and range be included in the summary? Default is FALSE.
level
Confidence level, a number between 0 and 1. In confint, level can be a vector; for example level=c(.68, .90, .95) will return the estimated quantiles at c(.025, .05, .16, .84, .95, .975).
type
Selects the confidence interval type. The types implemented are the "percentile" method, which uses the function quantile to return the appropriate quantiles for the confidence limit specified, the default bca w

Value

  • hist is used for the side-effect of drawing an array of historgams of each column of the first argument. summary returns a matrix of summary statistics for each of the columns in the bootstrap object. The confint method returns confidence intervals. Print method

References

Efron, B. and Tibsharini, R. (1993) An Introduction to the Bootstrap. New York: Chapman and Hall. Fox, J. and Weisberg, S. (2011) An R Companion to Applied Regression, Second Edition. Sage. Fox, J. and Weisberg, S. (2012) Bootstrapping, http://socserv.mcmaster.ca/jfox/Books/Companion/appendix/Appendix-Bootstrapping.pdf. Weisberg, S. (2013) Applied Linear Regression, Fourth Edition, Wiley

See Also

See Also Boot, hist, density

Examples

Run this code
m1 <- lm(Fertility ~ ., swiss)
betahat.boot <- Boot(m1, R=99) # 99 bootstrap samples--too small to be useful
summary(betahat.boot)  # default summary
confint(betahat.boot)
hist(betahat.boot)

Run the code above in your browser using DataLab