predict.oneinflmodel: Predicted Expected Response for One-Inflated or Truncated...

View source: R/predict-oneinfl.R

predict.oneinflmodelR Documentation

Predicted Expected Response for One-Inflated or Truncated Models

Description

Calculates the predicted expected response for a model fitted using oneinfl or truncreg.

Usage

## S3 method for class 'oneinflmodel'
predict(object, ...)

Arguments

object

An object of class oneinflmodel

...

Additional argument df, a data frame used to calculate the expected value of the response variable.

Details

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.

Value

A numeric vector of predicted expected responses for the observations in df.

See Also

oneinfl for fitting one-inflated models. E_pois, E_negbin, for the expected value calculations.

Examples

# 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)


oneinfl documentation built on April 4, 2025, 12:05 a.m.