lasso_select | R Documentation |
Constructing predictive or prognostic model
lasso_select(
x,
y,
type = c("binary", "survival"),
nfold = 10,
lambda = c("lambda.min", "lambda.1se")
)
x |
input matrix.Row names should be features like gene symbols or cgi, colnames be samples |
y |
response variable. can be binary and survival type. |
type |
"binary" or "survival" |
nfold |
number of 'nfold' for cross-validation - default is 10 |
lambda |
"lambda.min" or "lambda.1se" |
Dongqiang Zeng
data("crc_clin")
data("tcga_crc_exp")
dat <- t(tcga_crc_exp)
dat <- data.frame(patient = str_sub(rownames(dat), 1, 12), dat)
dat <- merge(crc_clin, dat, by = "patient")
dat <- dat[dat$OS_time > 0, ]
x <- t(dat[, -c(1:3)])
mad <- apply(x, 1, mad)
x <- x[mad > 0.5, ]
y <- Surv(dat$OS_time, dat$OS)
pd1 <- as.numeric(dat[, "PDCD1"])
group <- ifelse(pd1 > mean(pd1), 1, 0)
sur_gene <- lasso_select(x = x, y = y, type = "survival", nfold = 10, lambda = "lambda.min")
pd1_gene <- lasso_select(x = x, y = group, type = "binary", nfold = 10, lambda = "lambda.min")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.