Announcement

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

  • test fo me

    Code:
    use https://www.pclambert.net/data/rott2b, clear
    (Rotterdam breast cancer data (augmented with cause of death))
    
    . // (Rotterdam breast cancer data (augmented with cause of death))
    . range tt 0 5 101 
    (2,881 missing values generated)
    
    . stset os, f(osi==1) scale(12) exit(time 60)
    
    Survival-time data settings
    
             Failure event: osi==1
    Observed time interval: (0, os]
         Exit on or before: time 60
         Time for analysis: time/12
    
    --------------------------------------------------------------------------
          2,982  total observations
              0  exclusions
    --------------------------------------------------------------------------
          2,982  observations remaining, representing
            753  failures in single-record/single-failure data
     13,038.968  total analysis time at risk and under observation
                                                    At risk from t =         0
                                         Earliest observed entry t =         0
                                              Last observed exit t =         5
    
    . rcsgen age, gen(agercs) df(3) orthog
    Variables agercs1 to agercs3 were created
    
    . stpm2 agercs* recent chemo, ///
    >       tvc(agercs* recent chemo) dftvc(2) ///
    >       df(3) scale(hazard)  
    
    Iteration 0:  Log likelihood = -2121.7864  
    Iteration 1:  Log likelihood = -2109.6881  
    Iteration 2:  Log likelihood = -2108.6861  
    Iteration 3:  Log likelihood = -2108.6789  
    Iteration 4:  Log likelihood = -2108.6789  
    
    Log likelihood = -2108.6789                              Number of obs = 2,982
    
    ---------------------------------------------------------------------------------
                    | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    ----------------+----------------------------------------------------------------
    xb              |
            agercs1 |   .2163973   .0403783     5.36   0.000     .1372573    .2955372
            agercs2 |  -.1843649   .0349476    -5.28   0.000    -.2528609   -.1158689
            agercs3 |   .0345448   .0355393     0.97   0.331     -.035111    .1042006
             recent |  -.2073141     .07534    -2.75   0.006    -.3549778   -.0596505
              chemo |   .2922621   .1073828     2.72   0.006     .0817956    .5027286
              _rcs1 |   .7684606   .0526326    14.60   0.000     .6653025    .8716186
              _rcs2 |   .1374124   .0412984     3.33   0.001      .056469    .2183557
              _rcs3 |   .0156698   .0093732     1.67   0.095    -.0027014    .0340409
      _rcs_agercs11 |  -.1162479   .0399127    -2.91   0.004    -.1944754   -.0380204
      _rcs_agercs12 |  -.0764194   .0298221    -2.56   0.010    -.1348697   -.0179691
      _rcs_agercs21 |    .000038    .033758     0.00   0.999    -.0661265    .0662026
      _rcs_agercs22 |   .0036754   .0255487     0.14   0.886    -.0463992    .0537499
      _rcs_agercs31 |  -.0043918   .0292079    -0.15   0.880    -.0616383    .0528546
      _rcs_agercs32 |  -.0137591   .0214704    -0.64   0.522    -.0558403    .0283221
       _rcs_recent1 |   .0855266   .0575237     1.49   0.137    -.0272177    .1982708
       _rcs_recent2 |   .0291833   .0418702     0.70   0.486    -.0528808    .1112475
        _rcs_chemo1 |   .0472015   .1116477     0.42   0.672     -.171624     .266027
        _rcs_chemo2 |    .060447   .0822471     0.73   0.462    -.1007544    .2216483
              _cons |  -1.500633   .0632174   -23.74   0.000    -1.624536   -1.376729
    ---------------------------------------------------------------------------------
    
    . 
    . // Use "if" option to set the covariate distribution to that for patients 
    . // who got chemotherapy in the recent years.
    . 
    . // 1) Predict for the patients who diagnosed in the recent years.
    . standsurv if recent==1 & chemo==1, /// 
    >         at1(recent 1 chemo 1) ///   
    >                 at2(recent 1 chemo 0) /// Prediction for patients who didn't get chemotherapy in the recent years
    >                 contrast(difference) contrastvar(rs_diff_new) /// Calculate the difference between groups
    >         timevar(tt) ci atvar(wchemo_new wochemo_new)    
    
    .                 
    . // 2) Predict for the patients who diagnosed in the past years.
    . standsurv if recent==1 & chemo==1, /// 
    >                 at1(recent 0 chemo 1) /// Prediction for patients who got chemotherapy in the past years
    >                 at2(recent 0 chemo 0) /// Prediction for patients who didn't get chemotherapy in the past years
    >                 contrast(difference) contrastvar(rs_diff_old) /// Calculate the difference between groups
    >         timevar(tt)  ci   atvar(wchemo_past wochemo_past)               
    
    . 
    . twoway line rs_diff_old rs_diff_new tt, sort
    
    . list rs_diff_old* if tt==5
    
          +-----------------------------------+
          | rs_diff~d   rs_~d_lci   rs_~d_uci |
          |-----------------------------------|
     101. | .06619761   .01963877   .11275645 |
          +-----------------------------------+
    
    . list rs_diff_new* if tt==5
    
          +----------------------------------+
          | rs_dif~w   rs_~w_lci   rs_~w_uci |
          |----------------------------------|
     101. | .0583496   .01691349   .09978571 |
          +----------------------------------+
    
    . 
    end of do-file
Working...
X