Fit zero-inflated regression models for count data via penalized maximum likelihood.
zipath_fit(X, Z, Y, weights, offsetx, offsetz, standardize=TRUE,
intercept = TRUE, family = c("poisson", "negbin", "geometric"),
link = c("logit", "probit", "cloglog", "cauchit", "log"),
penalty = c("enet", "mnet", "snet"), start = NULL, y = TRUE,
x = FALSE, nlambda=100, lambda.count=NULL, lambda.zero=NULL,
type.path=c("active", "nonactive"), penalty.factor.count=NULL,
penalty.factor.zero=NULL, lambda.count.min.ratio=.0001,
lambda.zero.min.ratio=.1, alpha.count=1, alpha.zero=alpha.count,
gamma.count=3, gamma.zero=gamma.count, rescale=FALSE,
init.theta=NULL, theta.fixed=FALSE, EM=TRUE, maxit.em=200,
convtype=c("count", "both"), maxit= 1000, maxit.theta =10,
reltol = 1e-5, thresh=1e-6, eps.bino=1e-5, shortlist=FALSE,
trace=FALSE, ...)
An object of class "zipath"
, i.e., a list with components including
a list with elements "count"
and "zero"
containing the coefficients from the respective models,
a vector of raw residuals (observed - fitted),
a vector of fitted means,
the case weights used,
a list with elements "count"
, "zero"
and
"full"
containing the terms objects for the respective models,
estimate of the additional \(\theta\) parameter of the negative binomial model (if a negative binomial regression is used),
log-likelihood of the fitted model,
character string describing the count distribution used,
character string describing the link of the zero-inflation model,
the inverse link function corresponding to link
,
logical value, TRUE indicating successful convergence of zipath
, FALSE indicating otherwise
the original function call
the original formula
levels of the categorical regressors
the full model frame (if model = TRUE
),
the response count vector (if y = TRUE
),
a list with elements "count"
and "zero"
containing the model matrices from the respective models
(if x = TRUE
),
predictor matrix of the count model
predictor matrix of the zero model
response variable
optional numeric vector of weights.
optional numeric vector with an a priori known component to be included in the linear predictor of the count model.
optional numeric vector with an a priori known component to be included in the linear predictor of the zero model.
Should intercept(s) be fitted (default=TRUE) or set to zero (FALSE)
Logical flag for x variable standardization, prior to
fitting the model sequence. The coefficients are always returned on
the original scale.
Default is standardize=TRUE
.
character specification of count model family (a log link is always used).
character specification of link function in the binary zero-inflation model (a binomial family is always used).
logicals. If TRUE
the corresponding response and model matrix are returned.
penalty considered as one of enet, mnet, snet
.
starting values for the parameters in the linear predictor.
number of lambda
value, default value is 100. The sequence may be truncated before nlambda
is reached if a close to saturated model for the zero component is fitted.
A user supplied lambda.count
sequence. Typical usage is to have the program compute its own lambda.count
and lambda.zero
sequence based on
nlambda
and lambda.min.ratio
.
A user supplied lambda.zero
sequence.
solution path with default value "active"
, which is less time computing than "nonactive"
. If type.path="nonactive"
, no active set for each element of the lambda sequence and cycle through all the predictor variables.
If type.path="active"
, then cycle through only the active set, then cycle through all the variables for the same penalty parameter. See details below.
These are numeric vectors with the same length as predictor variables. that multiply lambda.count, lambda.zero
, respectively, to allow differential shrinkage of coefficients. Can be 0 for some variables, which implies
no shrinkage, and that variable is always included in the
model. Default is same shrinkage for all variables.
Smallest value for lambda.count
and lambda.zero
, respectively, as a fraction of
lambda.max
, the (data derived) entry value (i.e. the smallest
value for which all coefficients are zero except the intercepts).
Note, there is a closed formula for lambda.max
for penalty="enet"
. If rescale=TRUE
, lambda.max
is the same for penalty="mnet" or "snet"
. Otherwise, some modifications are required. In the current implementation, for small gamma
value, the square root of the computed lambda.zero[1]
is used when penalty="mnet" or "snet"
.
The elastic net mixing parameter for the count part of model. The default value 1 implies no L_2 penalty, as in LASSO.
The elastic net mixing parameter for the zero part of model. The default value 1 implies no L_2 penalty, as in LASSO.
The tuning parameter of the snet
or mnet
penalty for the count part of model.
The tuning parameter of the snet
or mnet
penalty for the zero part of model.
logical value, if TRUE, adaptive rescaling
The initial value of theta
for family="negbin"
. This is set to NULL
since version 0.3-24.
Logical value only used for family="negbin"
. If TRUE
and init.theta
is provided with a numeric value > 0, then init.theta
is not updated.
If theta.fixed=FALSE
, then init.theta
will be updated. In this case, if init.theta=NULL
, its initial value is computed with intercept-only zero-inflated negbin model.
Using EM
algorithm. Not implemented otherwise
convergency type, default is for count component only for speedy computation
Maximum number of EM algorithm
Maximum number of coordinate descent algorithm
Maximum number of iterations for estimating theta
scaling parameter if family="negbin". Default value maxit.theta
may be increased, yet may slow the algorithm
a lower bound of probabilities to be claimed as zero, for computing weights and related values when family="binomial"
.
Convergence criteria, default value 1e-5 may be reduced to make more accurate yet slow
Convergence threshold for coordinate descent. Defaults value is 1e-6
.
logical value, if TRUE, limited results return
If TRUE
, progress of algorithm is reported
Other arguments which can be passed to glmreg
or glmregNB
Zhu Wang <zwang145@uthsc.edu>
The algorithm fits penalized zero-inflated count data regression models using the coordinate descent algorithm within the EM algorithm.
The returned fitted model object is of class "zipath"
and is similar
to fitted "glm"
and "zeroinfl"
objects. For elements such as "coefficients"
a list is returned with elements for the zero and count component,
respectively.
If type.path="active"
, the algorithm iterates for a pair (lambda_count, lambda_zero) in a loop:
Step 1: For initial coefficients start_count of the count model and start_zero of the zero model, the EM algorithm is iterated until convergence for the active set with non-zero coefficients determined from start_count and start_zero, respectively.
Step 2: EM is iterated for all the predict variables once.
Step 3: If active set obtained from Step 2 is the same as in Step 1, stop; otherwise, repeat Step 1 and Step 2.
If type.path="nonactive"
, the EM algorithm iterates for a pair (lambda_count, lambda_zero) with all the predict variables until convergence.
A set of standard extractor functions for fitted model objects is available for
objects of class "zipath"
, including methods to the generic functions
print
, coef
,
logLik
, residuals
,
predict
.
See predict.zipath
for more details on all methods.
The program may terminate with the following message:
Error in: while (j <= maxit.em && !converged)
{ :
Missing value, where TRUE/FALSE is necessary
Calls: zipath
Additionally: Warning:
In glmreg_fit(Znew, probi, weights = weights, standardize = standardize, :
saturated model, exiting ...
Execution halted
One possible reason is that the fitted model is too complex for the data. There are two suggestions to overcome the error. One is to reduce the number of variables. Second, find out what lambda values caused the problem and omit them. Try with other lambda values instead.
Zhu Wang, Shuangge Ma, Michael Zappitelli, Chirag Parikh, Ching-Yun Wang and Prasad Devarajan (2014) Penalized Count Data Regression with Application to Hospital Stay after Pediatric Cardiac Surgery, Statistical Methods in Medical Research. 2014 Apr 17. [Epub ahead of print]
Zhu Wang, Shuangge Ma, Ching-Yun Wang, Michael Zappitelli, Prasad Devarajan and Chirag R. Parikh (2014) EM for Regularized Zero Inflated Regression Models with Applications to Postoperative Morbidity after Cardiac Surgery in Children, Statistics in Medicine. 33(29):5192-208.
Zhu Wang, Shuangge Ma and Ching-Yun Wang (2015) Variable selection for zero-inflated and overdispersed data with application to health care demand in Germany, Biometrical Journal. 57(5):867-84.
zipath
,
glmreg
, glmregNB