pred {oneinfl} | R Documentation |
Generate Predicted Frequencies for Models
Description
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
.
Usage
pred(model, df, maxpred)
Arguments
model |
A fitted model object, either a one-inflated model (class '"oneinflmodel"') or a truncated model (class '"truncmodel"'). |
df |
A data frame containing the variables used in the model. |
maxpred |
Optional. The maximum count value for which predictions are generated.
Defaults to the maximum observed count in |
Details
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.
Value
A numeric vector of predicted frequencies for count values from 1 to maxpred
.
See Also
oneplot
for visualizing observed and predicted frequencies.
oneinfl
for fitting one-inflated models.
truncreg
for fitting zero-truncated models.