View source: R/add_probs_negbin.R
add_probs.negbin | R Documentation |
This is the method add_probs
uses if the model fit is an
object of class negbin
. Probabilities are determined through
simulation, using the same method as add_pi.negbin
.
## S3 method for class 'negbin'
add_probs(
df,
fit,
q,
name = NULL,
yhatName = "pred",
comparison = "<",
nSims = 2000,
...
)
df |
A data frame of new data. |
fit |
An object of class |
q |
A double. A quantile of the response distribution. |
name |
|
yhatName |
A string. Name of the vector of predictions. |
comparison |
A character vector of length one. Permitted
arguments are |
nSims |
A positive integer. Controls the number of simulated draws. |
... |
Additional arguments. |
A dataframe, df
, with predicted values and
probabilities attached.
add_ci.negbin
for confidence intervals for
negbin
objects, add_pi.negbin
for prediction
intervals of negbin
objects, and
add_quantile.negbin
for response quantiles 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_probs(df, fit, q = 50)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.