Hey guys, I am stuck here with this error message while running survival analysis in R:

> hcm.cox <- coxph(Surv(FU, MACE) ~ Fibrosis + MaxLVWT, data = hcm)
Error in coxph(Surv(FU, MACE) ~ Fibrosis + MaxLVWT, data = hcm) : 
  an id statement is required for multi-state models

FU stands for follow-up period (numeric) and MACE stands for events (factor; 1 = no, 2 = yes). Fibrosis is a binary factor (1 = -, 2 = +) and maxLVWT is a continuous numeric variable.

Before running the analysis, I've converted MACE and Fibrosis into binary factors by doing so:

> hcm$MACE <- factor(hcm$MACE, levels = c("N", "Y"), labels = c("1", "2"))
> hcm$Fibrosis <- factor(hcm$Fibrosis, levels = c("-", "+"), labels = c("1", "2"))

I can't understand why the error keeps popping up, please help me out!



Source link