简体   繁体   English

cv.glmnet() 的 glment 错误

[英]glment error with cv.glmnet()

when I analyse my data with this code(glment Rpackage), met this error:当我用这段代码(glment Rpackage)分析我的数据时,遇到了这个错误:

lasso_fit <- cv.glmnet(x, y, family='cox', type.measure = 'deviance') Error in response.coxnet(y): negative event times encountered; lasso_fit <- cv.glmnet(x, y, family='cox', type.measure = 'deviance') response.coxnet(y) 中的错误:遇到负事件时间; not permitted for Cox family考克斯家族不允许

this is my code这是我的代码

x <- as.matrix(survival_cancer[,gsub(resSigAll@rownames, pattern = '-', replacement = '_')])
y <- survival_cancer[,c('overall_survival', 'censoring_status')]
names(y) <- c('time', 'status')
y$time <- as.double(y$time)
y$status <- as.double(y$status)
y <- as.matrix(survival::Surv(y$time, y$status))
lasso_fit <- cv.glmnet(x, y, family='cox', type.measure = 'deviance')

the data type of x x 的数据类型

         gene1 gene2 gene3 gene4 gene5 gene6 gene7 gene8 gene9 gene10 gene11 
sample1
sample2
sample3
sample4
sample5
sample6
sample7
sample
sample

the type of y: y 的类型:

 time  status
 100      0
  90      1

I don't konw where is the problem?我不知道问题出在哪里?

The error message is referenced from line#5 of coxnet function written at https://github.com/jeffwong/glmnet/blob/master/R/coxnet.R .该错误消息引用自 coxnet function 的第 5 行,该行写于https://github.com/jeffwong/glmnet/blob/master/R/coxnet.ZE1E1D3D405731287D9EE6Z44

Kindly check if the summation of your time outcome variable is less than 0 or if the vector itself has entries = 0.请检查您的时间结果变量的总和是否小于 0,或者向量本身是否有条目 = 0。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM