coxph "an id statement is required for multi-state models" error
Entering edit mode
2.9 years ago
jnmcluo • 0

hi everyone, it keeps show me a error when I use "survival" package coxph() for multivariate survival analysis : Error in coxph(Surv(days_to_last_followup, fustat) ~ NRG3 + FSTL5 + ASTN2 + : an id statement is required for multi-state models .

my input data is:

id    days_to_last_followup    fustat     NRG3 FSTL5 ASTN2

TCGA-3L-AA1B                   154  Alive   WT    WT    WT

TCGA-4N-A93T                     8  Alive   WT    WT    WT

TCGA-4T-AA8H                   160  Alive   WT    WT    WT

TCGA-5M-AAT4                     0   Dead   WT    WT    WT

and when i provide id for the coxph method:cox <- coxph(Surv(days_to_last_followup, fustat)~NRG3+FSTL5+ASTN2+MROH2B+ZNF43+COL4A4+AXIN2+SMARCA4+ADAM12+SYNE1+THSD7B, data =multiCox.input ,id =id) , there are no errors show up but I can't see gene names in cox result:

 coef exp(coef) se(coef) robust se      z Pr(>|z|)  
1   0.29929   1.34890  0.80904   0.67471  0.444    0.657  
2   0.03079   1.03127  0.57015   0.40335  0.076    0.939  
3  -0.21452   0.80693  0.49745   0.39913 -0.537    0.591  
4  -0.16062   0.85161  0.67287   0.64364 -0.250    0.803  
5   0.31424   1.36922  0.81711   0.65210  0.482    0.630

what's wrong in my steps? thanks

cox survival • 20k views
Entering edit mode
2.9 years ago
MatthewP ★ 1.2k

Hey, no need to specific id , try to convert Alive/Dead to int 1/2. I don't think days_to_last_followup is survival time. See this post

Entering edit mode

Thanks a lot! convert the state to 1,2 does fix the problem! and yes It's always not clear for me how to set the proper survival time for TCGA data. I used to do it like: clinicalData %>% mutate(futime=ifelse(fustat=="Alive",days_to_last_followup,days_to_death)) and then use futime as censored time, but I found that days_to_last_followup could give out a better result. I checked out the links you provided, but still not completely understand the concept. So could you show me some simple lines about how to do this? many thanks.

Entering edit mode

Hey I am stuck with the same error and I can't seem to understand why it's happening. I've posted the issue here and if anyone could help me out, it would be much appreciated!!!!

Entering edit mode

check this. You should change the type of vector that contains your event data. If your vector is a factor, recoding from Dead/Alive into 1/2 is not going to work. You need to specify the type of vector as.numeric.


Login before adding your answer.

Traffic: 2161 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6