Learn R Programming

ncvreg (version 3.4-0)

cv.ncvsurv: Cross-validation for ncvsurv

Description

Performs k-fold cross validation for MCP- or SCAD-penalized survival models over a grid of values for the regularization parameter lambda.

Usage

cv.ncvsurv(X, y, ..., nfolds=10, seed, trace=FALSE, events.only=TRUE)

Arguments

X
The design matrix, as in ncvsurv.
y
The response matrix, as in ncvsurv.
...
Additional arguments to ncvsurv.
nfolds
The number of cross-validation folds. Default is 10.
seed
You may set the seed of the random number generator in order to obtain reproducible results.
trace
If set to TRUE, cv.ncvsurv will inform the user of its progress by announcing the beginning of each CV fold. Default is FALSE.
events.only
Evaluate cross-validation loss on event times only? The default is TRUE. If set to FALSE, out-of-sample partial likelihood deviance is computed for the censored observations as well.

Value

  • An object with S3 class "cv.ncvsurv" inheriting from "cv.ncvreg" and containing:
  • cveThe error for each value of lambda, averaged across the cross-validation folds.
  • cvseThe estimated standard error associated with each value of for cve.
  • lambdaThe sequence of regularization parameter values along which the cross-validation error was calculated.
  • fitThe fitted ncvsurv object for the whole data.
  • minThe index of lambda corresponding to lambda.min.
  • lambda.minThe value of lambda with the minimum cross-validation error.
  • null.devThe cross-validated deviance for the first model along the grid of lambda (i.e., the cross-validated deviance for max(lambda), unless you have supplied your own lambda sequence, in which case this quantity is probably not meaningful). Although the actual null deviance can be calculated, it cannot be compared with the cross-validated deviance due to the manner in which deviance must be calculated for Cox regression models (see details).

Details

The function calls ncvsurv nfolds times, each time leaving out 1/nfolds of the data. Because of the semiparametric nature of Cox regression, cross-validation is not clearly defined. cv.ncvsurv uses the approach proposed by Verweij and van Houwelingen (see references), in which the contribution to the deviance from observation i comes from subtracting the full-data-set partial likelihood from the leave-one-out partial likelihood.

References

  • Breheny P and Huang J. (2011) Coordinate descentalgorithms for nonconvex penalized regression, with applications to biological feature selection.Annals of Applied Statistics,5: 232-253.myweb.uiowa.edu/pbreheny/publications/Breheny2011.pdf
  • Verweij PJ and van Houwelingen HC. (1993) Cross-validation in survival analysis.Statistics in Medicine,12: 2305-2314.

See Also

ncvsurv, plot.cv.ncvreg, summary.cv.ncvreg

Examples

Run this code
data(Lung)
X <- Lung$X
y <- Lung$y

cvfit <- cv.ncvsurv(X, y)
summary(cvfit)
plot(cvfit)
plot(cvfit, type="rsq")

Run the code above in your browser using DataLab