boot_ci {quest} | R Documentation |
Bootstrapped Confidence Intervals from a Matrix of Coefficients
Description
boot_ci
computes bootstrapped confidence intervals from a matrix of
coefficients (or any statistical information of interest). The function is an
alternative to confint2.boot
for when the user does not have an object
of class boot
, but rather creates their own matrix of coefficients. It
has limited types of bootstrapped confidence intervals at the moment, but
future versions are expected to have more options.
Usage
boot_ci(coef, est = colMeans(coef), boot.ci.type = "perc2", level = 0.95)
Arguments
coef |
numeric matrix (or data.frame of numeric columns) of
coefficients. The rows correspond to each bootstrapped resample and the
columns to different coefficients. This is the equivalent of the "t"
element in a |
est |
numeric vector of observed coefficients from the full sample. This
is the equivalent of the "t0" element in a |
boot.ci.type |
character vector of length 1 specifying the type of
bootstrapped confidence interval to compute. The options are 1) "perc2" for
the naive percentile method using |
level |
double vector of length 1 specifying the confidence level. Must be between 0 and 1. |
Value
data.frame will be returned with nrow equal to the number of
coefficients bootstrapped and columns specified below. The rownames are the
colnames in the coef
argument or the names in the est
argument
(default data.frame rownames if neither have any names). The columns are the
following:
- est
original parameter estimates
- se
bootstrapped standard errors (does not differ by
boot.ci.type
)- lwr
lower bound of the bootstrapped confidence intervals
- upr
upper bound of the bootstrapped confidence intervals
See Also
boot.ci
for the confidence interval function in the boot
package,
confint.boot
for an alternative function with boot
objects
Examples
tmp <- replicate(n = 100, expr = {
i <- sample.int(nrow(attitude), replace = TRUE)
colMeans(attitude[i, ])
}, simplify = FALSE)
mat <- str2str::lv2m(tmp, along = 1)
boot_ci(mat, est = colMeans(attitude))