add_quantile.negbin {ciTools}  R Documentation 
This function is one of the methods of add_quantile
.
## S3 method for class 'negbin'
add_quantile(df, fit, p, name = NULL, yhatName = "pred", nSims = 2000, ...)
df 
A data frame of new data. 
fit 
An object of class 
p 
A real number between 0 and 1. Sets the probability level of the quantiles. 
name 

yhatName 
A string. Name of the vector of predictions. 
nSims 
A positive integer. Set the number of simulated draws to use. 
... 
Additional arguments. 
Quantiles of Negative Binomial linear models are determined by
add_quantile
through a simulation using arm::sim
.
A dataframe, df
, with predicted values and level
p quantiles attached.
add_ci.negbin
for confidence intervals for
negbin
objects, add_pi.negbin
for prediction
intervals of negbin
objects, and add_probs.negbin
for response probabilities of negbin
objects.
x1 < rnorm(100, mean = 1)
y < MASS::rnegbin(n = 100, mu = exp(1 + x1), theta = 5)
df < data.frame(x1 = x1, y = y)
fit < MASS::glm.nb(y ~ x1, data = df)
add_quantile(df, fit, p = 0.3)