Description Usage Arguments Details Value See Also Examples
View source: R/add_pi_negbin.R
This function is one of the methods for add_pi
, and is
called automatically when add_pi
is used on a fit
of
class negbin
.
1 2 3 4 5 6 7 8 9 10 |
df |
A data frame of new data. |
fit |
An object of class |
alpha |
A real number between 0 and 1. Controls the confidence level of the interval estimates. |
names |
|
yhatName |
A string. Name of the predictions vector. |
nSims |
A positive integer. Determines the number of simulations to run. |
... |
Additional arguments. |
Prediction intervals for negative binomial fits are formed through a two part simulation scheme:
1. Model coefficients are generated through a parametric bootstrap procedure that simulates the uncertainty in the regression coefficients.
2. Random draws from the negative binomial distribution are taken with a mean that varies based on the model coefficients determined in step (1) and over-dispersion parameter that is taken from the original fitted model.
Quantiles of the simulated responses are taken at the end to produce intervals of the desired level.
A dataframe, df
, with predicted values, upper and lower
prediction bounds attached.
add_ci.negbin
for confidence intervals for
negbin
objects, add_probs.negbin
for conditional
probabilities of negbin
objects, and
add_quantile.negbin
for response quantiles of
negbin
objects.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.