[R] Question About Markov Models

Lorenzo Isella lorenzo.isella at gmail.com
Sun Sep 1 16:36:13 CEST 2013


Dear All,
I am a bit struggling with the many packages for Markov models available  
in R.
Apologies for now posting a code snippet, but I am looking for some  
guidance here.
Please consider a set like the one below (which you can get with

data<-read.csv('http://dl.dropboxusercontent.com/u/5685598/data_table.csv')      
).

    ID      therapy   age1 age2 EFS
   7308   ormo_lunga   78   84  73
   7308   ormo_medio   78   84  73
   7308   ormo_lunga   78   84  73
   4902 chemio_lunga   46   56 120
   4902   ormo_lunga   46   56 120
   4902   ormo_lunga   46   56 120
   4902   ormo_breve   46   56 120
   4902 chemio_lunga   46   56 120
   4902   ormo_breve   46   56 120
   5299   ormo_lunga   61   70 100
   5299   ormo_breve   61   70 100
   5299 chemio_breve   61   70 100
   5299 chemio_lunga   61   70 100
   5926   ormo_lunga   66   67   3
   5926   ormo_lunga   66   67   3
   5926   ormo_breve   66   67   3
   5926   ormo_medio   66   67   3
   5926 chemio_lunga   66   67   3
   5926   ormo_breve   66   67   3
   5374   ormo_lunga   39   59 242
   5374   ormo_lunga   39   59 242
   5374   ormo_lunga   39   59 242
   4912   ormo_medio   40   50 124
   4912 chemio_lunga   40   50 124
   4912 chemio_lunga   40   50 124
   4912   ormo_breve   40   50 124
   4912 chemio_lunga   40   50 124
   4532   ormo_breve   61   63  26
   4532   ormo_breve   61   63  26
   4532 chemio_lunga   61   63  26

I have a list of (short) series of states identified by the ID of the  
patient who undergoes several therapies.
I then have other info about each patient (for instance its age when the  
disease was first detected and so on).
The point is to calculate the transition matrix for the sequence of  
therapies undergone by the patients and then possibly use the  
complementary information available for the patients.
The purpose is not so much to understand whether the patient will be alive  
or dead (this info is not available for all the patients after its last  
therapy), but to try to guess the next therapy one is likely to undergo at  
some stage using a Markovian model.
Let us assume that all patients are given the i-th therapy cycle at the  
same time.
I did some experiments with the mcm package  
(http://cran.r-project.org/web/packages/msm/index.html), but I am banging  
a bit my head against the wall.
In general, I do not have a death state and time does not play a  
particular role here (I could say that the i-th therapy is given at time  
i, but this is arbitrary). Later on this may change, though, a time  
sequence may be introduced for the therapies of each patient (varying from  
patient to patient).
Any suggestion is appreciated.
Cheers

Lorenzo



More information about the R-help mailing list