Computes the predicted frequencies for a specified model, given the observed data and
maximum count value. This function supports models estimated using oneinfl
or truncreg.
pred(model, df, maxpred)A numeric vector of predicted frequencies for count values from 1 to maxpred.
A fitted model object, either a one-inflated model (class `"oneinflmodel"`) or a truncated model (class `"truncmodel"`).
A data frame containing the variables used in the model.
Optional. The maximum count value for which predictions are generated.
Defaults to the maximum observed count in df.
The function computes predicted frequencies based on the type of model and its distribution:
PP (Poisson, zero-truncated): Computes predictions for a zero-truncated Poisson model.
ZTNB (Negative Binomial, zero-truncated): Computes predictions for a zero-truncated negative binomial model.
OIPP (Poisson, one-inflated): Computes predictions for a one-inflated Poisson model.
OIZTNB (Negative Binomial, one-inflated, zero-truncated): Computes predictions for a one-inflated, zero-truncated negative binomial model.
The predictions are generated for count values from 1 to maxpred. For one-inflated
models, the predictions account for the one-inflation probabilities.
This is an internal function primarily used by oneplot for visualization purposes.
oneplot for visualizing observed and predicted frequencies.
oneinfl for fitting one-inflated models.
truncreg for fitting zero-truncated models.