This function is one of the methods of add_quantile
.
# S3 method for negbin
add_quantile(df, fit, p, name = NULL, yhatName = "pred", nSims = 2000, ...)
A data frame of new data.
An object of class negbin
. Predictions are made with
this object.
A real number between 0 and 1. Sets the probability level of the quantiles.
NULL
or a string. If NULL
,
quantiles automatically will be named by add_quantile
,
otherwise, they will be named name
.
A string. Name of the vector of predictions.
A positive integer. Set the number of simulated draws to use.
Additional arguments.
A dataframe, df
, with predicted values and level
p quantiles attached.
Quantiles of Negative Binomial linear models are determined by
add_quantile
through a simulation using arm::sim
.
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.
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab