Entering edit mode
20 months ago
prithvi.mastermind
▴
50
I'm interested in creating a gene signature model for testing on an independent dataset using LASSO. I have used the LASSO code but not able to interpret the results properly. Can anyone please suggest if I have used the correct code for gene signature correction.
My data is available here: LASSO32.txt
My code
##Load libraries###
require(tidyverse)
require(glmnet)
require(survival)
library(rio)
##Load data###
coxdata <- read.delim("LASSO_32.txt", header = TRUE)
x = data.matrix(coxdata[,2:33])
y <- data.matrix(coxdata[,34:35])
cv.out = cv.glmnet(x, y, alpha = 1, family = 'cox')
plot(cv.out)
bestlam = cv.out$lambda.min
coef(cv.out, s = bestlam)
coxlasso <- glmnet(
x = x,
y = y,
alpha = 1, family = 'cox')
plot(coxlasso)
out = glmnet(x, y, alpha = 1, lambda = bestlam, family = 'cox')
lasso_coef = predict(out, type = "coefficients", s = bestlam)[1:32,]
lasso_coef
lasso_coef[lasso_coef != 0]
plot(lasso_coef)
Hi. Did you find the answer for your question. Can you share your picture of your data. What variable you put in y.