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.
Arguments
- fwb.out
an
fwbobject; the output of a call tofwb().- conf
the desired confidence level. Default is .95 for 95% confidence intervals.
- type
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.- index
the index of the position of the quantity of interest in
fwb.out$t0if more than one was specified infwb(). Only one value is allowed at a time. By default the first statistic is used.- h
a function defining a transformation. The intervals are calculated on the scale of
h(t)and the inverse functionhinvapplied 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.- hinv
a function, like
h, which returns the inverse ofh. It is used to transform the intervals calculated on the scale ofh(t)back to the original scale. The default is the identity function. Ifhis supplied buthinvis not, then the intervals returned will be on the transformed scale.- ...
ignored
- x
an
fwbciobject; the output of a call tofwb.ci().
Value
An fwbci object, which inherits from bootci and has the following components:
- R
the number of bootstrap replications in the original call to
fwb().- t0
the observed value of the statistic on the same scale as the intervals (i.e., after applying
hand thenhinv.- call
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.
Details
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 whensimple = TRUEand there is randomness in thestatisticsupplied tofwb().
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.
See also
fwb()for performing the fractional weighted bootstrapget_ci()for extracting confidence intervals from anfwbciobjectsummary.fwb()for producing clean output fromfwb()that includes confidence intervals calculated byfwb.ci()boot::boot.ci()for computing confidence intervals from the traditional bootstrapvcovFWB()for computing parameter estimate covariance matrices using the fractional weighted bootstrap
Examples
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
#> BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
#> Based on 199 bootstrap replicates
#>
#> CALL :
#> fwb.ci(fwb.out = fwb_out, type = "bc", index = "spontaneous")
#>
#> Intervals :
#>
#> Level BC Percentile
#> 95% (0.745, 1.638)
#>
#> Calculations and Intervals on Original Scale
#> Some bias-corrected percentile intervals may be unstable
# Using `get_ci()` to extract confidence limits
get_ci(bcci)
#> $bc
#> L U
#> 0.7453669 1.6378339
#>
#> attr(,"conf")
#> [1] 0.95
# 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)
#> BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
#> Based on 199 bootstrap replicates
#>
#> CALL :
#> fwb.ci(fwb.out = fwb_out, type = "norm", index = "induced", hinv = exp)
#>
#> Intervals :
#>
#> Level Normal
#> 95% (1.029, 2.232)
#>
#> Calculations on Original Scale but Intervals Transformed