fwb.ci()
generates several types of equi-tailed two-sided nonparametric confidence intervals. These include the normal approximation, the basic bootstrap interval, the percentile bootstrap interval, the bias-corrected percentile bootstrap interval, and the bias-correct and accelerated (BCa) bootstrap interval.
fwb.ci(
fwb.out,
conf = 0.95,
type = "bc",
index = 1L,
h = base::identity,
hinv = base::identity,
...
)# S3 method for fwbci
print(x, hinv = NULL, ...)
An fwbci
object, which inherits from bootci
and has the following components:
the number of bootstrap replications in the original call to fwb()
.
the observed value of the statistic on the same scale as the intervals (i.e., after applying h
and then hinv
.
the call to fwb.ci()
.
There will be additional components named after each confidence interval type requested. For "wald"
and "norm"
, this is a matrix with one row containing the confidence level and the two confidence interval limits. For the others, this is a matrix with one row containing the confidence level, the indices of the two order statistics used in the calculations, and the confidence interval limits.
an fwb
object; the output of a call to fwb()
.
the desired confidence level. Default is .95 for 95% confidence intervals.
the type of confidence interval desired. Allowable options include "wald"
(Wald interval), "norm"
(normal approximation), "basic"
(basic interval), "perc"
(percentile interval), "bc"
(bias-correct percentile interval), and "bca"
(BCa interval). More than one is allowed. Can also be "all"
to request all of them. BCa intervals require that the number of bootstrap replications is larger than the sample size.
the index of the position of the quantity of interest in fwb.out$t0
if more than one was specified in fwb()
. Only one value is allowed at a time. By default the first statistic is used.
a function defining a transformation. The intervals are calculated on the scale of h(t)
and the inverse function hinv
applied to the resulting intervals. It must be a function of one variable only and for a vector argument, it must return a vector of the same length. Default is the identity function.
a function, like h
, which returns the inverse of h
. It is used to transform the intervals calculated on the scale of h(t)
back to the original scale. The default is the identity function. If h
is supplied but hinv
is not, then the intervals returned will be on the transformed scale.
ignored
an fwbci
object; the output of a call to fwb.ci()
.
print(fwbci)
: Print a bootstrap confidence interval
fwb.ci()
functions similarly to boot::boot.ci()
in that it takes in a bootstrapped object and computes confidence intervals. This interface is a bit old-fashioned, but was designed to mimic that of boot.ci()
. For a more modern interface, see summary.fwb()
.
The bootstrap intervals are defined as follows, with \(\alpha =\) 1 - conf
, \(t_0\) the estimate in the original sample, \(\hat{t}\) the average of the bootstrap estimates, \(s_t\) the standard deviation of the bootstrap estimates, \(t^{(i)}\) the set of ordered estimates with \(i\) corresponding to their quantile, and \(z_\frac{\alpha}{2}\) and \(z_{1-\frac{\alpha}{2}}\) the upper and lower critical \(z\) scores.
"wald"
$$\left[t_0 + s_t z_\frac{\alpha}{2}, t_0 + s_t z_{1-\frac{\alpha}{2}}\right]$$ This method is valid when the statistic is normally distributed around the estimate.
"norm"
(normal approximation)$$\left[2t_0 - \hat{t} + s_t z_\frac{\alpha}{2}, 2t_0 - \hat{t} + s_t z_{1-\frac{\alpha}{2}}\right]$$
This involves subtracting the "bias" (\(\hat{t} - t_0\)) from the estimate \(t_0\) and using a standard Wald-type confidence interval. This method is valid when the statistic is normally distributed.
"basic"
$$\left[2t_0 - t^{(1-\frac{\alpha}{2})}, 2t_0 - t^{(\frac{\alpha}{2})}\right]$$
"perc"
(percentile confidence interval)$$\left[t^{(\frac{\alpha}{2})}, t^{(1-\frac{\alpha}{2})}\right]$$
"bc"
(bias-corrected percentile confidence interval)$$\left[t^{(l)}, t^{(u)}\right]$$
\(l = \Phi\left(2z_0 + z_\frac{\alpha}{2}\right)\), \(u = \Phi\left(2z_0 + z_{1-\frac{\alpha}{2}}\right)\), where \(\Phi(.)\) is the normal cumulative density function (i.e., pnorm()
) and \(z_0 = \Phi^{-1}(q)\) where \(q\) is the proportion of bootstrap estimates less than the original estimate \(t_0\). This is similar to the percentile confidence interval but changes the specific quantiles of the bootstrap estimates to use, correcting for bias in the original estimate. It is described in Xu et al. (2020). When \(t^0\) is the median of the bootstrap distribution, the "perc"
and "bc"
intervals coincide.
"bca"
(bias-corrected and accelerated confidence interval)$$\left[t^{(l)}, t^{(u)}\right]$$
\(l = \Phi\left(z_0 + \frac{z_0 + z_\frac{\alpha}{2}}{1-a(z_0+z_\frac{\alpha}{2})}\right)\), \(u = \Phi\left(z_0 + \frac{z_0 + z_{1-\frac{\alpha}{2}}}{1-a(z_0+z_{1-\frac{\alpha}{2}})}\right)\), using the same definitions as above, but with the additional acceleration parameter \(a\), where \(a = \frac{1}{6}\frac{\sum{L^3}}{(\sum{L^2})^{3/2}}\). \(L\) is the empirical influence value of each unit, which is computed using the regression method described in boot::empinf()
. When \(a=0\), the "bca"
and "bc"
intervals coincide. The acceleration parameter corrects for bias and skewness in the statistic. It can only be used when clusters are absent and the number of bootstrap replications is larger than the sample size. Note that BCa intervals cannot be requested when simple = TRUE
and there is randomness in the statistic
supplied to fwb()
.
Interpolation on the normal quantile scale is used when a non-integer order statistic is required, as in boot::boot.ci()
. Note that unlike with boot::boot.ci()
, studentized confidence intervals (type = "stud"
) are not allowed.
fwb()
for performing the fractional weighted bootstrap; get_ci()
for extracting confidence intervals from an fwbci
object; summary.fwb()
for producing clean output from fwb()
that includes confidence intervals calculated by fwb.ci()
; boot::boot.ci()
for computing confidence intervals from the traditional bootstrap; vcovFWB()
for computing parameter estimate covariance matrices using the fractional weighted bootstrap
set.seed(123, "L'Ecuyer-CMRG")
data("infert")
fit_fun <- function(data, w) {
fit <- glm(case ~ spontaneous + induced, data = data,
family = "quasibinomial", weights = w)
coef(fit)
}
fwb_out <- fwb(infert, fit_fun, R = 199,
verbose = FALSE)
# Bias corrected percentile interval
bcci <- fwb.ci(fwb_out, index = "spontaneous",
type = "bc")
bcci
# Using `get_ci()` to extract confidence limits
get_ci(bcci)
# Interval calculated on original (log odds) scale,
# then transformed by exponentiation to be on OR
fwb.ci(fwb_out, index = "induced", type = "norm",
hinv = exp)
Run the code above in your browser using DataLab