| oneinfl | R Documentation |
Fits a one-inflated positive Poisson (OIPP) or one-inflated zero-truncated negative binomial (OIZTNB) regression model.
oneinfl(formula, df, dist = "negbin", start = NULL, method = "BFGS")
formula |
A symbolic description of the model to be fitted. Variables before the pipe '|' link to the usual Poisson rate parameter, after the pipe link to the one-inflation parameter. |
df |
A data frame containing the variables in the model. |
dist |
A character string specifying the distribution to use. Options are '"Poisson"' or '"negbin"'. |
start |
Optional. A numeric vector of starting values for the optimization process. Defaults to 'NULL', in which case starting values are attempted to be chosen automatically. |
method |
A character string specifying the optimization method to be passed to |
This function fits a regression model for one-inflated counts. One-inflated models are used when there are an excess number of ones, relative to a Poisson or negative binomial process.
The function supports two distributions: - '"Poisson"': One-inflated Poisson regression. - '"negbin"': One-inflated negative binomial regression.
The function uses numerical optimization via optim to estimate the parameters.
An object of class '"oneinflmodel"' containing the following components:
betaEstimated coefficients for the rate component of the model.
gammaEstimated coefficients for the one-inflation component of the model.
alphaDispersion parameter (only for negative binomial distribution).
vcVariance-covariance matrix of the estimated parameters.
loglLog-likelihood of the fitted model.
avgwAverage one-inflation probability.
abswMean absolute one-inflation probability.
distThe distribution used for the model ("Poisson" or "negbin").
formulaThe formula used for the model.
summary for summarizing the fitted model.
margins for calculating the marginal effects of regressors.
oneWald to test for no one-inflation.
signifWald for testing the joint significance of a single regressor that appears before and after the pipe '|'.
oneplot for plotting actual and predicted counts.
predict for expected response/dependent variable at each observation.
truncreg for fitting positive Poisson (PP) and zero-truncated negative binomial (ZTNB) models.
oneLRT to test for no one-inflation or no overdispersion using a nested PP, OIPP, or ZTNB model.
# Example usage
df <- data.frame(x = rnorm(100), z = rnorm(100), y = rpois(100, lambda = 1) + 1)
model <- oneinfl(y ~ x | z, df = df, dist = "Poisson")
summary(model)
margins(model, df)
oneWald(model)
predict(model, df=df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.