truncreg {oneinfl} | R Documentation |
Truncated Regression Model
Description
Fits a positive Poisson (PP) or zero-truncated negative binomial (ZTNB) regression model.
Usage
truncreg(formula, df, dist = "negbin", start = NULL, method = "BFGS")
Arguments
formula |
A symbolic description of the model to be fitted. |
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 |
Details
This function fits a regression model for zero-truncated counts. Zero-truncated models are used when the count data does not include zeros, such as in cases where only positive counts are observed.
The function supports two distributions: - '"Poisson"': Zero-truncated Poisson regression. - '"negbin"': Zero-truncated negative binomial regression.
The function uses numerical optimization via optim
to estimate the parameters.
Value
An object of class '"truncmodel"' containing the following components:
beta
Estimated coefficients for the regression model.
alpha
Dispersion parameter (only for negative binomial distribution).
vc
Variance-covariance matrix of the estimated parameters.
logl
Log-likelihood of the fitted model.
dist
The distribution used for the model ("Poisson" or "negbin").
formula
The formula used for the model.
See Also
summary
for summarizing the fitted model.
Examples
# Example usage
df <- data.frame(x = rnorm(100), y = rpois(100, lambda = 1) + 1)
model <- truncreg(y ~ x, df = df, dist = "Poisson")
summary(model)