lambda
cv.zipath(formula, data, weights, nlambda=100, lambda.count=NULL, lambda.zero=NULL,
nfolds=10, foldid, plot.it=TRUE, se=TRUE, trace=FALSE,...)
## S3 method for class 'cv.zipath':
coef(object, which=object$lambda.which, model = c("full", "count", "zero"), ...)
model.frame
.lambda
value, default value is 10.NULL
NULL
nfold
identifying what fold each observation is in. If supplied,
nfold
can be missing and will be ignored.TRUE
.TRUE
, shows cross-validation progresszipath
.cv.zipath
.lambda.count
and lambda.zero
at which
estimates are extracted. By default, the one which generates the optimal cross-validation value."cv.zipath"
is returned, which is a
list with the components of the cross-validation fit.(count.lambda, zero.lambda)
sequencelambda
and column values for k
th cross-validationnlambda
. nlambda
is the same as the argument if any one of (count.lambda, zero.lambda)
is missing; otherwise nlambda=length(count.lambda)
length(count.lambda)
.cv
.nfold
identifying what fold each observation is in.(count.lambda, zero.lambda)
that gives maximum cv
.(count.lambda, zero.lambda)
that gives maximum cv
.zipath
nfolds
+1 times; the
first to compute the (lambda.count, lambda.zero)
sequence, and then to
compute the fit with each of the folds omitted. The log-likelihood value is
accumulated, and the average value and standard deviation over the
folds is computed. Note that cv.zipath
can be used to search for
values for count.alpha
or zero.alpha
: it is required to call cv.zipath
with a fixed vector foldid
for different values of count.alpha
or zero.alpha
.The method for coef
by default
return a single vector of coefficients, i.e., all coefficients are concatenated. By setting the model
argument, the estimates for the corresponding model components can be extracted.
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
and plot
, predict
, and coef
methods for "cv.zipath"
object.data("bioChemists", package = "pscl")
fm_zip <- cv.zipath(art ~ . | ., data = bioChemists, family = "poisson", nlambda=10)
coef(fm_zip)
### prediction from the best model
fm_zip_predict <- predict(object=fm_zip$fit, which=fm_zip$lambda.which, type="response",
model=c("full"))
fm_znb <- cv.zipath(art ~ . | ., data = bioChemists, family = "negbin", nlambda=10)
coef(fm_znb)
Run the code above in your browser using DataLab