# Multiple imputation of time-varying dataset for Cox model in R

I've seen others searching for similar issues, but have not yet come across a example that explains how to actually do this:

I have a dataset with both time varying and non-time varying variables that I want to examine using an extended Cox model. Some of the observations have missing non-varying variables. All time-dependent variables are complete.

My dataset have a form like this:

t1 - t2 - surv - id - varying - nonvarying
1 -  2 -    1 -  1 -       2 -          1
2 -  3 -    1 -  1 -       1 -          1
3 -  4 -    0 -  1 -       2 -          1
1 -  2 -    1 -  2 -       5 -         NA
2 -  3 -    1 -  2 -       2 -         NA
3 -  4 -    0 -  2 -       1 -         NA


As you can see - if the nonvarying variable is missing, it's missing across all observations with the same ID. Although I don't know what the value of the missing variable is (because it's missing...), I know that it doesn't vary for all the observations with the same ID.

So far I've managed to make imputations of non-varying dataset using the MICE package in R. But I have not yet found a way of doing this with a dataset with time-dependent variables so that it takes into account that the non-varying variable that are imputed are in fact not varying across observations with the same ID.

In my searches I've come across this presentation that might address the problem: https://people.maths.bris.ac.uk/~mb13434/prst_talks/R_Keogh_160205_PrSt_Bristol.pdf

But I've still not figured how to solve this problem. And I'm not familiar with the suggested package in the presentation (smcfcs) - that means, I don't understand how to use that package to calculate MI that takes time-dependent and non-time dependent variables into account keeping the non-time dependent variable constant across observations of the same subject.

Anyone else got a clue about how to achieve this?

• I have the same question. Did you solve this? – sdaza Mar 24 '17 at 13:35