boot {CarletonStats} | R Documentation |
Bootstrap a single variable or a grouped variable
boot(x, ...) ## Default S3 method: boot(x, group = NULL, statistic = mean, conf.level = 0.95, B = 10000, plot.hist = TRUE, legend.loc = "topright", plot.qq = FALSE, x.name = deparse(substitute(x)), ...) ## S3 method for class 'formula' boot(formula, data, subset, ...)
x |
a numeric vector |
... |
further arguments to be passed to or from methods. |
group |
an optional grouping variable (vector), usually a factor variable. If it is a binary numeric variable, it will be coerced to a factor. |
statistic |
function that computes the statistic of interest. Default is the
|
conf.level |
confidence level for the bootstrap percentile interval. Default is 95%. |
B |
number of times to resample (positive integer greater than 2). |
plot.hist |
logical value. If |
legend.loc |
where to place the legend on the histogram. Default is
|
plot.qq |
Logical value. If |
x.name |
Label for variable name |
formula |
a formula |
data |
a data frame that contains the variables given in the formula. |
subset |
an optional expression indicating what observations to use. |
Perform a bootstrap of a statistic applied to a single variable, or to the
difference of the statistic computed on two samples (using the grouping
variable). If x
is a binary vector of 0's and 1's and the function is
the mean, then the statistic of interest is the proportion.
Observations with missing values are removed.
A vector with the resampled statistics is returned invisibly.
default
: Bootstrap a single variable or a grouped variable
formula
: Bootstrap a single variable or a grouped variable
Laura Chihara
Tim Hesterberg's website http://www.timhesterberg.net/bootstrap
#ToothGrowth data (supplied by R) #bootstrap mean of a single numeric variable boot(ToothGrowth$len) #bootstrap difference in mean of tooth length for two groups. boot(ToothGrowth$len, ToothGrowth$supp) #same as above using formula syntax boot(len ~ supp, data = ToothGrowth)