0
$\begingroup$

I am confused with the structure of recurrent data that can be used with recurrent models. I know that in order to use the recurrent data models(Anderson-Gill (AG), Frailty , Wei, Lin and Weissfeld (WLW), and Prentice, Williams and Peterson models (PWP)) we need first to put our dataset in specific format such that we can feed it to the selected model.

Raw dataset

I have a medical dataset that describe the annually attendance of patients to do specific test T. So for example patient A has several records that explain how many times he did the T test. In other words, take a look for sample below:

ID VisitD Ttest event
A   2000   27    0
A   2001   26    0
A   2003   23    1
A   2006   25    1 

Anderson-Gill (AG)

So let us take the AG model as an example. I know that in order to useAG model we need our data to be in the following format

 ID   Start   End   Event

to use them in coxph, for example, in survival package in R as

 fit <- coxph(Surv(start, end, event)~T+cluster(ID), data=tst)

Question

So for above sample how do I convert my data to AG dataset structure. I am thinking to do the interval by subtracting 1 from each year so for above example patient A start his first visit in 1999 to 2000 and from 2000 to 2001 and so on, such that I will end up with the following dataset for the previous dataset example.

ID  start   end   Ttest event
A   1999    2000   27    0
A   2000    2001   26    0
A   2002    2003   23    1
A   2005    2006   25    1 

Do you think I am wrong with my thinking, if so what do you think I have to do to convert my data to specific dataset structure.

Many thanks in advance

$\endgroup$
1
$\begingroup$

I think you data set should look like this in the end:

ID  start   end   Ttest event
A   1999    2000   27    0
A   2000    2001   26    0
A   2001    2003   23    1
A   2003    2006   25    1 

As you last knew that the test value for patient A was 26 between 2001 and 2002. You can though also use your initial data.frame but then individual A is only at risk between 2000 to 2001 and 2002 to 2003 when you estimate the model with coxph. I figure it comes down to whether or not you observe failures for patient A between 2001 and 2002.

You can get a data.frame as I suggest above using the tmerge function in the survival package. See ?tmerge and the vignette referenced in the help page.

$\endgroup$
  • $\begingroup$ @ Benjamin Christoffersen : thanks for your reply, I will check your suggestion and let you know what I get. Thanks again $\endgroup$ – Abdal Oct 17 '17 at 1:41
  • $\begingroup$ Glad to help, if this answer solved your problem please mark it as accepted by clicking the check mark next to the answer. $\endgroup$ – Benjamin Christoffersen Nov 19 '17 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.