Description Usage Arguments Details Value Examples
Negative binomial models (NB2) with non-constant theta.
1 2 3 4 5 6 7 |
formula |
a formula expression of syntax |
data |
an optional data frame containing the variables occurring in the formulas. |
subset |
an optional vector specifying a subset of observations to be used for fitting. |
na.action |
a function which indicates what should happen when the data
contain |
model |
logical. If |
x, y |
for |
z |
a design matrix with regressors for the scale. |
... |
arguments to be used to form the default |
control, maxit, start |
a list of control parameters passed to |
grad |
logical. Should gradients be used for optimization? If |
hessian |
logical or character. Should a numeric approximation of the
(negative) Hessian matrix be computed? Either |
enbin fits negative binomial regression models with optionally covariate-dependent theta
using analytical gradient based maximum likelihood estimation
y* ~ N(mu, theta)
,
The mean mu and scale theta are linked to two linear predictors
log(mu) = x'b
log(theta) = z'g
.
enbin_fit is the actual workhorse, where the fitting takes place.
A set of standard extractor functions for fitted model objects is available for
objects of class "enbin", including methods to the generic functions
print, summary, coef,
vcov, logLik, residuals,
predict, terms,
model.frame, model.matrix, update,
estfun and bread (from the sandwich package),
and
getSummary (from the memisc package, enabling mtable).
See predict.enbin and coef.enbin for more details
on some methods with non-standard arguments.
enbin returns an object of class "enbin", i.e., a list with components as follows.
enbin_fit returns an unclassed list with components up to df.
coefficients |
a list with elements |
counts |
count of function and gradient evaluations from |
convergence |
convergence code from |
message |
optional further information from |
vcov |
covariance matrix of all parameters in the model, |
residuals |
a vector of raw residuals (observed - fitted), |
fitted.values |
a list with elements |
method |
the method argument passed to the |
nobs |
number of observations, |
df |
number of estimated parameters, |
call |
the original function call, |
formula |
the original formula, |
terms |
a list with elements |
levels |
a list with elements |
contrasts |
a list with elements |
model |
the full model frame (if |
y |
the numeric response vector (if |
x |
a list with elements |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## data on alcohol and tobacco expenditures in Belgian households
data("RecreationDemand", package = "AER")
## model comparison of negative binomial (NB2) model with constant vs. non-constant theta
m1 <- enbin(trips ~ . - income, data = RecreationDemand)
m2 <- enbin(trips~ . - income | . - income, data = RecreationDemand)
## comparison of the two models
AIC(m1, m2)
BIC(m1, m2)
## comparison with glm.nb
if(require("MASS")) {
c1 <- glm.nb(trips ~ . - income, data = RecreationDemand)
summary(c1)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.