1

I'm trying to use the survival package in R to run a log rank test on median survival rates - is that possible? I'm using the code:

survdiff(surv(Age, Survival) ~ Treatment, data = GBM)

where Age = age at diagnosis; Survival = is how many years they survived; Treatment = is whether they received treatment (coded as 1 or 2)

If this is right, why am I getting the error:

Error in survdiff.fit(y, groups, strata.keep, rho) : 
  There is only 1 group
In addition: Warning message:
In Surv(GBM$Age, GBM$Survival) : Invalid status value, converted to NA

Does Treatment need to coded as 0 or 1 instead of 1 or 2?

4

1 回答 1

0

pkg:survival中没有surv函数。是Surv

?Surv

协变量编码为 0/1 还是 1/2 无关紧要。该估计将描述取决于一个单位差异的风险比率。如果你想设置Surv调用来处理年龄和持续时间,那么事件时间应该是年龄+生存。当然,您将需要一个事件指示器。

于 2013-11-24T06:29:30.167 回答