nb_pi {predint} | R Documentation |
Simple uncalibrated prediction intervals for negative-binomial data
Description
nb_pi()
is a helper function that is internally called by neg_bin_pi()
. It
calculates simple uncalibrated prediction intervals for negative-binomial data
with offsets.
Usage
nb_pi(
newoffset,
histoffset,
lambda,
kappa,
q = qnorm(1 - 0.05/2),
alternative = "both",
newdat = NULL,
histdat = NULL,
algorithm = NULL
)
Arguments
newoffset |
number of experimental units in the future clusters |
histoffset |
number of experimental units in the historical clusters |
lambda |
overall Poisson mean |
kappa |
dispersion parameter |
q |
quantile used for interval calculation |
alternative |
either "both", "upper" or "lower".
|
newdat |
additional argument to specify the current data set |
histdat |
additional argument to specify the historical data set |
algorithm |
used to define the algorithm for calibration if called via
|
Details
This function returns a simple uncalibrated prediction interval
[l,u]_m = n^*_m \hat{\lambda} \pm q \sqrt{n^*_m
\frac{\hat{\lambda} + \hat{\kappa} \bar{n} \hat{\lambda}}{\bar{n} H} +
(n^*_m \hat{\lambda} + \hat{\kappa} n^{*2}_m \hat{\lambda}^2)
}
with n^*_m
as the number of experimental units in m=1, 2, ... , M
future clusters,
\hat{\lambda}
as the estimate for the Poisson mean obtained from the
historical data, \hat{\kappa}
as the estimate for the dispersion parameter,
n_h
as the number of experimental units per historical cluster and
\bar{n}=\sum_h^{n_h} n_h / H
.
The direct application of this uncalibrated prediction interval to real life data
is not recommended. Please use the neg_bin_pi()
function for real life applications.
Value
np_pi
returns an object of class c("predint", "negativeBinomialPI")
.
Examples
# Prediction interval
nb_pred <- nb_pi(newoffset=3, lambda=3, kappa=0.04, histoffset=1:9, q=qnorm(1-0.05/2))
summary(nb_pred)