# [R] mstate with multiple initial states?

Lucy Leigh lucy.leigh at newcastle.edu.au
Tue Jan 10 05:46:40 CET 2017

```Hi,

I have a multi-state model that I would like to estimate using the 'mstate' package - but I am not sure how best to approach it and was wondering

if anyone could provide some insight for me.

Basically, I have a group of kids who have been randomized to one of 2 treatments, A or B. If they do well on either of these, they

are discharged (A -->D or B--> D). If they do poorly, kids who were receiving treatment A are moved onto treatment B (A-->B), but kids

on B can't go to A, they go straight into ICU (A-->C). If the kids who went from A-->B do well they are discharged (A-->B-->D), and if they

do poorly they go to ICU (A-->B-->C), and then finally after ICU they are discharged (C-->D). There are also a small number of kids who were sent

straight to ICU (so...in fact there are 3 initial states). So the transition matrix looks like:

A      B     C      D

A   NA   1    NA   1

B  NA   NA   1     1

C  NA   NA   NA  1

D  NA   NA  NA  NA

However, I am not sure whether I can do this in 'mstate', as there are three initial states? The program requires that we start with

a wide data set, in which  there is an event indicator for each state, and a time of entry into each state. If they don't enter a state, then

the time for that state is set to last follow-up (page 4 of https://www.jstatsoft.org/article/view/v038i07 ).

So, in the case where a kid starts in A, and goes to D; the data would look like:

A.status  A.time    B.status   B.time   C.Status   C.Time  D.Status  D.time

1             0                0         Final           0            Final         1          Final

And I think this is OK in terms of what is specified for B, because technically the kid is at risk of transitioning into B

until they are discharged.

But what about a kid who starts in B and goes to D? The corresponding data would possibly be?:

A.status  A.time    B.status   B.time   C.Status   C.Time  D.Status  D.time

0       Final            1       0                 0            Final         1          Final

However, this to me doesn't look right, as technically they are never at risk of going to A if they started in B.

I tried setting the A.time to 0 to reflect the fact that they are never at risk of going back to A, but the numbers I got

from the model  (events\$model) were incorrect - basically all the events were going to A, and no one was in B.

And for the kids that started in C...similarly.

So, I was wondering, would it be valid to create a new initial state (e.g. P = pre-treatment), from which the child

then transitions immediately (at say, time  = 0.1) to either A or B (or C). So the matrix would be:

P      A      B     C      D

P   NA   1      1      1     NA

A  NA   NA    1    NA    1

B  NA   NA   NA    1     1

C  NA   NA   NA  NA    1

D  NA   NA  NA  NA   NA

And then the data for someone who went from A--D would be

A.status  A.time        B.status   B.time   C.Status   C.Time  D.Status  D.time

1             0.1                0        0.1             0            Final         1          Final

And then the data for someone who went from B--D would be

A.status  A.time      B.status   B.time          C.Status   C.Time  D.Status  D.time

0      0.1             1                 0 .1                0            Final         1          Final

When I code the model like this, then the number of events I get from the model is correct.

However, I am not sure whether adding this extra initial state is a valid option?

Thanks in advance for anyone who can help me out,

Lucy Leigh

mstate: An R Package for the Analysis of Competing Risks ...<https://www.jstatsoft.org/article/view/v038i07>
www.jstatsoft.org
Authors: Liesbeth C. de Wreede, Marta Fiocco, Hein Putter: Title: mstate: An R Package for the Analysis of Competing Risks and Multi-State Models

[[alternative HTML version deleted]]

```