[英]R: glmnet - cox error
I am running a coxph model using glmnet. 我正在使用glmnet运行coxph模型。 The following is the code that I am using:
以下是我使用的代码:
data <- read.csv("CSM Tiers by Org.csv", stringsAsFactors = FALSE, na.strings = "?")
x <- model.matrix(~ data$CSM + data$Exclude + data$Queue)
y <- data$Time
status <- data$Event
glmnet(x,Surv(y,status), family = "cox")
However, I am getting the following error: 但是,我收到以下错误:
Error in coxnet(x, is.sparse, ix, jx, y, weights, offset, alpha, nobs, :
negative event times encountered; not permitted for Cox family
But I dont see any negative event times in my data. 但我在数据中没有看到任何负面事件时间。
> sum(y<0)
[1] 0
Any help is greatly appreciated! 任何帮助是极大的赞赏!
Check if sum(y<=0). 检查是否总和(y <= 0)。 The code in the function says it will return that error if y's equal 0 as well.
函数中的代码表示,如果y等于0,它将返回该错误。
Code is here, error you're referencing is on line 5: https://github.com/jeffwong/glmnet/blob/master/R/coxnet.R 代码在这里,您引用的错误在第5行: https : //github.com/jeffwong/glmnet/blob/master/R/coxnet.R
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.