View source: R/predict-oneinfl.R
predict.oneinflmodel | R Documentation |
Calculates the predicted expected response for a model fitted using
oneinfl
or truncreg
.
## S3 method for class 'oneinflmodel'
predict(object, ...)
object |
An object of class |
... |
Additional argument |
This function computes the expected response based on the fitted model. The computation
differs depending on the distribution. For Poisson (OIPP)
, predicted values are
computed using E_pois
. For Negative Binomial (OIZTNB)
, predicted
values are computed using E_negbin
.
A numeric vector of predicted expected responses for the observations in df
.
oneinfl
for fitting one-inflated models.
E_pois
, E_negbin
, for the expected value calculations.
# Example usage
df <- data.frame(x = rnorm(100), z = rnorm(100), y = rpois(100, lambda = 5))
model <- oneinfl(y ~ x | z, df = df, dist = "Poisson")
predict(model, df = df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.