jwb133 / smcfcs

R package implementing Substantive Model Compatible Fully Conditional Specification Multiple Imputation
11 stars 7 forks source link

smcfcs with coxph event indicator #20

Closed jwb133 closed 2 years ago

jwb133 commented 2 years ago

I think I've found a small problem with the "smcfcs" package in R (version 1.6.0) when using coxph regression. In the "survival" package the coxph() function handles both 0/1 event indicators and 1/2 indicators equally. But, the smcfcs() function with 'smtype = "coxph"' does not. When using 1/2 indicators smcfcs() still performs the calculations, but it gives incorrect results. The documentation mentions that when using 'smtype = "compet"' the events should be coded as 0/1/... with 0 for censoring. But it doesn't say that's required for 'smtype = "coxph"'. Perhaps a warning or error could be added to smcfcs() to detect if 1/2 indicators are used?

jwb133 commented 2 years ago

Added a check for coxph for this, and added detailed to smcfcs documentation telling users what is expected.