3
$\begingroup$

I am trying to estimate a multi-state model and am following the setup in the book by Mills (2011). The research units can go through different states a, b, c, and d. The research units can move between any of the four states in either direction. My problem is how to set up my data to do so.

I initially started out with the dataset in this format:

ID   year   state   v1   v2  
1    2000   a  
1    2001   a  
1    2003   b  
2    1990   a  
2    1995   a  

In Mills book on page 206, the suggested format is however:

ID   from   to   trans   Tstart   Tstop   time   status   v1   v2    

where from to show all possible movements between states, trans a sequence of transition per id, Tstart and Tstop and Time are the time variables, status indicates whether one experienced a state or not (censored) and v1,v2 are covariates.

I am doubting how I should set the data frame up, since in my case there are many movements between states in various directions. I started out with adding a column to my original data, so that I have data of type "SPELL" as it is referred to in the Traminer manual. However, by doing so and changing it to a say STS format, I also loose my covariates to which I need to hold on for the multi-state model.

EDIT: In sum, how do I go from the format above to the format required by the mstate package?

$\endgroup$
5
  • 1
    $\begingroup$ This question appears to be off-topic because it is about how to do something in Traminer, not about Statistics. $\endgroup$ Nov 16 '13 at 2:22
  • $\begingroup$ Thank you for your response. The basic question is how to get one's data in the right format to do run a multi-state model. It's like asking for the constant column, when you want to run a multi-level model in MLwiN. $\endgroup$
    – Richard
    Nov 16 '13 at 6:56
  • 1
    $\begingroup$ The solution is given at stats.stackexchange.com/questions/37526/… $\endgroup$
    – Gilbert
    Nov 16 '13 at 7:50
  • $\begingroup$ Cheers. I'm afraid I have overlooked that post. It solves how to add covariates to the data in say STS or SPS format. But the question that remains: how do you go from there (STS or SPS format) to the format required by the mstate package? (Or how do you go directly from the format my data's in to the the format required by the mstate package?) $\endgroup$
    – Richard
    Nov 17 '13 at 15:00
  • $\begingroup$ I dont think this question is specifically about TraMineR, but about the mstate package or R in general. $\endgroup$ Nov 18 '13 at 8:52

Your Answer

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

Browse other questions tagged or ask your own question.