| lasso_pro | R Documentation |
Fits a Cox proportional hazards model regularized by the Lasso (L1) penalty. Uses cross-validation to select the optimal lambda.
lasso_pro(X, y_surv, tune = FALSE)
X |
A data frame of predictors. |
y_surv |
A |
tune |
Logical. If TRUE, performs internal tuning (currently handled by cv.glmnet automatically). |
An object of class survival_glmnet and pro_model.
library(survival)
# Create dummy data
set.seed(123)
df <- data.frame(time = rexp(50), status = sample(0:1, 50, replace=TRUE),
var1 = rnorm(50), var2 = rnorm(50))
y <- Surv(df$time, df$status)
x <- df[, c("var1", "var2")]
model <- lasso_pro(x, y)
print(class(model))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.