quasi_pois_pi function

Prediction intervals for quasi-Poisson data

Prediction intervals for quasi-Poisson data

quasi_pois_pi() calculates bootstrap calibrated prediction intervals for Poisson data with constant overdispersion (quasi-Poisson).

quasi_pois_pi( histdat, newdat = NULL, newoffset = 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" )

Arguments

  • histdat: a data.frame with two columns. The first has to contain the historical observations. The second has to contain the number of experimental units per study (offsets).
  • newdat: a data.frame with two columns. The first has to contain the future observations. The second has to contain the number of experimental units per study (offsets).
  • newoffset: vector with future number of experimental units per historical study.
  • 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α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

quasi_pois_pi returns an object of class c("predint", "quasiPoissonPI")

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

[l,u]m=nmλ^±qcalibnmϕ^λ^+nm2ϕ^λ^hnh [l,u]_m = n^*_m \hat{\lambda} \pm q^{calib} \sqrt{n^*_m \hat{\phi} \hat{\lambda} +\frac{n^{*2}_m \hat{\phi} \hat{\lambda}}{\sum_h n_h}}

with nmn^*_m as the number of experimental units in the future clusters, λ^\hat{\lambda} as the estimate for the Poisson mean obtained from the historical data, qcalibq^{calib} as the bootstrap-calibrated coefficient, ϕ^\hat{\phi} as the estimate for the dispersion parameter and nhn_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]=[nmλ^qlcalibnmϕ^λ^+nm2ϕ^λ^hnh,\quadnmλ^+qucalibnmϕ^λ^+nm2ϕ^λ^hnh] [l,u] = \Big[n^*_m \hat{\lambda} - q^{calib}_l \sqrt{n^*_m \hat{\phi} \hat{\lambda} +\frac{n^{*2}_m \hat{\phi} \hat{\lambda}}{\sum_h n_h}}, \quadn^*_m \hat{\lambda} + q^{calib}_u \sqrt{n^*_m \hat{\phi} \hat{\lambda} +\frac{n^{*2}_m \hat{\phi} \hat{\lambda}}{\sum_h n_h}} \Big]

Please note, that this modification does not affect the calibration procedure, if only prediction limits are of interest.

Examples

#' # Historical data qp_dat1 # Future data qp_dat2 # Pointwise prediction interval pred_int <- quasi_pois_pi(histdat=ames_HCD, newoffset=3, nboot=100) summary(pred_int) # Pointwise upper prediction pred_u <- quasi_pois_pi(histdat=ames_HCD, newoffset=3, 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

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")

  • Maintainer: Max Menssen
  • License: GPL (>= 2)
  • Last published: 2024-03-04