fwb.ci {fwb} | R Documentation |
Fractional Weighted Bootstrap Confidence Intervals
Description
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.
Usage
fwb.ci(
fwb.out,
conf = 0.95,
type = "bc",
index = 1L,
h = base::identity,
hinv = base::identity,
...
)
## S3 method for class 'fwbci'
print(x, hinv = NULL, ...)
Arguments
fwb.out |
an |
conf |
the desired confidence level. Default is .95 for 95% confidence intervals. |
type |
the type of confidence interval desired. Allowable options include |
index |
the index of the position of the quantity of interest in |
h |
a function defining a transformation. The intervals are calculated on the scale of |
hinv |
a function, like |
... |
ignored |
x |
an |
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.
-
"norm"
(normal approximation):[2t_0 - \hat{t} + s_t z_\frac{\alpha}{2}, 2t_0 - \hat{t} + s_t z_{1-\frac{\alpha}{2}}]
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"
:[2t_0 - t^{(1-\frac{\alpha}{2})}, 2t_0 - t^{(\frac{\alpha}{2})}]
-
"perc"
(percentile confidence interval):[t^{(\frac{\alpha}{2})}, t^{(1-\frac{\alpha}{2})}]
-
"bc"
(bias-corrected percentile confidence interval):[t^{(l)}, t^{(u)}]
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):[t^{(l)}, t^{(u)}]
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()
. 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. When a=0
, the "bca"
and "bc"
intervals coincide.
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.
Value
An fwbci
object, which inherits from bootci
and has the following components:
R |
the number of bootstrap replications in the original call to |
t0 |
the observed value of the statistic on the same scale as the intervals (i.e., after applying |
call |
the call to |
There will be additional components named after each confidence interval type requested. For "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.
Functions
-
print(fwbci)
: Print a bootstrap confidence interval
See Also
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
Examples
set.seed(123)
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)