Sorry to bother you at this time and I really need your help now. I am trying to combing multiple imputations with cox proportional hazard model and luckily read your paper and find your smcfcs package in r. However, when I import my data use your example coding similar formula. Error appears and I dont know how to deal with.
The code I type in r was:
cox<- read_xlsx("Cox.xlsx") ##read the dataset
names(cox)=c("t","d","a","b","c") ##name all the columns in the dataset
cox<-cox %>% drop_na(t) ##drop all lines where t is NA
cox<-cox%>%drop_na(d) ##drop all lines where d is NA
imps <- smcfcs(cox, smtype="coxph", smformula="Surv(t,d)~'a' + 'b'+'c'", method = c("","","norm", "norm","norm"),predictorMatrix = NULL, m = 10, numit = 100)
t is my censoring or event time and are all numeric values like this
3.52
1.60
2.30
1.63
12.53
9.92
4.87
and d is 0 or 1 which is whether the event happened
The error appeared was:
Error in Surv(originaldata[, timeCol], originaldata[, dCol]) : Time variable is not numeric
I don't know why this happening since all my time values are already numeric. Could you please give me some advice or suggestions that I can try to do something with it. I will so appreciated if you have any hints about this situation.
Hi
Sorry to bother you at this time and I really need your help now. I am trying to combing multiple imputations with cox proportional hazard model and luckily read your paper and find your smcfcs package in r. However, when I import my data use your example coding similar formula. Error appears and I dont know how to deal with.
The code I type in r was:
cox<- read_xlsx("Cox.xlsx") ##read the dataset names(cox)=c("t","d","a","b","c") ##name all the columns in the dataset cox<-cox %>% drop_na(t) ##drop all lines where t is NA cox<-cox%>%drop_na(d) ##drop all lines where d is NA
imps <- smcfcs(cox, smtype="coxph", smformula="Surv(t,d)~'a' + 'b'+'c'", method = c("","","norm", "norm","norm"),predictorMatrix = NULL, m = 10, numit = 100)
t is my censoring or event time and are all numeric values like this 3.52 1.60 2.30 1.63 12.53 9.92 4.87 and d is 0 or 1 which is whether the event happened
The error appeared was:
Error in Surv(originaldata[, timeCol], originaldata[, dCol]) : Time variable is not numeric
I don't know why this happening since all my time values are already numeric. Could you please give me some advice or suggestions that I can try to do something with it. I will so appreciated if you have any hints about this situation.
Best wishes, kaixin