histdat: a data.frame with two columns (number of successes and number of failures) containing the historical data
newdat: a data.frame with two columns (number of successes and number of failures) containing the future data
newsize: a vector containing the future cluster sizes
alternative: either "both", "upper" or "lower". alternative
specifies if a prediction interval or an upper or a lower prediction limit should be computed
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 TRUE: Plot for visualization of the bisection process
n_bisec: maximal number of bisection steps
algorithm: either "MS22" or "MS22mod" (see details)
Returns
beta_bin_pi returns an object of class c("predint", "betaBinomialPI")
with prediction intervals or limits in the first entry ($prediction).
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
with nm∗ as the number of experimental units in the future clusters, π^ as the estimate for the binomial proportion obtained from the historical data, qcalib as the bootstrap-calibrated coefficient, ρ^ as the estimate for the intra class correlation (Lui et al. 2000) and nh 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
Please note, that this modification does not affect the calibration procedure, if only prediction limits are of interest.
Examples
# Prediction intervalpred_int <- beta_bin_pi(histdat=mortality_HCD, newsize=40, nboot=100)summary(pred_int)# Upper prediction boundpred_u <- beta_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.
References
Lui et al. (2000): Confidence intervals for the risk ratio under cluster sampling based on the beta-binomial model. Statistics in Medicine.
Menssen and Schaarschmidt (2022): Prediction intervals for all of M future observations based on linear random effects models. Statistica Neerlandica. tools:::Rd_expr_doi("10.1111/stan.12260")