Dear All,
I have weekly data on the last year of life of a sample of decedents (all die in week 52, which differs in calendar time). Each week, patients may experience 4 different types of treatments (T1, T2, T3 AND T4). I am interested in evaluating whether the treatments/ cumulative treatments receiving in the last year of life (cum_T1, cum_T2, cum_T3 and cum_T4) predict deaths. Total_T is the cumulative sum of all prior treatments in any given week. Here is my dataex:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long case_number byte week float yw byte(T1 T2 T3) float(T4 cum_T1 cum_T2 cum_T3 cum_T4 total_T dead) byte age float male byte(White Black Hispanic)
100064  1 2550 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064  2 2551 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064  3 2552 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064  4 2553 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064  5 2554 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064  6 2555 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064  7 2556 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064  8 2557 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064  9 2558 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 10 2559 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 11 2560 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 12 2561 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 13 2562 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 14 2563 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 15 2564 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 16 2565 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 17 2566 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 18 2567 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 19 2568 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 20 2569 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 21 2570 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 22 2571 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 23 2572 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 24 2573 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 25 2574 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 26 2575 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 27 2576 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 28 2577 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 29 2578 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 30 2579 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 31 2580 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 32 2581 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 33 2582 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 34 2583 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 35 2584 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 36 2585 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 37 2586 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 38 2587 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 39 2588 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 40 2589 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 41 2590 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 42 2591 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 43 2592 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 44 2593 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 45 2594 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 46 2595 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 47 2596 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 48 2597 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 49 2598 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 50 2599 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 51 2600 0 0 0 0 0 0 0 0 0 0 20 1 1 0 0
100064 52 2601 0 0 0 0 0 0 0 0 0 1 20 1 1 0 0
100076  1 2551 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076  2 2552 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076  3 2553 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076  4 2554 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076  5 2555 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076  6 2556 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076  7 2557 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076  8 2558 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076  9 2559 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 10 2560 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 11 2561 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 12 2562 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 13 2563 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 14 2564 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 15 2565 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 16 2566 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 17 2567 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 18 2568 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 19 2569 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 20 2570 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 21 2571 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 22 2572 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 23 2573 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 24 2574 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 25 2575 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 26 2576 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 27 2577 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 28 2578 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 29 2579 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 30 2580 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 31 2581 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 32 2582 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 33 2583 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 34 2584 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 35 2585 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 36 2586 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 37 2587 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 38 2588 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 39 2589 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 40 2590 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 41 2591 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 42 2592 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 43 2593 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 44 2594 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 45 2595 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 46 2596 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 47 2597 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
100076 48 2598 0 0 0 0 0 0 0 0 0 0 42 1 0 1 0
end
format %tw yw
I want to test the hypothesis whether the number of treatments and type of treatments (T1/T2/T3/T4) are predictive of death. All individuals in my sample die in week 52, so the variation is not in whether they die or not. However there is variation in timing of treatments, number of treatments and calendar time of treatments within their last year of life. A colleague suggested estimating a random-effects survival model. So I estimated the following:

Code:
. xtset case_number
       panel variable:  case_number (balanced)

. stset week, failure(dead==1)

     failure event:  dead == 1
obs. time interval:  (0, week]
 exit on or before:  failure

------------------------------------------------------------------------------
    120,796  total observations
          0  exclusions
------------------------------------------------------------------------------
    120,796  observations remaining, representing
      2,323  failures in single-record/single-failure data
  3,201,094  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =        52

.

. eststo r1: xtstreg c.total_T male Black Hispanic Other age c.yw, distribution(exponential) vce(cluster case_number)  
> nolog

         failure _d:  dead == 1
   analysis time _t:  week

Random-effects exponential PH regression        Number of obs     =    120,796
Group variable:     case_number                 Number of groups  =      2,323

                                                Obs per group:
                                                              min =         52
                                                              avg =       52.0
                                                              max =         52

Integration method: mvaghermite                 Integration pts.  =         12

                                                Wald chi2(7)      =     682.67
Log pseudolikelihood = -18974.339               Prob > chi2       =     0.0000
                        (Std. Err. adjusted for 2,323 clusters in case_number)
------------------------------------------------------------------------------
             |               Robust
          _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     total_T |   1.103723   .0111509     9.77   0.000     1.082083    1.125796
        male |   1.050707   .0226684     2.29   0.022     1.007204     1.09609
       Black |   .9671728   .0219859    -1.47   0.142     .9250271    1.011239
    Hispanic |   1.038662   .0292476     1.35   0.178     .9828912    1.097598
       Other |   .9710166   .0300546    -0.95   0.342     .9138618    1.031746
         age |   .9992546   .0005942    -1.25   0.210     .9980906     1.00042
          yw |   1.001171   .0000688    17.04   0.000     1.001036    1.001305
       _cons |   .0000221   4.32e-06   -54.88   0.000     .0000151    .0000324
-------------+----------------------------------------------------------------
   /sigma2_u |   1.27e-32   4.69e-34                      1.18e-32    1.36e-32
------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.
Note: _cons estimates baseline hazard (conditional on zero random effects).

. stcurve, survival at1(male=0) at2(male=1) lpattern(solid dash) lcolor(cranberry ebblue) title("Estimated Survival by
> Gender")
(option marginal assumed)
I have two questions:

1-- is this the appropriate model given all individuals died in week 52? I apologize if this is not the right place to ask this statistical (rather than Stata) question, but will be very grateful for any advice.
2-- Is the interpretation the above estimate of 1.103723 for total_t that one additional treatment increases the hazard of death by 10%?

Thank you for your time. Ever gratefully,
Sumedha.