quasi_bin_pi | R Documentation |
quasi_bin_pi()
calculates bootstrap calibrated prediction intervals for binomial
data with constant overdispersion (quasi-binomial assumption).
quasi_bin_pi(
histdat,
newdat = NULL,
newsize = NULL,
alternative = "both",
alpha = 0.05,
nboot = 10000,
delta_min = 0.01,
delta_max = 10,
tolerance = 0.001,
traceplot = TRUE,
n_bisec = 30,
algorithm = "MS22mod"
)
histdat |
a |
newdat |
a |
newsize |
a vector containing the future cluster sizes |
alternative |
either "both", "upper" or "lower". |
alpha |
defines the level of confidence (1-alpha) |
nboot |
number of bootstraps |
delta_min |
lower start value for bisection |
delta_max |
upper start value for bisection |
tolerance |
tolerance for the coverage probability in the bisection |
traceplot |
if |
n_bisec |
maximal number of bisection steps |
algorithm |
either "MS22" or "MS22mod" (see details) |
This function returns bootstrap-calibrated prediction intervals as well as lower or upper prediction limits.
If algorithm
is set to "MS22", both limits of the prediction interval
are calibrated simultaneously using the algorithm described in Menssen and
Schaarschmidt (2022), section 3.2.4. The calibrated prediction interval is given
as
[l,u]_m = n^*_m \hat{\pi} \pm q^{calib} \hat{se}(Y_m - y^*_m)
where
\hat{se}(Y_m - y^*_m) = \sqrt{\hat{\phi} n^*_m \hat{\pi} (1- \hat{\pi}) +
\frac{\hat{\phi} n^{*2}_m \hat{\pi} (1- \hat{\pi})}{\sum_h n_h}}
with n^*_m
as the number of experimental units in the future clusters,
\hat{\pi}
as the estimate for the binomial proportion obtained from the
historical data, q^{calib}
as the bootstrap-calibrated coefficient,
\hat{\phi}
as the estimate for the dispersion parameter
and n_h
as the number of experimental units per historical cluster.
If algorithm
is set to "MS22mod", both limits of the prediction interval
are calibrated independently from each other. The resulting prediction interval
is given by
[l,u] = \Big[n^*_m \hat{\pi} - q^{calib}_l \hat{se}(Y_m - y^*_m), \quad
n^*_m \hat{\pi} + q^{calib}_u \hat{se}(Y_m - y^*_m) \Big]
Please note, that this modification does not affect the calibration procedure, if only prediction limits are of interest.
quasi_bin_pi
returns an object of class c("predint", "quasiBinomialPI")
with prediction intervals or limits in the first entry ($prediction
).
Menssen and Schaarschmidt (2019): Prediction intervals for overdispersed binomial
data with application to historical controls. Statistics in Medicine.
\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/sim.8124")}
Menssen and Schaarschmidt (2022): Prediction intervals for all of M future
observations based on linear random effects models. Statistica Neerlandica,
\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/stan.12260")}
# Pointwise prediction interval
pred_int <- quasi_bin_pi(histdat=mortality_HCD, newsize=40, nboot=100)
summary(pred_int)
# Pointwise upper prediction limit
pred_u <- quasi_bin_pi(histdat=mortality_HCD, newsize=40, alternative="upper", nboot=100)
summary(pred_u)
# Please note that nboot was set to 100 in order to decrease computing time
# of the example. For a valid analysis set nboot=10000.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.