Skip to contents

Performs Lasso-penalized Cox regression for variable selection in survival analysis.

Usage

lassocox(
  data,
  elapsedtime,
  outcome,
  outcomeLevel,
  explanatory,
  lambda = "lambda.1se",
  nfolds = 10,
  standardize = TRUE,
  cv_plot = TRUE,
  coef_plot = TRUE,
  survival_plot = TRUE
)

Arguments

data

The data as a data frame.

elapsedtime

The numeric variable representing follow-up time until the event or last observation.

outcome

The outcome variable. Typically indicates event status (e.g., death, recurrence).

outcomeLevel

The level of outcome considered as the event.

explanatory

Variables to be considered for selection in the Lasso-Cox regression.

lambda

Method for selecting the optimal lambda parameter from cross-validation.

nfolds

Number of folds for cross-validation.

standardize

Whether to standardize predictor variables before fitting.

cv_plot

Whether to show the cross-validation plot.

coef_plot

Whether to show the coefficient path plot.

survival_plot

Whether to show survival curves by risk groups.

Value

A results object containing:

results$todoa html
results$modelSummarya table
results$coefficientsa table
results$performancea table
results$cv_plotan image
results$coef_plotan image
results$survival_plotan image
results$riskScorean output

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$modelSummary$asDF

as.data.frame(results$modelSummary)

Examples

# \donttest{
# example will be added
# }