Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • jm suite for joint analysis of longitudinal and survival data

    Dear Statalist,

    I want to do a Cox regression taking repeated measurements into account. I want to fit a model looking at survival in a group of patients having a certain chronic disease. Levels of anxiety are measured at two timepoints spaced 10 years apart, and I want to see whether change in the level of anxiety influences survival.

    My data are in long format:

    Code:
         +-----------------------------------------------+
         | id     PartDat   HADSAnxi   death     enddate |
         |-----------------------------------------------|
    101. | 51   24 May 96          0       1   15feb2008 |
    103. | 52   13 Jun 97          0       0   15jan2019 |
    105. | 53   29 Sep 95          0       0   15jan2019 |
    106. | 53   04 Jun 07          0       0   15jan2019 |
    107. | 54   08 Oct 96          0       0   15jan2019 |
         |-----------------------------------------------|
    109. | 55   17 Jan 96          0       0   15jan2019 |
    110. | 55   17 Aug 07          0       0   15jan2019 |
    111. | 56   28 Nov 95          0       0   15jan2019 |
    113. | 57   18 Dec 95          0       0   15jan2019 |
    115. | 58   24 May 96          0       1   15feb2007 |
         |-----------------------------------------------|
    119. | 60   23 Oct 95          0       0   15jan2019 |
    120. | 60   08 Oct 07          0       0   15jan2019 |
    122. | 61   24 Jun 08          0       .   15jun2018 |
    123. | 62   14 Feb 96          0       0   15jan2019 |
    125. | 63   08 Nov 96          0       0   15jan2019 |
         |-----------------------------------------------|
    126. | 63   31 May 07          0       0   15jan2019 |
    127. | 64   17 Jun 96          0       1   15mar2016 |
    129. | 65   06 Dec 95          0       0   15jan2019 |
    131. | 66   27 Feb 96          1       1   15mar1999 |
    133. | 67   18 Mar 97          0       0   15jan2019 |
         |-----------------------------------------------|
    134. | 67   08 Apr 08          0       0   15jan2019 |
    135. | 68   22 Nov 96          0       0   15jan2019 |
    136. | 68   04 Feb 08          0       0   15jan2019 |
    138. | 69   21 Nov 07          0       0   15jan2019 |
    140. | 70   11 Jun 07          1       0   15jan2019 |
         |-----------------------------------------------|
    145. | 73   20 May 96          0       0   15jan2019 |
    146. | 73   27 Feb 08          1       0   15jan2019 |
    147. | 74   16 Dec 96          0       0   15jan2019 |
    150. | 75   28 Aug 07          1       0   15jan2019 |
    151. | 76   04 Mar 96          0       1   15nov2015 |
         |-----------------------------------------------|
    153. | 77   13 Dec 95          0       0   15jan2019 |
    154. | 77   08 Feb 07          0       0   15jan2019 |
    157. | 79   10 Jun 96          0       0   15jan2019 |
    158. | 79   27 Apr 07          0       0   15jan2019 |
    159. | 80   13 Mar 96          0       0   15jan2019 |
         |-----------------------------------------------|
    160. | 80   08 Oct 07          0       0   15jan2019 |
    161. | 81   26 Mar 96          1       0   15jan2019 |
    162. | 81   22 Nov 07          1       0   15jan2019 |
    163. | 82   12 Sep 95          0       0   15jan2019 |
    164. | 82   29 Aug 07          1       0   15jan2019 |
         |-----------------------------------------------|
    165. | 83   20 Feb 97          0       0   15jan2019 |
    168. | 84   08 May 08          0       0   15jan2019 |
    169. | 85   16 Apr 96          1       0   15jan2019 |
    174. | 87   29 May 07          0       0   15jan2019 |
    176. | 88   10 Apr 08          0       0   15jan2019 |
         |-----------------------------------------------|
    177. | 89   04 Mar 96          0       1   15aug2013 |
    179. | 90   20 Jan 97          0       1   15apr2003 |
    181. | 91   14 Aug 96          1       1   15sep2015 |
    184. | 92   04 May 07          0       1   15jan2014 |
    185. | 93   27 Mar 96          0       0   15jan2019 |
         |-----------------------------------------------|
    186. | 93   08 Jan 07          0       0   15jan2019 |
    189. | 95   02 Oct 96          0       0   15jan2019 |
    190. | 95   15 Nov 06          0       0   15jan2019 |
    197. | 99   04 Mar 96          1       0   15jan2019 |
    198. | 99   26 Nov 07          0       0   15jan2019 |
         +-----------------------------------------------+
    Where PartDat is the dates of the two repeated measurements, HADSAnxi is a binary variable where 0 = no anxiety and 1 = anxiety, death is a binary variable where 1 = failure and enddate is the time variable.

    I used the user-written jm suite downloaded from http://www.stata.com/jmxtst, and created the syntax as described by Yulia Marchenko here: http://www.stata.com/meeting/nordic-..._marchenko.pdf.

    I use the syntax suggested for combined datasets (longitudinal and survival):

    Code:
    jmxtstset idvar timevar, xt(is xt)|st(is st) failure(failvar) stsetopts
    
    where is xt and is st should be binary variables identifying longitudinal and survival observations, respectively (according to the slides above).
    However, I get the following error code when trying to jmxtstset the data:

    Code:
    . jmxtstset id enddate, xt(HADSAnxi)|st(death) failure(death==1)
    variable death==1 not found
    Questions:
    1) Is it not possible to specify failure using a binary variable like you could do with -stset-?
    2) How should I specify is xt and is st?
    3) Are there any online manuals available for jm, even though it's a preliminary command suite?


  • #2
    I'd first try to see if you can do what you need with a Stata provided procedure. With user-written procedures, help depends on someone on the list who answers questions happening to use that procedure. As a last resort, try contacting the author.

    Comment


    • #3
      1) Is it not possible to specify failure using a binary variable like you could do with -stset-?
      While -help jmxtstset- suggest failure(failvar[==numlist]) can be used it seems you have to give the name of the binary variable (jmxtstset *! version 1.1.0 22jul2016 lines : 132–136):
      Code:
      cap confirm variable `failure'
      if _rc {
          di as err "variable `failure' not found"
          exit 111
      }
      2) How should I specify is xt and is st?
      3) Are there any online manuals available for jm, even though it's a preliminary command suite?
      See -help jmxtstset-, it may be easier to declare jmxtst data when survival and longitudinal data are separate, for example:
      Code:
      ********************************************************************************
      net install jmxtst , all replace from("http://www.stata.com/jmxtst")
      
      * -help jmxtstset-  
      
      * Declare jmxtst data when survival and longitudinal data are separate
      
      * Load survival data into memory
      
      use cd4_surv, clear
      
      * Declare jmxtst data by merging the longitudinal data
      
      jmxtstset subid survtime using cd4_long, st failure(status)
      
      list if subid==1
          
      * -help jmxtstcox-    
      * Fit a jmxtstcox model with different covariates
      
      jmxtstcox (_xt: lnCD4 treatment time) (_st:treatment) ,  nolog
      
      exit
      ********************************************************************************
      Code:
      . list if subid==1
      
            +--------------------------------------------------------------------------------------------------------+
            | subid   survtime   status   treatm~t       _xtst   _st   _d    _t   _t0   CD4   time       lnCD4   _xt |
            |--------------------------------------------------------------------------------------------------------|
         1. |     1        715        0          1   surv data     1    0   715     0     .      .           .    .a |
       602. |     1          .        .          1   long data    .a    .     .     .   194      8   5.2678582     1 |
       603. |     1          .        .          1   long data    .a    .     .     .   234     16   5.4553211     1 |
            +--------------------------------------------------------------------------------------------------------+

      Comment


      • #4
        Thank you for your advice, and sorry for the late reply. Bjarte Aagnes: your suggestion on separate data sets were really helpful, thank you.

        Comment


        • #5
          Dear Sigrid and others on this post, could any of you kindly tell me where/how to download the package of jmxtstset? My STATA 12.1 does not recognize this command. Many thanks!

          Comment


          • #6
            The program will probably not run on version 12.1 To install on Stata 13 or newer
            Code:
            net install jmxtst , all replace from("http://www.stata.com/jmxtst")

            Comment


            • #7
              Much much appreciated, Bjarte!!
              Last edited by Zhi Tang; 11 Aug 2020, 15:02.

              Comment

              Working...
              X