cv.zipath_fit: Cross-validation for zipath

cv.zipath_fitR Documentation

Cross-validation for zipath

Description

Internal function k-fold cross-validation for zipath, produces a plot, and returns cross-validated log-likelihood values for lambda

Usage

cv.zipath_fit(X, Z, Y, weights, offsetx, offsetz, nlambda=100, lambda.count=NULL,
              lambda.zero=NULL, nfolds=10, foldid, plot.it=TRUE, se=TRUE, 
              n.cores=2, trace=FALSE, parallel=FALSE, ...)

Arguments

X

predictor matrix of the count model

Z

predictor matrix of the zero model

Y

response variable

weights

optional numeric vector of weights.

offsetx

optional numeric vector with an a priori known component to be included in the linear predictor of the count model.

offsetz

optional numeric vector with an a priori known component to be included in the linear predictor of the zero model.

nlambda

number of lambda value, default value is 10.

lambda.count

Optional user-supplied lambda.count sequence; default is NULL

lambda.zero

Optional user-supplied lambda.zero sequence; default is NULL

nfolds

number of folds >=3, default is 10

foldid

an optional vector of values between 1 and nfold identifying what fold each observation is in. If supplied, nfold can be missing and will be ignored.

plot.it

a logical value, to plot the estimated log-likelihood values if TRUE.

se

a logical value, to plot with standard errors.

n.cores

The number of CPU cores to use. The cross-validation loop will attempt to send different CV folds off to different cores.

trace

a logical value, print progress of cross-validation or not

parallel

a logical value, parallel computing or not

...

Other arguments that can be passed to zipath.

Details

The function runs 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.

Value

an object of class "cv.zipath" is returned, which is a list with the components of the cross-validation fit.

fit

a fitted zipath object for the full data.

residmat

matrix for cross-validated log-likelihood at each (count.lambda, zero.lambda) sequence

bic

matrix of BIC values with row values for lambda and column values for kth cross-validation

cv

The mean cross-validated log-likelihood - a vector of length length(count.lambda).

cv.error

estimate of standard error of cv.

foldid

an optional vector of values between 1 and nfold identifying what fold each observation is in.

lambda.which

index of (count.lambda, zero.lambda) that gives maximum cv.

lambda.optim

value of (count.lambda, zero.lambda) that gives maximum cv.

Author(s)

Zhu Wang <zwang145@uthsc.edu>

References

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.

See Also

zipath and plot, predict, and coef methods for "cv.zipath" object.


mpath documentation built on Jan. 7, 2023, 1:17 a.m.