Closed JackoBill closed 2 years ago
I read some more and a similar problem seem to concern survival curves: https://stats.stackexchange.com/questions/323310/survival-curve-for-cox-regression-of-multiple-imputated-data. It says that 'basically this can't be done directly because the multiply imputed fit is different from a single fit as presented in a normal Cox model'.
So, maybe I'm asking for a solution that does not exist. I had already considered making a grid of BMIs, thinking every point as a parameter and then combining them. I guess I will pursue that direction.
I'm working with an incomplete survival data which I impute using
Hmisc::aregImpute
and then combine inferences usingHmisc::fit.mult.impute
. The latter one returns object of classcoxph
which raised my hopes of comfortable use ofpredict.coxph
function but seems not to be the case:Error in predict.coxph(fit_spline, newdata, se = T) : Data is not the same size as it was in the original fit
occurs.My ultimate aim is to plot hazard ratio against BMI similar way like here and
termplot
gave me this error. However, the problem has nothing to do with splines (one could have bmi as itself in the model and error would occur anyway).I guess this isn't a real failure of
predict.coxph
(why would two random functions work together nicely?) but I hope there is something to be done.