cvl_tramnet {tramnet} | R Documentation |
"tramnet"
modelsk-fold cross validation for "tramnet"
objects over a grid of
the tuning parameters based on out-of-sample log-likelihood.
cvl_tramnet(object, fold = 2, lambda = 0, alpha = 0, folds = NULL, fit_opt = FALSE)
object |
object of class |
fold |
number of folds for cross validation |
lambda |
values for lambda to iterate over |
alpha |
values for alpha to iterate over |
folds |
manually specify folds for comparison with other methods |
fit_opt |
If |
Returns out-of-sample logLik and coefficient estimates for
corresponding folds and values of the hyperparameters as an object of
class "cvl_tramnet"
Lucas Kook
set.seed(241068) library(survival) data("GBSG2", package = "TH.data") X <- 1 * matrix(GBSG2$horTh == "yes", ncol = 1) colnames(X) <- "horThyes" GBSG2$surv <- with(GBSG2, Surv(time, cens)) m <- Coxph(surv ~ 1, data = GBSG2, log_first = TRUE) mt <- tramnet(model = m, x = X, lambda = 0, alpha = 0) mc <- Coxph(surv ~ horTh, data = GBSG2) cvl_tramnet(mt, fold = 2, lambda = c(0, 1), alpha = c(0, 1))