[英]Fitting time varying cox model in r
Please, I have been having some challenges trying to fit a time varying cox model. 拜托,我一直在尝试适应时变的考克斯模型。 Precisely I find it hard getting the same result after following examples I read about in which the survSplit command was used.
确切地说,在我阅读了使用了survSplit命令的示例后,我发现很难得到相同的结果。 I end up with one error or the other, here is an example and the error message.
我最终得到一个错误或另一个错误,这是一个示例和错误消息。
hip2=survSplit(Surv(Time,status)~Operation.Performed,
data=hip,cut=c(200,500,1000,1600),
end='Time',event='status',start="start")
Error in survSplit(Surv(Time, status) ~ Operation.Performed, data = hip, :
start time must be < stop time
Note: My data set initially has no column labelled start. 注意:我的数据集最初没有标记为start的列。 But I read it will be created by the command, I do not know if this is right?
但是我看到它会被命令创建,我不知道这是不对的?
Please, is there anything am not doing correctly to get the right result??? 拜托,有什么东西没能正确地得到正确的结果??? or better still is there a better way to implement the survSplit command?
或者更好的是有更好的方法来实现survSplit命令?
It's hard to say without seeing your data head(hip)
, but the error message states that you have the start and end times confused - you can see the message in the code in github here . 很难没有看到你的数据说
head(hip)
,但该错误消息指出您具有混淆的开始和结束时间-你可以在github上看到消息中的代码在这里 。 survSplit
Indeed creates a start time if you don't have one and calls it "tstart"
by default. 如果没有,则确实会创建一个开始时间,默认情况下将其
survSplit
为"tstart"
。 Unless you use an old version of the package, don't use the event
And start
Arguments as they are deprecated and for legacy use alone. 除非您使用旧版本的软件包,否则请不要使用
event
并start
参数,因为它们已被弃用,仅供传统使用。 Give a name to the episode
for use in the co ph model as an interaction, and you should be OK. 给
episode
命名以在合作模型中用作交互,你应该没问题 。
hip2 <- survSplit(Surv(Time, status) ~., data=hip, cut=c(200,500,1000,1600),episode="tgroup")
model.coxph <- coxph(Surv(tstart, Time, status) ~ Operation.Performed:strata(tgroup), data=hip2)
And that should do it. 这应该做到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.