lasso_select: Constructing predictive or prognostic model

View source: R/lasso_select.R

lasso_selectR Documentation

Constructing predictive or prognostic model

Description

Constructing predictive or prognostic model

Usage

lasso_select(
  x,
  y,
  type = c("binary", "survival"),
  nfold = 10,
  lambda = c("lambda.min", "lambda.1se")
)

Arguments

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"

Author(s)

Dongqiang Zeng

Examples


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")

IOBR/IOBR documentation built on May 5, 2024, 2:34 p.m.