. set more off

. di c(filename)
chsurviv1trans6mar2012.dta

. pwd
/Users/robertyaffee/Documents/data/research/chwk/phase3/survwk/docs/tex/stcox

. title "Proportional Hazard single transition model "


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****            Proportional Hazard single transition model              *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:39:45  *****
*******************************************************************************
*******************************************************************************


. di c(current_date)
 6 Mar 2012

. cd /Users/robertyaffee/Documents/data/research/chwk/phase3/survwk/docs/tex/stcox
/Users/robertyaffee/Documents/data/research/chwk/phase3/survwk/docs/tex/stcox

. use chsurviv1tran2mar2012, clear

. set more off

. set linesize 80

. *************************************************************************************************************************************************
. ***  //// ***** ///// *****  Reconfiguration for Nonparametric Level 25 Depression Analysis //// ********/////*************////  ***************
> *************************************************************************************************************************************************
.
. ********************************* Right-censoring ****************************************************************************
. *---------------------------------------  Right Censoring occurs when there is no event prior to end of study  in single transition studies *****
. *  in this case, the destination state = origin state
. *  so if 22 cases experience no failure event during study  they are right-censored and half of them are dropped from the risk set
. *----------------------------------------------------------------------------------------------------------------------------------
. title Single transition study of time till Level 25 Depression in Ukraine  Kiev and Zhitomyr Oblasts


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                               Single                                *****
*****                             transition                              *****
*****                               study                                 *****
*****                                 of                                  *****
*****                                time                                 *****
*****                                till                                 *****
*****                               Level                                 *****
*****                                 25                                  *****
*****                             Depression                              *****
*****                                 in                                  *****
*****                              Ukraine                                *****
*****                                Kiev                                 *****
*****                                and                                  *****
*****                              Zhitomyr                               *****
*****                              Oblasts                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:39:45  *****
*******************************************************************************
*******************************************************************************


. subtitle "Depression level 25 analysis: Single transition"
-------------
                                       Date and time:   6 Mar 2012    05:39:45
                                       Working directory:  /Users/robertyaffee/Documents/data/research/chwk/phase3/survwk/docs/tex/stcox
                                       Stata data file:  chsurviv1tran2mar2012.dta
                                       Stata version:  12.1
                                       Operating system:  MacOSX   10.6.8  on  Macintosh (Intel 64-bit)  with  4  processors
                                       using  1.007e+08 bytes of memory

Depression level 25 analysis: Single transition
-------------

.
. di "{hline}"
-------------

. quietly {
Configuration protocol

. di "{hline}"
-------------

.
.
.
. //  designation of origin time
.
. cap gen date0dep25x = t00

. label var date0dep25x "Starting time of study"

.
.
. // end of study iyr
. //  time in study -  final time
.
. //  let tf be time until the first onset of level 25dep
. cap drop tfin

.
. gen tfin = iyr

. label var tfin  "end of study"

. cap drop tf

. gen tf = date1dep25x - t00
(9548 missing values generated)

. label var tf "Time till first onset of level 25 depression"

.
.
. cap drop desdep25

.
. gen desdep25 = 1 if date1dep25x < iyr
(9708 missing values generated)

. label var desdep25 "Destination event before end of study"

. replace desdep25 = 0 if date1ptsdx == iyr   //  these observations are censored
(127 real changes made)

. replace desdep25 = 0 if mxndep25splnr==0     //  those who experienced no event during study
(9407 real changes made)

.
.
. cap drop dep25rc

. gen dep25rc = date1dep25x == iyr

. label var dep25rc "right-censoring of level 25 depression"

. sort id date

. xttab date1dep25x

                  Overall             Between            Within
date1~25x |    Freq.  Percent      Freq.  Percent        Percent
----------+-----------------------------------------------------
     1980 |     682      5.52        22      5.58         100.00
     1981 |     217      1.76         7      1.78         100.00
     1982 |     186      1.51         6      1.52         100.00
     1983 |      93      0.75         3      0.76         100.00
     1984 |     217      1.76         7      1.78         100.00
     1985 |     310      2.51        10      2.54         100.00
     1986 |    3348     27.11       108     27.41         100.00
     1987 |     527      4.27        17      4.31         100.00
     1988 |     496      4.02        16      4.06         100.00
     1989 |     434      3.51        14      3.55         100.00
     1990 |     527      4.27        17      4.31         100.00
     1991 |     248      2.01         8      2.03         100.00
     1992 |     372      3.01        12      3.05         100.00
     1993 |     341      2.76        11      2.79         100.00
     1994 |     224      1.81         7      1.78         100.00
     1995 |     416      3.37        13      3.30         100.00
     1996 |     351      2.84        11      2.79         100.00
     1997 |     224      1.81         7      1.78         100.00
     1998 |     512      4.15        16      4.06         100.00
     1999 |     256      2.07         8      2.03         100.00
     2000 |     288      2.33         9      2.28         100.00
     2001 |     224      1.81         7      1.78         100.00
     2002 |     128      1.04         4      1.02         100.00
     2003 |     192      1.55         6      1.52         100.00
     2004 |     128      1.04         4      1.02         100.00
     2005 |     192      1.55         6      1.52         100.00
     2006 |     256      2.07         8      2.03         100.00
     2007 |     192      1.55         6      1.52         100.00
     2008 |     384      3.11        12      3.05         100.00
     2009 |     320      2.59        10      2.54         100.00
     2010 |      64      0.52         2      0.51         100.00
----------+-----------------------------------------------------
    Total |   12349    100.00       394    100.00         100.00
                               (n = 394)

. replace desdep25 = 0 if id==52 | id==184 | id==644     // these cases are right censored
(96 real changes made)

. by id: replace desdep25 = 0 if mxndep25splnr==0   // these cases are right censored
(0 real changes made)

.
. cap drop _t _d _s  _t0

. //  configuration for a single transition analysis of dep25
.  stset tf if tf < . & tf != tf[_n-1], failure(desdep25) exit(time .) id(id)

                id:  id
     failure event:  desdep25 != 0 & desdep25 < .
obs. time interval:  (tf[_n-1], tf]
 exit on or before:  time .
            if exp:  tf < . & tf != tf[_n-1]

------------------------------------------------------------------------------
    21897  total obs.
    21536  ignored at outset because of -if <exp>-
       21  obs. end on or before enter()
------------------------------------------------------------------------------
      340  obs. remaining, representing
      340  subjects
      334  failures in single failure-per-subject data
     4340  total analysis time at risk, at risk from t =         0
                             earliest observed entry t =         0
                                  last observed exit t =        30

.
.
. ******************************************************************************
. // complex sample configuration
.
. // svyset [pweight=newacwtsurv], fpc(fpc1) singleunit(certainty)
. //  svy:tab gender, count obs stubwidth(12) cellwidth(12) format(%12.0fc)
. ******************************************************************************
. cap gen period = 1 if year < 1987

. replace period = 2 if year >= 1987 & year <= 1995
(6318 real changes made)

. replace period = 3 if year >= 1996 & year <= 2002
(4914 real changes made)

. replace period = 4 if year >= 2003
(5616 real changes made)

.
.
.
. stdes

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

                                   +-------------- per subject --------------+
Category                   total        mean         min     median        max
------------------------------------------------------------------------------
no. of subjects              340
no. of records               340           1           1          1          1

(first) entry time                         0           0          0          0
(final) exit time                   12.76471           1         10         30

subjects with gap              0
time on gap if gap             0           .           .          .          .
time at risk                4340    12.76471           1         10         30

failures                     334    .9823529           0          1          1
------------------------------------------------------------------------------

. stdes if gender==1

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

                                   +-------------- per subject --------------+
Category                   total        mean         min     median        max
------------------------------------------------------------------------------
no. of subjects              154
no. of records               154           1           1          1          1

(first) entry time                         0           0          0          0
(final) exit time                   12.85714           1        9.5         30

subjects with gap              0
time on gap if gap             0           .           .          .          .
time at risk                1980    12.85714           1        9.5         30

failures                     152     .987013           0          1          1
------------------------------------------------------------------------------

. stdes if gender==2

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

                                   +-------------- per subject --------------+
Category                   total        mean         min     median        max
------------------------------------------------------------------------------
no. of subjects              186
no. of records               186           1           1          1          1

(first) entry time                         0           0          0          0
(final) exit time                   12.68817           1         11         29

subjects with gap              0
time on gap if gap             0           .           .          .          .
time at risk                2360    12.68817           1         11         29

failures                     182    .9784946           0          1          1
------------------------------------------------------------------------------

. stsum

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

         |               incidence       no. of    +------ Survival time -----+
         | time at risk     rate        subjects        25%       50%       75%
---------+---------------------------------------------------------------------
   total |         4340   .0769585           340          6        10        18

. stsum if gender==1

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

         |               incidence       no. of    +------ Survival time -----+
         | time at risk     rate        subjects        25%       50%       75%
---------+---------------------------------------------------------------------
   total |         1980   .0767677           154          6         9        19

. stsum if gender==2

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

         |               incidence       no. of    +------ Survival time -----+
         | time at risk     rate        subjects        25%       50%       75%
---------+---------------------------------------------------------------------
   total |         2360   .0771186           186          6        11        18

. sts test gender

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id


Log-rank test for equality of survivor functions


          |   Events         Events
gender    |  observed       expected
----------+-------------------------
1. male   |       152         155.75
2. female |       182         178.25
----------+-------------------------
Total     |       334         334.00

                chi2(1) =       0.20
                Pr>chi2 =     0.6550

. sts test agegrp3

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id


Log-rank test for equality of survivor functions


           |   Events         Events
agegrp3    |  observed       expected
-----------+-------------------------
lower 1/3  |        93         120.54
middle 1/3 |       127         120.07
upper 1/3  |       114          93.39
-----------+-------------------------
Total      |       334         334.00

                 chi2(2) =      13.34
                 Pr>chi2 =     0.0013

. sts test gender agegrp3

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id


Log-rank test for equality of survivor functions


                      |   Events         Events
gender, agegrp3       |  observed       expected
----------------------+-------------------------
1. male, lower 1/3    |        50          65.61
1. male, middle 1/3   |        57          50.46
1. male, upper 1/3    |        45          39.68
2. female, lower 1/3  |        43          54.93
2. female, middle 1/3 |        70          69.60
2. female, upper 1/3  |        69          53.71
----------------------+-------------------------
Total                 |       334         334.00

                            chi2(5) =      14.50
                            Pr>chi2 =     0.0127

. strate agegrp3, graph  title(Failure rate by age group)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Estimated rates and lower/upper bounds of 95% confidence intervals
(340 records included in the analysis)

  +-------------------------------------------------------------+
  |    agegrp3     D         Y       Rate      Lower      Upper |
  +-------------------------------------------------------------+
  |  lower 1/3    93   1.5e+03   0.062753   0.051212   0.076895 |
  | middle 1/3   127   1.6e+03   0.079425   0.066746   0.094512 |
  |  upper 1/3   114   1.3e+03   0.090548   0.075363   0.108793 |
  +-------------------------------------------------------------+


. graph save frateag3.gph, replace
(file frateag3.gph saved)

.
. strate gender agegrp3, graph title(Failure rate by gender and age group)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Estimated rates and lower/upper bounds of 95% confidence intervals
(340 records included in the analysis)

       +-------------------------------------------------------------------------+
       |    gender      agegrp3    D          Y       Rate      Lower      Upper |
       +-------------------------------------------------------------------------+
21608. |   1. male    lower 1/3   50   798.0000   0.062657   0.047489   0.082669 |
21666. |   1. male   middle 1/3   57   664.0000   0.085843   0.066216   0.111289 |
21711. |   1. male    upper 1/3   45   518.0000   0.086873   0.064862   0.116352 |
21756. | 2. female    lower 1/3   43   684.0000   0.062865   0.046624   0.084766 |
21828. | 2. female   middle 1/3   70   935.0000   0.074866   0.059231   0.094629 |
       +-------------------------------------------------------------------------+
21897. | 2. female    upper 1/3   69   741.0000   0.093117   0.073546   0.117897 |
       +-------------------------------------------------------------------------+


. graph save frategenag3.gph, replace
(file frategenag3.gph saved)

.
.
. * distinguishing age from wave by failure rate
. stmh agegrp3, by(gender)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Score test for trend of rates with agegrp3
  with an approximate estimate of the
  rate ratio for a one unit increase in agegrp3
  by gender

RR estimate, and lower and upper 95% confidence limits

  +----------------------------------+
  |    gender     RR   Lower   Upper |
  +----------------------------------+
  |   1. male   1.18    0.97    1.44 |
  | 2. female   1.22    1.01    1.47 |
  +----------------------------------+

Overall estimate controlling for gender

        ----------------------------------------------------------
             RR       chi2        P>chi2      [95% Conf. Interval]
        ----------------------------------------------------------
          1.201       6.99        0.0082         1.049      1.376
        ----------------------------------------------------------

Approx test for unequal RRs (effect modification): chi2(1) =     0.04
                                                   Pr>chi2 =   0.8378

. stmh gender, by(agegrp3)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Maximum likelihood estimate of the rate ratio
  comparing gender==2 vs. gender==1
  by agegrp3

RR estimate, and lower and upper 95% confidence limits

  +-----------------------------------+
  |    agegrp3     RR   Lower   Upper |
  +-----------------------------------+
  |  lower 1/3   1.00    0.67    1.51 |
  | middle 1/3   0.87    0.61    1.24 |
  |  upper 1/3   1.07    0.74    1.56 |
  +-----------------------------------+

Overall estimate controlling for agegrp3

        ----------------------------------------------------------
             RR       chi2        P>chi2      [95% Conf. Interval]
        ----------------------------------------------------------
          0.972       0.06        0.8006         0.783      1.208
        ----------------------------------------------------------

Approx test for unequal RRs (effect modification): chi2(2) =     0.65
                                                   Pr>chi2 =   0.7212

. stmh agegrp3, by(period)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Score test for trend of rates with agegrp3
  with an approximate estimate of the
  rate ratio for a one unit increase in agegrp3
  by period

RR estimate, and lower and upper 95% confidence limits

  +-------------------------------+
  | period     RR   Lower   Upper |
  +-------------------------------+
  |      1   1.20    1.05    1.37 |
  +-------------------------------+

Overall estimate controlling for period

        ----------------------------------------------------------
             RR       chi2        P>chi2      [95% Conf. Interval]
        ----------------------------------------------------------
          1.199       6.93        0.0085         1.048      1.373
        ----------------------------------------------------------

Too few informative strata for test for unequal OR's

. stmh gender, by(period)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Maximum likelihood estimate of the rate ratio
  comparing gender==2 vs. gender==1
  by period

RR estimate, and lower and upper 95% confidence limits

  +-------------------------------+
  | period     RR   Lower   Upper |
  +-------------------------------+
  |      1   1.00    0.81    1.25 |
  +-------------------------------+

Overall estimate controlling for period

        ----------------------------------------------------------
             RR       chi2        P>chi2      [95% Conf. Interval]
        ----------------------------------------------------------
          1.005       0.00        0.9669         0.810      1.246
        ----------------------------------------------------------

Too few informative strata for test for unequal OR's

.
. stmh ranown, by(agegrp3)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Score test for trend of rates with ranown
  with an approximate estimate of the
  rate ratio for a one unit increase in ranown
  by agegrp3

RR estimate, and lower and upper 95% confidence limits

  +-----------------------------------+
  |    agegrp3     RR   Lower   Upper |
  +-----------------------------------+
  |  lower 1/3   1.00    0.98    1.02 |
  | middle 1/3   1.00    0.98    1.01 |
  |  upper 1/3   1.01    0.99    1.02 |
  +-----------------------------------+

Overall estimate controlling for agegrp3

        ----------------------------------------------------------
             RR       chi2        P>chi2      [95% Conf. Interval]
        ----------------------------------------------------------
          1.002       0.19        0.6603         0.993      1.011
        ----------------------------------------------------------

Approx test for unequal RRs (effect modification): chi2(2) =     0.41
                                                   Pr>chi2 =   0.8146

. stmh ranown if ranown > 51 & ranown < 103, by(gender)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Score test for trend of rates with ranown
  with an approximate estimate of the
  rate ratio for a one unit increase in ranown
  by gender

RR estimate, and lower and upper 95% confidence limits

  +----------------------------------+
  |    gender     RR   Lower   Upper |
  +----------------------------------+
  |   1. male   1.00    0.99    1.01 |
  | 2. female   1.00    0.99    1.02 |
  +----------------------------------+

Overall estimate controlling for gender

        ----------------------------------------------------------
             RR       chi2        P>chi2      [95% Conf. Interval]
        ----------------------------------------------------------
          1.002       0.20        0.6514         0.993      1.011
        ----------------------------------------------------------

Approx test for unequal RRs (effect modification): chi2(1) =     0.30
                                                   Pr>chi2 =   0.5819

. // Depression rates in different raions
. strate ranown if ranown == 70 | ranown == 72  | ranown==84 | ranown== 102 ///
>  | ranown==67 | ranown== 79 | ranown== 69 | ranown==92 | ranown==65 | ranown==75 ///
>  | ranown==76 | ranown == 86

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Estimated rates and lower/upper bounds of 95% confidence intervals
(244 records included in the analysis)

  +-----------------------------------------------------------------------------+
  |                 ranown     D          Y        Rate       Lower       Upper |
  +-----------------------------------------------------------------------------+
  |       65. Emilchinskiy     1     2.0000   0.5000000   0.0704317     3.5e+00 |
  |          67. Irpenskiy    13   209.0000   0.0622010   0.0361174   0.1071218 |
  |       69. Korostenskiy     6    61.0000   0.0983607   0.0441896   0.2189389 |
  |    70. Korostichevskiy     4    36.0000   0.1111111   0.0417020   0.2960454 |
  |           72. Kyivskiy   168    2.3e+03   0.0742706   0.0638477   0.0863949 |
  +-----------------------------------------------------------------------------+
  |        75. Makarovskiy     2    43.0000   0.0465116   0.0116324   0.1859739 |
  |          76. Malinskiy     3    19.0000   0.1578947   0.0509244   0.4895636 |
  | 79. Novograd-Volynskiy     6    72.0000   0.0833333   0.0374384   0.1854899 |
  |          84. Polesskiy     2    33.0000   0.0606061   0.0151574   0.2423296 |
  |    86. Radomischevskiy     3    14.0000   0.2142857   0.0691117   0.6644077 |
  +-----------------------------------------------------------------------------+
  |      92. Taraschenskiy     1    21.0000   0.0476190   0.0067078   0.3380510 |
  |      102. Zhitomirskiy    29   302.0000   0.0960265   0.0667309   0.1381832 |
  +-----------------------------------------------------------------------------+


.
. stci, by(org desdep25)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

org          |    no. of
desdep25     |  subjects         50%     Std. Err.     [95% Conf. Interval]
-------------+-------------------------------------------------------------
         2 0 |         6           .             .            .          .
         2 1 |       162          15      1.097151           13         18
         4 1 |        82           9      .9690649            7         11
         6 1 |        42           7      .4398602            6          8
         8 1 |        22           7      1.563472            6         11
        10 1 |        14           6      1.122497            4         10
        12 1 |         5           8      .8944272            1          .
        14 1 |         4           2      1.666667            1          .
        16 1 |         2           6             .            6          .
        18 1 |         1           .             .            .          .
-------------+-------------------------------------------------------------
       total |       340          10      .7372445            9         12

. stci if gender==1, by(org desdep25) emean

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

org          |    no. of    extended
desdep25     |  subjects        mean
-------------+----------------------
         2 0 |         2           .
         2 1 |        81    15.34568(*)
         4 1 |        34    10.55882(*)
         6 1 |        24    9.583333(*)
         8 1 |         6    7.833333(*)
        10 1 |         5         6.8(*)
        14 1 |         2           4(*)
-------------+----------------------
       total |       154    12.92673

(*) no extension needed

. cap noisily stci if gender==2, by(org desdep25) emean

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

org          |    no. of    extended
desdep25     |  subjects        mean
-------------+----------------------
         2 0 |         4           .
         2 1 |        81    15.90123(*)
         4 1 |        48    10.91667(*)
         6 1 |        18    8.666667(*)
         8 1 |        16         9.5(*)
        10 1 |         9    7.888889(*)
        12 1 |         5         6.6(*)
        14 1 |         2         3.5(*)
        16 1 |         2           7(*)
variable __000009 not found

.
. title Single transition study of time till Level 25 Depression in Ukraine  Kiev and Zhitomyr Oblasts


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                               Single                                *****
*****                             transition                              *****
*****                               study                                 *****
*****                                 of                                  *****
*****                                time                                 *****
*****                                till                                 *****
*****                               Level                                 *****
*****                                 25                                  *****
*****                             Depression                              *****
*****                                 in                                  *****
*****                              Ukraine                                *****
*****                                Kiev                                 *****
*****                                and                                  *****
*****                              Zhitomyr                               *****
*****                              Oblasts                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:40:58  *****
*******************************************************************************
*******************************************************************************


. subtitle "Depression level 25 analysis: Single transition"
-------------
                                       Date and time:   6 Mar 2012    05:40:58
                                       Working directory:  /Users/robertyaffee/Documents/data/research/chwk/phase3/survwk/docs/tex/stcox
                                       Stata data file:  chsurviv1tran2mar2012.dta
                                       Stata version:  12.1
                                       Operating system:  MacOSX   10.6.8  on  Macintosh (Intel 64-bit)  with  4  processors
                                       using  1.007e+08 bytes of memory

Depression level 25 analysis: Single transition
-------------

.
. di "{hline}"
-------------

. quietly {
Configuration protocol

. di "{hline}"
-------------

.
. //  designation of origin time
.
. cap gen date0dep25x = t00

. label var date0dep25x "Starting time of study"

.
. cap gen orig=0

.
. replace des = tfin==ti
(0 real changes made)

.
.
. cap gen tstart= y(1980)

.
. replace tf = tfin - tstart+1
(21897 real changes made)

.
. stset tf if tf < ., f(des)

     failure event:  des != 0 & des < .
obs. time interval:  (0, tf]
 exit on or before:  failure
            if exp:  tf < .

------------------------------------------------------------------------------
    21897  total obs.
        0  exclusions
------------------------------------------------------------------------------
    21897  obs. remaining, representing
    21897  failures in single record/single failure data
   672671  total analysis time at risk, at risk from t =         0
                             earliest observed entry t =         0
                                  last observed exit t =        32

. // end of study iyr
. //  time in study -  final time
. //  configuration for first spell transition
. //  let tf be time until the first onset of level 25dep
. cap gen org = 0

. cap gen tfin = iyr

. label var tfin  "end of study"

. cap drop tf

. gen tf = date1dep25x - t00
(9548 missing values generated)

. label var tf "Time till first onset of level 25 depression"

.
.
.
.
. cap drop tfin

. cap gen desdep = ti

. cap gen tfindep = desdep == ti

. * replace tf = tfin -  t00 + 1
.
. sort id date

. cap drop _t _d _s  _t0

. //  configuration for a single transition analysis of dep25
.  stset tf if tf < . & tf != tf[_n-1], failure(desdep25) exit(time .) id(id)

                id:  id
     failure event:  desdep25 != 0 & desdep25 < .
obs. time interval:  (tf[_n-1], tf]
 exit on or before:  time .
            if exp:  tf < . & tf != tf[_n-1]

------------------------------------------------------------------------------
    21897  total obs.
    21536  ignored at outset because of -if <exp>-
       21  obs. end on or before enter()
------------------------------------------------------------------------------
      340  obs. remaining, representing
      340  subjects
      334  failures in single failure-per-subject data
     4340  total analysis time at risk, at risk from t =         0
                             earliest observed entry t =         0
                                  last observed exit t =        30

.
. *******************************************************************************
. ******  for multiple epidodes a different configuration is required ***********
.
. ***********  Multiple episode configuration  **************
. /*
> replace org = 1 + (2*mxndep25splnr - 1)        // origin state
> replace desdep25 = org                         // destination state
> replace desdep25= org + 1 if tfin < ti
>
>
>
> cap drop desdep25
>
> cap gen desdep25 = 1 if date1dep25x < iyr
> label var desdep25 "Destination event before end of study"
> replace desdep25 = 0 if date1ptsdx == iyr   //  these observations are censored
> replace desdep25 = 0 if mxndep25splnr==0     //  those who experienced no event during study
>
>
> cap drop dep25rc
> gen dep25rc = date1dep25x == iyr
> label var dep25rc "right-censoring of level 25 depression"
>
> xttab date1dep25x
> replace desdep25 = 0 if id==52 | id==184 | id==644     // these cases are right censored
> by id: replace desdep25 = 0 if mxndep25splnr==0   // these cases are right censored
>
> sort id date
> cap drop _t _d _s  _t0
> //  configuration for a single transition analysis of dep25
>  stset tf if tf < . & tf != tf[_n-1], failure(desdep25) exit(time .) id(id)
>
>
>
> // complex survey setup
> //label var gender "Respondnt gender"
> //label var newacwt "New area code weight"
> //svyset id [pweight=newacwtsurv], fpc(fpc1) singleunit(certainty)
>
> // 2 observations dropped said they lived in the exclusion zone
>
>
>
>
> */
. *----------  Total population-based geographic
. /*
> svy: stcox Andrushevskiy-Baranovskiy Berdichevskiy-BiloTserkovskiy Boryspilskiy-Brovarskiy Fastivskiy-Korostenskiy ///
>    KyevoSvyatoshenskiy-Lubarskiy Malinskiy Narodichevskiy-NovogradVolynskiy Olevskiy-PereyaslavKhmelnitskiy ///
>    Popelnyanskiy-Radomischevskiy Skvirskiy Tarascheskiy VolodarVolynskiy Volodarskiy  Zhitomirskiy if gender==1
>
>
> svy: stcox Baranovskiy Berdichevskiy-BiloTserkovskiy Brovarskiy Irpenskiy-Korostenskiy ///
>    KyevoSvyatoshenskiy-Lubarskiy Malinskiy NovogradVolynskiy Olevskiy-PereyaslavKhmelnitskiy ///
>    Popelnyanskiy Skvirskiy VolodarVolynskiy Volodarskiy  Zhitomirskiy if gender==2
> */
. di "{hline}"
-------------

.
. forvalues p=.8(.5).9 {
  2. forvalues hr=2(5)90 {
  3.     forvalues s = .2(.1).5 {
  4.     set more off
  5. stpower cox, hratio(`hr')  power(.90) alpha(.05) sd(`s') saving(powerstc, replace) table
  6. }
  7. }
  8. }


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   547   547   .693147   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   243   243   .693147   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   137   137   .693147   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   88   88   .693147   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   70   70   1.94591   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   31   31   1.94591   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   18   18   1.94591   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   12   12   1.94591   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   43   43   2.48491   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   19   19   2.48491   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   11   11   2.48491   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   7   7   2.48491   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   33   33   2.83321   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   15   15   2.83321   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   9   9   2.83321   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   6   6   2.83321   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   28   28   3.09104   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   13   13   3.09104   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   7   7   3.09104   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   5   5   3.09104   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   25   25   3.29584   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   11   11   3.29584   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   7   7   3.29584   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   4   4   3.29584   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   22   22   3.46574   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   10   10   3.46574   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   6   6   3.46574   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   4   4   3.46574   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   21   21   3.61092   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   9   9   3.61092   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   6   6   3.61092   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   4   4   3.61092   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   19   19   3.73767   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   9   9   3.73767   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   5   5   3.73767   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   4   4   3.73767   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   18   18   3.85015   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   8   8   3.85015   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   5   5   3.85015   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   3   3   3.85015   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   17   17   3.95124   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   8   8   3.95124   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   5   5   3.95124   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   3   3   3.95124   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   17   17   4.04305   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   8   8   4.04305   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   5   5   4.04305   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   3   3   4.04305   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   16   16   4.12713   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   7   7   4.12713   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   4   4   4.12713   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   3   3   4.12713   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   15   15   4.20469   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   7   7   4.20469   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   4   4   4.20469   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   3   3   4.20469   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   15   15   4.27667   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   7   7   4.27667   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   4   4   4.27667   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   3   3   4.27667   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   14   14   4.34381   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   7   7   4.34381   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   4   4   4.34381   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   3   3   4.34381   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   14   14   4.40672   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   7   7   4.40672   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   4   4   4.40672   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   3   3   4.40672   .5   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   14   14   4.46591   .2   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   6   6   4.46591   .3   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   4   4   4.46591   .4   .05   |
  +------------------------------------------------------+
  * two sided


Estimated sample size for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.9   3   3   4.46591   .5   .05   |
  +------------------------------------------------------+
  * two sided

.
.
. save tempfile, replace
file tempfile.dta saved

. set more off

. stpower cox, power(.1(.05).90) n(100 200 300 400) sd(50)  alpha(.05) ///
>     saving(mypowerstc2, replace)


Estimated coefficient for Cox PH regression


Wald test, log-hazard metric


Ho: [b1, b2, ..., bp] = [0, b2, ..., bp]

  +------------------------------------------------------+
  |Power   N   E   B1   SD   Alpha*  |
  +------------------------------------------------------+
  |.1   100   100   -.00136   50   .05   |
  |.1   200   200   -.00096   50   .05   |
  |.1   300   300   -.00078   50   .05   |
  |.1   400   400   -.00068   50   .05   |
  |.15   100   100   -.00185   50   .05   |
  |.15   200   200   -.00131   50   .05   |
  |.15   300   300   -.00107   50   .05   |
  |.15   400   400   -.00092   50   .05   |
  |.2   100   100   -.00224   50   .05   |
  |.2   200   200   -.00158   50   .05   |
  |.2   300   300   -.00129   50   .05   |
  |.2   400   400   -.00112   50   .05   |
  |.25   100   100   -.00257   50   .05   |
  |.25   200   200   -.00182   50   .05   |
  |.25   300   300   -.00148   50   .05   |
  |.25   400   400   -.00129   50   .05   |
  |.3   100   100   -.00287   50   .05   |
  |.3   200   200   -.00203   50   .05   |
  |.3   300   300   -.00166   50   .05   |
  |.3   400   400   -.00144   50   .05   |
  |.35   100   100   -.00315   50   .05   |
  |.35   200   200   -.00223   50   .05   |
  |.35   300   300   -.00182   50   .05   |
  |.35   400   400   -.00157   50   .05   |
  |.4   100   100   -.00341   50   .05   |
  |.4   200   200   -.00241   50   .05   |
  |.4   300   300   -.00197   50   .05   |
  |.4   400   400   -.00171   50   .05   |
  |.45   100   100   -.00367   50   .05   |
  |.45   200   200   -.00259   50   .05   |
  |.45   300   300   -.00212   50   .05   |
  |.45   400   400   -.00183   50   .05   |
  |.5   100   100   -.00392   50   .05   |
  |.5   200   200   -.00277   50   .05   |
  |.5   300   300   -.00226   50   .05   |
  |.5   400   400   -.00196   50   .05   |
  |.55   100   100   -.00417   50   .05   |
  |.55   200   200   -.00295   50   .05   |
  |.55   300   300   -.00241   50   .05   |
  |.55   400   400   -.00209   50   .05   |
  |.6   100   100   -.00443   50   .05   |
  |.6   200   200   -.00313   50   .05   |
  |.6   300   300   -.00256   50   .05   |
  |.6   400   400   -.00221   50   .05   |
  |.65   100   100   -.00469   50   .05   |
  |.65   200   200   -.00332   50   .05   |
  |.65   300   300   -.00271   50   .05   |
  |.65   400   400   -.00235   50   .05   |
  |.7   100   100   -.00497   50   .05   |
  |.7   200   200   -.00351   50   .05   |
  |.7   300   300   -.00287   50   .05   |
  |.7   400   400   -.00248   50   .05   |
  |.75   100   100   -.00527   50   .05   |
  |.75   200   200   -.00373   50   .05   |
  |.75   300   300   -.00304   50   .05   |
  |.75   400   400   -.00263   50   .05   |
  |.8   100   100   -.0056   50   .05   |
  |.8   200   200   -.00396   50   .05   |
  |.8   300   300   -.00323   50   .05   |
  |.8   400   400   -.0028   50   .05   |
  |.85   100   100   -.00599   50   .05   |
  |.85   200   200   -.00424   50   .05   |
  |.85   300   300   -.00346   50   .05   |
  |.85   400   400   -.003   50   .05   |
  |.9   100   100   -.00648   50   .05   |
  |.9   200   200   -.00458   50   .05   |
  |.9   300   300   -.00374   50   .05   |
  |.9   400   400   -.00324   50   .05   |
  +------------------------------------------------------+
  * two sided

. use mypowerstc2, clear

. line power n, title( Power for Cox regression)

. use tempfile, clear

.
. di "{hline}"
-------------

. ***************** Geo-Socio-Demographic factors *******Chunk 1 **************************************
. di "{hline}"
-------------

. di "Note: Hazard ratios are exponentiated coefficients which are relative hazards"
Note: Hazard ratios are exponentiated coefficients which are relative hazards

. di "Note: The nonexponentiated hazards are actually risk scores"
Note: The nonexponentiated hazards are actually risk scores

. set more off

. di as input "*** chunk 1 ****"
*** chunk 1 ****

. di as input " geo-socio-demographic models"
 geo-socio-demographic models

. di as result "male design-based models"
male design-based models

.
.
. stcox Andrushevskiy - Zhitomirskiy if gender==1

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

note: Barishevskiy omitted because of collinearity
note: Boguslavskiy omitted because of collinearity
note: Borodyanskiy omitted because of collinearity
note: Brusilovskiy omitted because of collinearity
note: Chernyahovskiy omitted because of collinearity
note: Chervonoarmiyskiy omitted because of collinearity
note: Chudnivskiy omitted because of collinearity
note: Emilchinskiy omitted because of collinearity
note: Korostichevskiy omitted because of collinearity
note: Luginskiy omitted because of collinearity
note: Makarovskiy omitted because of collinearity
note: Mironivskiy omitted because of collinearity
note: Obukhovskiy omitted because of collinearity
note: Polesskiy omitted because of collinearity
note: Rakitnetskiy omitted because of collinearity
note: Romanovskiy omitted because of collinearity
note: Ruzhinskiy omitted because of collinearity
note: Stavyschenskiy omitted because of collinearity
note: Taraschenskiy omitted because of collinearity
note: Tetievskiy omitted because of collinearity
note: Vasilkivskiy omitted because of collinearity
note: Vasilkovskiy omitted because of collinearity
note: Vasylkovskiy omitted because of collinearity
note: Vyshgorodskiy omitted because of collinearity
note: Zhitomirskiy omitted because of collinearity
Iteration 0:   log likelihood = -636.66339
Iteration 1:   log likelihood = -626.47376
Iteration 2:   log likelihood = -618.05641
Iteration 3:   log likelihood = -616.74176
Iteration 4:   log likelihood = -616.18781
Iteration 5:   log likelihood = -616.18754
Refining estimates:
Iteration 0:   log likelihood = -616.18754

Cox regression -- Breslow method for ties

No. of subjects =          154                     Number of obs   =       154
No. of failures =          152
Time at risk    =         1980
                                                   LR chi2(26)     =     40.95
Log likelihood  =   -616.18754                     Prob > chi2     =    0.0314

--------------+----------------------------------------------------------------
            _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
Andrushevskiy |    2.412629    2.519908      0.84    0.399      .3114871     18.68707
  Baranovskiy |    2.166536    1.661341      1.01    0.313      .4820013     9.738309
 Barishevskiy |           1   (omitted)
Berdichevskiy |    2.652444     1.53244      1.69    0.091      .8548062     8.230472
BiloTserkov~y |      .34443    .3592267     -1.02    0.307      .0445997     2.659929
 Boguslavskiy |           1   (omitted)
 Borodyanskiy |           1   (omitted)
 Boryspilskiy |    .5045574    .2694464     -1.28    0.200      .1771525     1.437056
   Brovarskiy |    .4558494    .3484692     -1.03    0.304      .1018895     2.039451
 Brusilovskiy |           1   (omitted)
Chernyahovs~y |           1   (omitted)
Chervonoarm~y |           1   (omitted)
  Chudnivskiy |           1   (omitted)
 Emilchinskiy |           1   (omitted)
   Fastivskiy |    .8015821    .5139507     -0.34    0.730      .2281302     2.816523
    Irpenskiy |    .5679191    .2518688     -1.28    0.202      .2381132     1.354533
 Kagarlykskiy |    .3002268    .3135524     -1.15    0.249      .0387674     2.325047
 Korostenskiy |    2.198515    1.675875      1.03    0.301      .4934903      9.79445
Korostichev~y |           1   (omitted)
KyevoSvyato~y |    .7491133    .4808259     -0.45    0.653      .2129096     2.635723
     Kyivskiy |    .7755692    .2339072     -0.84    0.399      .4294407     1.400677
    Lubarskiy |    1.655936    1.725131      0.48    0.628      .2149186      12.7589
    Luginskiy |           1   (omitted)
  Makarovskiy |           1   (omitted)
    Malinskiy |    41.08687    47.69752      3.20    0.001      4.222287     399.8143
  Mironivskiy |           1   (omitted)
Narodichevs~y |    23.10144    25.73043      2.82    0.005      2.603567     204.9789
NovogradVol~y |    .6700337    .3846641     -0.70    0.485      .2174827      2.06428
  Obukhovskiy |           1   (omitted)
     Olevskiy |    2.412629    2.519908      0.84    0.399      .3114871     18.68707
   Ovruchskiy |     .618919    .6432541     -0.46    0.644      .0807168     4.745735
PereyaslavK~y |    .1955102    .2052309     -1.55    0.120      .0249831     1.530003
    Polesskiy |           1   (omitted)
Popelnyanskiy |    41.08687    47.69752      3.20    0.001      4.222287     399.8143
Radomischev~y |    4.824246    3.138687      2.42    0.016       1.34782      17.2674
 Rakitnetskiy |           1   (omitted)
  Romanovskiy |           1   (omitted)
   Ruzhinskiy |           1   (omitted)
    Skvirskiy |    .3002268    .3135524     -1.15    0.249      .0387674     2.325047
Stavyschens~y |           1   (omitted)
Taraschenskiy |           1   (omitted)
 Tarascheskiy |    .2364823    .2474149     -1.38    0.168      .0304261     1.838024
   Tetievskiy |           1   (omitted)
 Vasilkivskiy |           1   (omitted)
 Vasilkovskiy |           1   (omitted)
 Vasylkovskiy |           1   (omitted)
VolodarVoly~y |    .7162172    .7443543     -0.32    0.748      .0934121     5.491441
  Volodarskiy |    1.376635    1.432574      0.31    0.759      .1790724       10.583
Vyshgorodskiy |           1   (omitted)
  Yagotinskiy |    .2951968    .2311253     -1.56    0.119      .0636298     1.369502
 Zhitomirskiy |           1   (omitted)
--------------+----------------------------------------------------------------

. des Malinskiy Narodichevskiy Popelnyanskiy Radomischevskiy

              storage  display     value
variable name   type   format      label      variable label
-------------


Malinskiy         byte     %8.0g                        ranown==76


Narodichevskiy    byte     %8.0g                        ranown==78


Popelnyanskiy     byte     %8.0g                        ranown==85


Radomischevskiy   byte     %8.0g                        ranown==86


. str2d stcox Malinskiy Narodichevskiy Popelnyanskiy Radomischevskiy Kyivskiy if gender==1, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 10569      152    0.029676    0.026148   0.000691  0.098476  0.358  0.163
--------------------------------------------------------------------------

. cap gen m1r2dt = r(r2)

. stcox Malinskiy Narodichevskiy Popelnyanskiy Radomischevskiy Kyivskiy if gender==1, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          154                     Number of obs   =       154
No. of failures =          152
Time at risk    =         1980
                                                   LR chi2(5)      =     20.26
Log likelihood  =   -626.53116                     Prob > chi2     =    0.0011

--------------+----------------------------------------------------------------
            _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
    Malinskiy |    51.91734    58.92277      3.48    0.001      5.613768     480.1427
Narodichevs~y |    29.15798    31.68662      3.10    0.002      3.465276     245.3449
Popelnyanskiy |    51.91734    58.92277      3.48    0.001      5.613768     480.1427
Radomischev~y |    6.266209    3.785423      3.04    0.002      1.917756     20.47465
     Kyivskiy |     1.14942    .1943558      0.82    0.410      .8251803     1.601064
--------------+----------------------------------------------------------------

. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      0.29        5         0.9979
      ------------+---------------------------------------------------

. estat concordance

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      154
  Number of comparison pairs (P)      =    10789
  Number of orderings as expected (E)  =     3553
  Number of tied predictions (T)      =     5018

          Harrell's C = (E + T/2) / P  =    .5619
                            Somers' D  =    .1237

.         cap predict H0, basechazard

. di "pseudo-R2 = ", e(r2_p)
pseudo-R2 =  .01591458

.
.
. cap gen m1r2dt = r(r2)

. di "pseudo-R2d = ",m1r2dt
pseudo-R2d =  .02967568

. cap gen f1r2dt = m1r2dt

.
.
.
. line H0 _t, c(J) sort title(Baseline cumulative hazard)

.         cap gen H1Malin = H0*47.676

. line H1Malin H0 _t, c(J J) sort

.         cap gen H1Narod = H0*27.78

.         cap gen H1Radom = H0*5.75

.         cap gen H1Kyiv = H0*1.149

. line H1Narod H1Malin H1Radom H1Kyiv H0 _t, c(J J J J) sort title(Cumulative Hazards of different raions) ///
>    subtitle(as evidence of geographical effects on males)  ytitle(cumulative hazard)

. graph save mgeo.gph, replace
(file mgeo.gph saved)

. graph export mgeo.eps, replace
(file mgeo.eps written in EPS format)

.
.
. // comparison of geo effects on women
. set more off

. stcox Malinskiy Kyivskiy if gender==2, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(2)      =      2.89
Log likelihood  =   -796.58117                     Prob > chi2     =    0.2359

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Malinskiy |    1.763596    1.265432      0.79    0.429      .4321528     7.197157
    Kyivskiy |    .8013418    .1205782     -1.47    0.141      .5966741     1.076214
-------------+----------------------------------------------------------------

. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      0.54        2         0.7638
      ------------+---------------------------------------------------

.    cap predict Hf0, basechazard

. line Hf0 _t, c(J) sort title(Baseline cumulative hazard for women)

.   cap gen Hf1Malin = Hf0*1.76

.   cap gen Hf1Kyiv = Hf0*.801

. line Hf1Malin Hf1Kyiv Hf0 _t, c(J J J) sort title(Cumulative Hazards of different raions) ///
>     subtitle(as evidence of geographical effects on females)  ytitle(cumulative hazard)

. graph save fgeo.gph, replace
(file fgeo.gph saved)

. graph export fgeo.eps, replace
(file fgeo.eps written in EPS format)

.
.
. di "{hline}"
-------------

. *----2  male design-based geo-socio-demographic trimmed model wave 1
. set more off

. stcox  Kyivskiy Malinskiy Zhitomirskiy tvage  emplw13 ///
>   inc1w2-inc4w2  if gender==1

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Iteration 0:   log likelihood = -636.66339
Iteration 1:   log likelihood = -633.41814
Iteration 2:   log likelihood =  -622.6408
Iteration 3:   log likelihood = -622.34274
Iteration 4:   log likelihood = -622.33694
Iteration 5:   log likelihood = -622.33694
Refining estimates:
Iteration 0:   log likelihood = -622.33694

Cox regression -- Breslow method for ties

No. of subjects =          154                     Number of obs   =       154
No. of failures =          152
Time at risk    =         1980
                                                   LR chi2(9)      =     28.65
Log likelihood  =   -622.33694                     Prob > chi2     =    0.0007

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
    Kyivskiy |    1.450532    .3011604      1.79    0.073      .9656063     2.178985
   Malinskiy |    28.76348    32.21669      3.00    0.003      3.202203     258.3653
Zhitomirskiy |    1.841395    .6101294      1.84    0.065      .9618535     3.525208
       tvage |    1.022487    .0079534      2.86    0.004      1.007016     1.038194
     emplw13 |    1.747173    .5432576      1.79    0.073      .9498774     3.213694
      inc1w2 |    .2410974    .1021518     -3.36    0.001      .1050854     .5531497
      inc2w2 |    .2922535    .1068632     -3.36    0.001      .1427302     .5984167
      inc3w2 |     .337205    .1308009     -2.80    0.005      .1576578     .7212281
      inc4w2 |    .1127031    .0640196     -3.84    0.000      .0370187     .3431232
-------------+----------------------------------------------------------------

.   estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      4.86        9         0.8461
      ------------+---------------------------------------------------

.   estat concordance

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      154
  Number of comparison pairs (P)      =    10789
  Number of orderings as expected (E)  =     6899
  Number of tied predictions (T)      =       49

          Harrell's C = (E + T/2) / P  =    .6417
                            Somers' D  =    .2834

.   di "Male Pseudo-R2 = ", e(r2_p)
Male Pseudo-R2 =  .0225024

. cap drop m1r2ptb

. gen m1r2ptb = e(r2_p)

. di "m1r2ptb = ", m1r2ptb
m1r2ptb =  .0225024

.
. matrix define mgsocdemT1b = e(b)'

. matrix define mgsocdemT1v = e(V)

. cap drop m1r2pt

.
. gen m1r2pt = e(r2_p)

. str2d stcox  Kyivskiy Malinskiy Zhitomirskiy tvage  emplw13 ///
>   inc1w2-inc4w2  if gender==1

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 10569      152    0.133105    0.044849   0.055579  0.226478  0.802  0.156
--------------------------------------------------------------------------

. cap gen m1r2dt = r(r2)

. cap gen m1llt = e(ll)

. cap gen m1dft = e(rank)

. local modtype1 geosociodemo

. stcox  Kyivskiy Malinskiy Zhitomirskiy tvage  emplw13 ///
>   inc1w2-inc4w2  if gender==1

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Iteration 0:   log likelihood = -636.66339
Iteration 1:   log likelihood = -633.41814
Iteration 2:   log likelihood =  -622.6408
Iteration 3:   log likelihood = -622.34274
Iteration 4:   log likelihood = -622.33694
Iteration 5:   log likelihood = -622.33694
Refining estimates:
Iteration 0:   log likelihood = -622.33694

Cox regression -- Breslow method for ties

No. of subjects =          154                     Number of obs   =       154
No. of failures =          152
Time at risk    =         1980
                                                   LR chi2(9)      =     28.65
Log likelihood  =   -622.33694                     Prob > chi2     =    0.0007

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
    Kyivskiy |    1.450532    .3011604      1.79    0.073      .9656063     2.178985
   Malinskiy |    28.76348    32.21669      3.00    0.003      3.202203     258.3653
Zhitomirskiy |    1.841395    .6101294      1.84    0.065      .9618535     3.525208
       tvage |    1.022487    .0079534      2.86    0.004      1.007016     1.038194
     emplw13 |    1.747173    .5432576      1.79    0.073      .9498774     3.213694
      inc1w2 |    .2410974    .1021518     -3.36    0.001      .1050854     .5531497
      inc2w2 |    .2922535    .1068632     -3.36    0.001      .1427302     .5984167
      inc3w2 |     .337205    .1308009     -2.80    0.005      .1576578     .7212281
      inc4w2 |    .1127031    .0640196     -3.84    0.000      .0370187     .3431232
-------------+----------------------------------------------------------------

. di "m1r2d = ",m1r2d
m1r2d =  .02967568

. cap gen f1r2dt = m1r2dt

.
. di as input " -2 female design-based models"
 -2 female design-based models

. di as input "--geo-socio-demographic trimmed model"
--geo-socio-demographic trimmed model

. des  Irpenskiy Zhitomirskiy ///
>    age occ1w1-occ8w1 occ2w2-occ8w2 occ1w3-occ3w3 occ5w3-occ7w3

              storage  display     value
variable name   type   format      label      variable label
-------------


Irpenskiy         byte     %8.0g                        ranown==67


Zhitomirskiy      byte     %8.0g                        ranown==102


age               byte     %8.0g                    *   Respondent's age


occ1w1            byte     %15.0g        LABJ           profess executive administration in 1986


occ2w1            byte     %15.0g        LABJ           technical sales admin support  in 1986


occ3w1            byte     %15.0g        LABJ           service occup protective services  in 1986


occ4w1            byte     %15.0g        LABJ           precision prod mechan craft construction  in 1986


occ5w1            byte     %15.0g        LABJ           factory laborer machinist transp cleaner  in 1986


occ6w1            byte     %15.0g        LABJ           farming agricul forestry fishing trapping logging  in 1986


occ7w1            byte     %15.0g        LABJ           homemaking or caregiving  in 1986


occ8w1            byte     %15.0g        LABJ           student  in 1986


occ2w2            byte     %15.0g        LABJ           technical sales admin support in 1996


occ3w2            byte     %15.0g        LABJ           service occup protective services in 1996


occ4w2            byte     %15.0g        LABJ           precision prod mechan craft construction in 1996


occ5w2            byte     %15.0g        LABJ           factory laborer machinist transp cleaner in 1996


occ6w2            byte     %15.0g        LABJ           farming agricul forestry fishing trapping logging in 1996


occ7w2            byte     %15.0g        LABJ           homemaking caregiving in 1996


occ8w2            byte     %15.0g        LABJ           student in 1996


occ1w3            byte     %15.0g        LABJ           professional executive administration now


occ2w3            byte     %15.0g        LABJ           technical sales admin support now


occ3w3            byte     %15.0g        LABJ           service occup protective services now


occ5w3            byte     %15.0g        LABJ           factory laborer machinist transp cleaner now


occ6w3            byte     %15.0g        LABJ           farming agricul forestry fishing trapping logging now


occ7w3            byte     %15.0g        LABJ           homemaking or caregiving now


. set more off

. stcox  Irpenskiy Zhitomirskiy ///
>    age occ1w1-occ8w1 occ2w2 occ1w3-occ3w3 occ5w3-occ7w3 if gender==2, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(18)     =     43.26
Log likelihood  =   -776.39392                     Prob > chi2     =    0.0007

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .3808437    .2075558     -1.77    0.077      .1308733     1.108262
Zhitomirskiy |    2.005653    .5729949      2.44    0.015      1.145714     3.511038
         age |     1.01596     .009671      1.66    0.096      .9971805     1.035092
      occ1w1 |    189.8265    231.3212      4.31    0.000      17.42164     2068.354
      occ2w1 |     476.479    628.6976      4.67    0.000      35.88497     6326.665
      occ3w1 |    169.0634    209.6638      4.14    0.000      14.87416     1921.616
      occ4w1 |    47.25783    53.49484      3.41    0.001      5.139635     434.5256
      occ5w1 |    198.6872    254.2804      4.13    0.000      16.17334     2440.843
      occ6w1 |    263.9112    346.1259      4.25    0.000       20.1877     3450.078
      occ7w1 |    121.8906    152.4571      3.84    0.000      10.50299     1414.579
      occ8w1 |    151.1698     185.894      4.08    0.000        13.575     1683.412
      occ2w2 |    .2729525    .1585684     -2.24    0.025      .0874162     .8522797
      occ1w3 |    .0054704    .0066099     -4.31    0.000      .0005123     .0584148
      occ2w3 |    .0062961    .0078852     -4.05    0.000      .0005408     .0733003
      occ3w3 |    .0053138    .0064823     -4.29    0.000      .0004864     .0580478
      occ5w3 |    .0070036    .0091984     -3.78    0.000      .0005338     .0918906
      occ6w3 |    .0072184    .0096262     -3.70    0.000      .0005288     .0985313
      occ7w3 |    .0071062    .0084545     -4.16    0.000      .0006902     .0731703
-------------+----------------------------------------------------------------

.
. matrix define fgsocdemT1b=e(b)'

. matrix define fgsocdemT1v=e(V)

. local modtype1 geosocidemog

. cap gen f1r2pt = e(r2_p)

. cap gen f1llt = e(ll)

. cap gen f1dft = e(rank)

. str2d stcox  Irpenskiy Zhitomirskiy ///
>    age occ1w1-occ8w1 occ2w2 occ1w3-occ3w3 occ5w3-occ7w3 if gender==2, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 11328      182    0.153465    0.043677   0.075365  0.242666  0.871  0.146
--------------------------------------------------------------------------

. cap drop f1r2dt

. gen f1r2dt = r(r2)

. di "f1r2dt = ",f1r2dt
f1r2dt =  .15346491

.
.
. str2d stcox  Irpenskiy Zhitomirskiy ///
>    age occ1w1-occ8w1 occ2w2 occ1w3-occ3w3 occ5w3-occ7w3 if gender==2, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 11328      182    0.153465    0.043677   0.075365  0.242666  0.871  0.146
--------------------------------------------------------------------------

. cap gen f2r2dt = r(r2)

. di "f2r2dt = ",f2r2dt
f2r2dt =  .15346491

. cap gen f1r2dt = m1r2dt

. di "f1r2dt = ", f1r2dt
f1r2dt =  .15346491

. * 2-------male trimmed model  chunk 2  major negative life events
.
. set more off

. stcox  accdw1 cataw1 deaw2 if gender==1, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          154                     Number of obs   =       154
No. of failures =          152
Time at risk    =         1980
                                                   LR chi2(3)      =     20.11
Log likelihood  =   -626.60657                     Prob > chi2     =    0.0002

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
      accdw1 |    3.775052    1.655247      3.03    0.002       1.59844     8.915575
      cataw1 |    1.786592     .339442      3.05    0.002      1.231125     2.592679
       deaw2 |    1.558699     .211399      3.27    0.001      1.194862     2.033325
-------------+----------------------------------------------------------------

. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      1.73        3         0.6295
      ------------+---------------------------------------------------

.
. matrix define m2MNLET2b = e(b)'

. matrix define m2MNLET2v = e(V)

. local modtype2  Major_negative_life_events

. cap drop m2r2pt

. gen m2r2pt = e(r2_p)

. cap gen m2llt= e(ll)

. cap gen m2dft = e(rank)

. cap drop m21r2dcha

.
.
. str2d stcox  accdw1 cataw1 deaw2 if gender==1, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 10569      152    0.108852    0.043170   0.037385  0.201231  0.715  0.159
--------------------------------------------------------------------------

. cap gen m2r2dt = r(r2)

. cap gen f1r2dt = m1r2dt

. di "m2r2dt = ",m2r2dt
m2r2dt =  .10885216

. di "f1r2dt = ",f1r2dt
f1r2dt =  .15346491

. di "m1r2dt = ",m1r2dt
m1r2dt =  .02967568

.
.
. quietly : {
Difference between trimmed models
*******************************************************
Difference between level 2 and level 1 male trimmed models:
Difference between Major_negative_life_events
 and  geosocidemog  models
Pseudo R^2 change:
m2r2d - m1r2d =  .07917648
******************************************************

. di "m2r2dt = ",m2r2dt
m2r2dt =  .10885216

. cap gen m21r2dcha = m2r2d - m1r2dt

. di "m21r2ptcha  = ",m21r2dcha
m21r2ptcha  =  .07917648

.
.
.
.
.
. di as input "Chunk 2--------female trimmed model  chunk 2 major negative life events ---------------------------"
Chunk 2--------female trimmed model  chunk 2 major negative life events ---------------------------

. //wave 1 2 & 3
. des deaw1 cataw1 accdw2 accdw3 cataw3

              storage  display     value
variable name   type   format      label      variable label
-------------


deaw1             byte     %8.0g                        Total number of death experienced in time period 1986


cataw1            byte     %8.0g                        Total number of disasters experienced in time period 1976-1986


accdw2            byte     %8.0g                        Total number of accidents experienced in time period 1987-1996


accdw3            byte     %8.0g                        Total number of accidents experienced in time period 1996-NOW


cataw3            byte     %8.0g                        Total number of disasters experienced in time period 1996-NOW


. *  female major negative life events Trimmed model
. set more off

. stcox deaw1 cataw1 accdw2 accdw3 cataw3 if gender==2, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(5)      =     27.01
Log likelihood  =   -784.52046                     Prob > chi2     =    0.0001

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
       deaw1 |    1.692344    .2263099      3.93    0.000      1.302151     2.199461
      cataw1 |    1.810502    .3933043      2.73    0.006      1.182738     2.771467
      accdw2 |    1.386542    .2780507      1.63    0.103      .9359163     2.054135
      accdw3 |    1.650754    .3321571      2.49    0.013      1.112775     2.448822
      cataw3 |    3.372636    2.434525      1.68    0.092      .8194696     13.88053
-------------+----------------------------------------------------------------

. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      7.82        5         0.1667
      ------------+---------------------------------------------------

.
. matrix define f2MNLET2b = e(b)'

. matrix define f2MNLET2v = e(V)

. cap drop f2r2dt

. str2d stcox deaw1 cataw1 accdw2 accdw3 cataw3 if gender==2, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 11328      182    0.126001    0.041080   0.054845  0.211876  0.777  0.145
--------------------------------------------------------------------------

. cap gen f2r2dt = r(r2)

. cap gen f2llt = e(ll)

. cap gen f2dft = e(rank)

. local modtype2 Major_negative_life_events

. di "f2r2dt = ",f2r2dt
f2r2dt =  .12600078

. di "f1r2dt = ",f1r2dt
f1r2dt =  .15346491

. cap gen f21r2dcha = f2r2dt - f1r2dt

.
. qui : {
Difference between female trimmed models
*******************************************************
Difference between level 2 and level 1 female trimmed models:
Difference between Major_negative_life_events
 and  geosocidemog  models
f2r2dt =  .12600078
f1r2dt =  .15346491
Pseudo R^2 change:
f2r2dt - f1r2dt =  -.02746414
******************************************************

.
. qui: {
f2r2dt =  .12600078
f21r2dcha =  -.02746414

. di "{hline}"
-------------

. **********  Chunk 3 Stresses and hassles **************************************
.
. di as input "Chunk 3 ---------Male daily stresses and hassles trimmed model"
Chunk 3 ---------Male daily stresses and hassles trimmed model

. set more off

. cap gen inter = _t*shrelaw1

. cap gen inter3 = _t^3*shrelaw1

. stcox  shrelaw1 if gender==1, iterate(10) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          154                     Number of obs   =       154
No. of failures =          152
Time at risk    =         1980
                                                   LR chi2(1)      =      2.71
Log likelihood  =   -635.30891                     Prob > chi2     =    0.0998

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
    shrelaw1 |     1.00367    .0022093      1.66    0.096      .9993496      1.00801
-------------+----------------------------------------------------------------

. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      shrelaw1    |     -0.16842         4.29        1         0.0383
      ------------+---------------------------------------------------
      global test |                      4.29        1         0.0383
      ------------+---------------------------------------------------

. estat phtest, plot(shrelaw1)

. lowess shrelaw1 _t, title(Testing functional form)

. stphplot, by(gender) title(stratification by gender)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

. stphplot, by(agegrp3) title(Stratification by age group)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

. kdensity age, xline(48 66)

.
.
. // fractional polynomial adjustment
. fracpoly, compare: stcox shrelaw1
........
-> gen double Ishre__1 = X^-2-7.85403859 if e(sample)
-> gen double Ishre__2 = X^-2*ln(X)+8.093696212 if e(sample)
   (where: X = (shrelaw1+1)/100)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Iteration 0:   log likelihood = -1662.1784
Iteration 1:   log likelihood = -1656.4864
Iteration 2:   log likelihood = -1656.3791
Iteration 3:   log likelihood =  -1656.379
Refining estimates:
Iteration 0:   log likelihood =  -1656.379

Cox regression -- Breslow method for ties

No. of subjects =          340                     Number of obs   =       340
No. of failures =          334
Time at risk    =         4340
                                                   LR chi2(2)      =     11.60
Log likelihood  =    -1656.379                     Prob > chi2     =    0.0030

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
    Ishre__1 |    1.004816    .0028825      1.67    0.094      .9991825     1.010482
    Ishre__2 |     1.00105    .0006227      1.69    0.092      .9998304     1.002271
-------------+----------------------------------------------------------------
Deviance:  3312.76. Best powers of shrelaw1 among 44 models fit: -2 -2.

Fractional polynomial model comparisons:
---------------------------------------------------------------
shrelaw1         df       Deviance   Dev. dif.  P (*)  Powers
---------------------------------------------------------------
Not in model      0       3324.357    11.599    0.021
Linear            1       3321.644     8.886    0.031  1
m = 1             2       3315.371     2.612    0.271  -2
m = 2             4       3312.758        --       --  -2 -2
---------------------------------------------------------------
(*) P-value from deviance difference comparing reported model with m = 2 model

. stcox Ishre__2 if gender==1

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Iteration 0:   log likelihood = -636.66339
Iteration 1:   log likelihood = -634.64007
Iteration 2:   log likelihood = -634.63718
Refining estimates:
Iteration 0:   log likelihood = -634.63718

Cox regression -- Breslow method for ties

No. of subjects =          154                     Number of obs   =       154
No. of failures =          152
Time at risk    =         1980
                                                   LR chi2(1)      =      4.05
Log likelihood  =   -634.63718                     Prob > chi2     =    0.0441

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
    Ishre__2 |    1.000007    3.79e-06      1.98    0.048             1     1.000015
-------------+----------------------------------------------------------------

. // Therefore we are using ln([shrelaw1 + 1]/100)-2*ln([shrelaw1 + 1]/100) + 8.0936
. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      5.79        1         0.0161
      ------------+---------------------------------------------------

. //kdensity age, xline(48 66)
. cap gen young=0

. replace young=1 if age <= 48
(0 real changes made)

. cap gen middle = 0

. replace middle=1 if age > 48 & age < 66
(0 real changes made)

. cap gen older = 0

. replace older=1 if age >= 66
(0 real changes made)

. label var young "Under 49 years of age"

. label var middle "Between 48 and 65 yrs old"

. label var older "66 plus years old"

. // this does not work so we have to find a new solution
.
. // we examine a piecewise solution with a cutoff of shrelaw1 at 13
.
. kdensity shrelaw1 if gender==1,  xline(13)

. gr save kdshrlw.gph, replace
(file kdshrlw.gph saved)

. gr export kdshrlw.eps, replace
(file kdshrlw.eps written in EPS format)

.
. // using a split file to construct a dataset with a cutoff function at shrelaw1 = 13
. cap stsplit shrlaw1cat, at(13)

. tab shrlaw1cat

 shrlaw1cat |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |        340       71.58       71.58
         13 |        135       28.42      100.00
------------+-----------------------------------
      Total |        475      100.00

. cap drop shrelawold1

. cap gen shrelawold1 = shrelaw1*shrlaw1cat

. gr save shrelawm.gph,replace
(file shrelawm.gph saved)

. gr export shrelawmtrans.eps, replace
(file shrelawmtrans.eps written in EPS format)

.
.
. **** re-estimate spline function of the variable under consideration **********
. // we model a piecewise solution with one function for shrelaw1 <= 13 and another for shrelaw1 > 13
. stcox shrelaw1 shrelawold1 if gender==1, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          154                     Number of obs   =       154
No. of failures =          152
Time at risk    =         1980
                                                   LR chi2(2)      =     23.30
Log likelihood  =   -625.01347                     Prob > chi2     =    0.0000

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
    shrelaw1 |    1.008691    .0023911      3.65    0.000      1.004015     1.013388
 shrelawold1 |    .9986048    .0003548     -3.93    0.000      .9979095     .9993005
-------------+----------------------------------------------------------------

. estat phtest       // this assumption is still violated

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      5.26        2         0.0720
      ------------+---------------------------------------------------

. stjoin  // returns the data set to the proper structure for continued analysis
(option censored(0) assumed)
(0 obs. eliminated)

.
. // We will try a spline or fractional polynomial transformation of shrelaw1
.
. str2d stcox shrelaw1 shrelawold1 if gender==1, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
   214      152    0.106471    0.038513   0.041565  0.188612  0.706  0.143
--------------------------------------------------------------------------

.
.
. matrix define m3shtb = e(b)'

. matrix define m3shtv = e(V)

. local modtype3 stress_and_hassles

. cap gen m3r2dt = r(r2)

. cap gen m3r2ptx = e(r2_p)

. di "m3r2ptx = ",m3r2ptx
m3r2ptx =  .00682757

. label var m3r2ptx "Piecewise Shrelaw1 for seniors"

. cap gen m3llt = e(ll)

. cap gen m3dft = e(rank)

. cap gen m32r2dcha = m3r2dt - m2r2dt

. scalar m3r2dt = m3r2dt

. str2d stcox shrelaw1 shrelawold1 if gender==1, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
   214      152    0.106471    0.038513   0.041565  0.188612  0.706  0.143
--------------------------------------------------------------------------

. cap gen m3r2dt = r(r2)

.
. qui : {
Difference between male trimmed models
*******************************************************
Difference between level 3 and level 2 male trimmed models:
Difference between stress_and_hassles
 and  Major_negative_life_events  models
m3r2dt =  .10647088
m2r2pt =  .01579614
Pseudo R^2 change:
m3r2dt - m2r2dt =  -.00238129
******************************************************

.
.
. // displaying the pseudo-R^2
.
. di "m3r2ptd = ",m3r2dt
m3r2ptd =  .10647088

. cap gen m32r2dcha = m3r2dt - m2r2dt

. qui: {
m21r2dcha =   .07917648
m32r2dcha =   -.00238129

. stjoin  // re-structuring the dataset
(option censored(0) assumed)
(0 obs. eliminated)

.
. di as input "Chunk 3--------female trimmed model stressors and hassles ---------------------------"
Chunk 3--------female trimmed model stressors and hassles ---------------------------

. di as input "female stresses and hassles"
female stresses and hassles

. set more off

.
. des shjobw1 movew2 shhousw3

              storage  display     value
variable name   type   format      label      variable label
-------------


shjobw1           byte     %8.0g                        Percentage of strains and hassles related to job in 1986


movew2            byte     %8.0g                        Total number of moves experienced in time period 1987-1996


shhousw3          byte     %8.0g                        Percentage of strains and hassles related to housing NOW


. stcox shjobw1 movew2 shhousw3 if gender==2, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(3)      =     19.66
Log likelihood  =   -788.19555                     Prob > chi2     =    0.0002

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
     shjobw1 |    1.005325    .0022979      2.32    0.020      1.000831     1.009839
      movew2 |      1.4028    .2596858      1.83    0.067      .9759365     2.016368
    shhousw3 |    1.005342    .0023097      2.32    0.020      1.000826      1.00988
-------------+----------------------------------------------------------------

. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      shjobw1     |     -0.11635         2.72        1         0.0992
      movew2      |      0.09612         1.71        1         0.1915
      shhousw3    |     -0.07551         1.03        1         0.3090
      ------------+---------------------------------------------------
      global test |                      7.14        3         0.0676
      ------------+---------------------------------------------------

.
.
. cap drop f3shbt

.
. str2d stcox shjobw1 movew2 shhousw3 if gender==2, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 11328      182    0.067146    0.029624   0.020299  0.133571  0.549  0.130
--------------------------------------------------------------------------

. matrix define f3shbt = e(b)'

. cap drop f3shvt

. matrix define f3shvt = e(V)

. cap drop f3r2pt

.
. cap gen f3r2dt = r(r2)

. di as input "f3r2dt = ", f3r2dt
f3r2dt =  .06714559

. cap gen f3llt = e(ll)

. cap gen f3dft = e(rank)

. local modtype stresses_hassles

. cap drop f32r2dcha

. gen f32r2dcha = f3r2dt - f2r2dt

.
. qui : {
Difference between female trimmed models
*******************************************************
Difference between level 3 and level 2 female trimmed models:
Difference between stress_and_hassles
 and  Major_negative_life_events  models
f3r2dt =  .06714559
f2r2dt =  .12600078
Pseudo R^2 change:
f3r2dt - f2r2dt =  -.05885519
******************************************************

.
. qui : {
Between Major_negative_life_events and geosocidemog female trimmed models:
 f21r2dcha =  -.02746414
Between stress_and_hassles and Major_negative_life_events female trimmed models:
 f32r2dcha =  -.05885519

.
. di "{hline}"
-------------

. ******************** 4  Buffers and Supports ****************************
.
. di as input "-- Chunk 4 trimmed Buffers and supports models-------"
-- Chunk 4 trimmed Buffers and supports models-------

. di as input "Male Buffers and supports trimmed model"
Male Buffers and supports trimmed model

. set more off

. ** waves 1 2 and 3
. des sufamw2

              storage  display     value
variable name   type   format      label      variable label
-------------


sufamw2           byte     %8.0g                        Level of support (in percent) from family in 1996


. set more off

.  stcox sufamw3 if gender==1, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          154                     Number of obs   =       154
No. of failures =          152
Time at risk    =         1980
                                                   LR chi2(1)      =      8.09
Log likelihood  =   -632.61767                     Prob > chi2     =    0.0044

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
     sufamw3 |    1.005586    .0019758      2.83    0.005      1.001721     1.009466
-------------+----------------------------------------------------------------

.  estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      sufamw3     |     -0.08844         1.17        1         0.2794
      ------------+---------------------------------------------------
      global test |                      1.17        1         0.2794
      ------------+---------------------------------------------------

. local modtype4 BuffersSupts

. matrix define m4bsbt = e(b)'

. matrix define m4bsvt = e(V)

. di "`modtype4'"
BuffersSupts

. cap drop m4rpt

. cap gen m4r2pt = e(r2_p)

. cap gen m4llt = e(ll)

. cap gen m4dft = e(rank)

.
. str2d stcox sufamw3 if gender==1, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 10538      152    0.049584    0.031690   0.006037  0.125559  0.467  0.157
--------------------------------------------------------------------------

. cap gen m4r2dt = r(r2)

. cap drop m43r2pcha

. cap gen m43r2dcha = m4r2dt - m3r2dt

.
. label var m43r2dcha "R square change betwn male trimmed models of `modtype4' and `modtype3'"

. qui : {
Difference between male trimmed models
*******************************************************
Difference between level 4 and level 3 male trimmed models:
Difference between BuffersSupts
 and  stress_and_hassles  models
m4r2dt =  .0495838
m3r2dt =  .10647088
Pseudo R^2 change:
m4r2dt - m3r2dt =  -.05688707
******************************************************

.
. qui : {
Between Major_negative_life_events and geosocidemog male trimmed models:
 m21r2dcha =  .07917648
Between stress_and_hassles and Major_negative_life_events male trimmed models:
 m32r2dcha =  -.00238129
Between BuffersSupts and stress_and_hassles male trimmed models:
 m43r2dcha =  -.05688707

.
.
.
.
. di as input "Chunk 4--------Buffers and supports -----------bs----------------"
Chunk 4--------Buffers and supports -----------bs----------------

. di as input "Female Buffers and supports trimmed model"
Female Buffers and supports trimmed model

. des suprtw2 sufamw2

              storage  display     value
variable name   type   format      label      variable label
-------------


suprtw2           byte     %8.0g                        Level of support (in percent) from partner in 1996


sufamw2           byte     %8.0g                        Level of support (in percent) from family in 1996


. set more off

. ** waves 1 2 and 3
. set more off

.  stcox suprtw2 sufamw2 if gender==2, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(2)      =      4.02
Log likelihood  =   -796.01746                     Prob > chi2     =    0.1342

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
     suprtw2 |    1.004734    .0025141      1.89    0.059      .9998182     1.009673
     sufamw2 |    .9956006    .0027218     -1.61    0.107      .9902803      1.00095
-------------+----------------------------------------------------------------

.  estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      suprtw2     |     -0.00949         0.02        1         0.9017
      sufamw2     |      0.00301         0.00        1         0.9691
      ------------+---------------------------------------------------
      global test |                      0.02        2         0.9906
      ------------+---------------------------------------------------

.
. matrix define f4bsbt = e(b)'

. matrix define f4bsvt = e(V)

. local modtype4 buffers_and_supports

. str2d  stcox suprtw2 sufamw2 if gender==2, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 11328      182    0.009429    0.011080   0.000056  0.042619  0.200  0.118
--------------------------------------------------------------------------

. cap drop f4r2pt

. cap gen f4r2dt = r(r2)

. cap gen f4llt = e(ll)

. cap gen f4dft = e(rank)

. cap drop f43r2dcha

.  gen f43r2dcha = f4r2dt - f3r2dt

. label var f43r2dcha "R square change bet female trimmed models of `modtype4' and `modtype3'"
note: label truncated to 80 characters

. qui : {
Difference between female trimmed models
*******************************************************
Difference between level 4 and level 3 female trimmed models:
Difference between buffers_and_supports
 and  stress_and_hassles  models
f4r2dt =  .00942887
f3r2dt =  .06714559
Pseudo R^2 change:
f4r2dt - f3r2dt =  -.05771671
******************************************************

.
. qui : {
Between Major_negative_life_events and geosocidemog for female trimmed models:
 f21r2dcha =  -.02746414
Between stress_and_hassles and Major_negative_life_events for female trimmed models:
 f32r2dcha =  -.05885519
Between buffers_and_supports and stress_and_hassles for female trimmed models:
 f43r2dcha =  -.05771671

.
. forvalues i = 1/10 {
  2.   forvalues j=1/3 {
  3.      label var nil`i'w`j' "Type of illness `i' self-rptd in wave `j'"
  4.      }
  5.      }

.
.   forvalues i = 1/10 {
  2.    label var nil`i'w1 "Type of illness `i' slf-rptd from 1977 to 1986"
  3.    }

.
.
.   forvalues i=1/10 {
  2.     label var nil`i'w2 "Type of illness `i' slf-rptd from 1987 thru 1996"
  3.     }

.
.
.   forvalues i=1/10 {
  2.     label var nil`i'w3 "Type of illness `i' slf-rptd from 1997 thru now"
  3.     }

.
.      label define ill862 1 "cancer"  2 "cardiovascular" 3 "dermatologic" ///
>            4 "endocrine/metabolic" 5 "gastrointestinal" 6 "genitourinary"  ///
>            7  "hematological"  8 "infectious" 9 "musculoskeletal" ///
>            10 "neurological" 11 "psychiatric" 12 "peripheral vascular" ///
>            13 "respiratory" 14 "rheumatologic" 15 "tumors"  16 "visual or hearing prbs" ///
>            17 "substance use" 18 "surgery (any type)", modify

.
.
.
.       forvalues i=1/3 {
  2.        forvalues x = 1/10 {
  3.           label define illsr`x'w`i' 1 "cancer`x' w`i'"  2 "cardiovascular`x' w`i'" 3 "dermatologic`x' w`i'" ///
>            4 "endocrine/metabolic`x' w`i'" 5 "gastrointestinal`x' w`i'" 6 "genitourinary`x' w`i'"  ///
>            7  "hematological`x' w`i'"  8 "infectious`x' w`i'" 9 "musculoskeletal`x' w`i'" ///
>            10 "neurological`x' w`i'" 11 "psychiatric`x' w`i'" 12 "peripheral vascular`x' w`i'" ///
>            13 "respiratory`x' w`i'" 14 "rheumatologic`x' w`i'" 15 "tumors`x' w`i'"  16 "visual or hearing prbs`x' w`i'" ///
>            17 "substance use`x' w`i'" 18 "surgery(any type)`x' w`i'", modify
  4.            }
  5.            }

.
.       forvalues j=1/3 {
  2.       forvalues i=1/10 {
  3.         label values nil`i'w`j' illsr`i'w`j'
  4.         }
  5.         }

.    save stcox1trans4mar2012master, replace
file stcox1trans4mar2012master.dta saved

.
.    forvalues i=1/10 {
  2.    forvalues j=1/3 {
  3.   cap   dummieslab nil`i'w`j'
  4.      }
  5.      }

.
.
. di "{hline}"
-------------

. di "Self-perceived health or illness"
Self-perceived health or illness

. ******************* Chunk 5 Self-Perceived Illnesses*******************************
. di as input "Chunk 5------- Male self-perceived illness mspi ----------------------"
Chunk 5------- Male self-perceived illness mspi ----------------------

. des mhlthw1-mhlthw3 phlthw1-phlthw3

              storage  display     value
variable name   type   format      label      variable label
-------------


mhlthw1           byte     %8.0g                        level of general psychological/mental health in 1986


mhlthw2           byte     %8.0g                        level of general psychological/mental health in 1996


mhlthw3           byte     %8.0g                        level of general psychological/mental health now


phlthw1           byte     %8.0g                        level of general physical health in 1986


phlthw2           byte     %8.0g                        level of general physical health in 1996


phlthw3           byte     %8.0g                        level of general physical health now


. summ mhlthw1 mhlthw2 mhlthw3 if gender==1

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
     mhlthw1 |     10569    94.92979    12.55687          0        100
     mhlthw2 |     10569    89.98269    16.66722          0        100
     mhlthw3 |     10569    82.48434    21.78865          0        100

. summ phlthw1 phlthw2 phlthw3 if gender==1

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
     phlthw1 |     10569    93.37156    13.87496          0        100
     phlthw2 |     10569      84.601    17.66839          0        100
     phlthw3 |     10569    71.83262    22.03171          0        100

. stcox cardiovascular1w1 respiratory1w1 mhlthw2 if gender==1, nolog //2 good

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =           40                     Number of obs   =        40
No. of failures =           39
Time at risk    =          413
                                                   LR chi2(3)      =     10.05
Log likelihood  =   -108.85728                     Prob > chi2     =    0.0181

--------------+----------------------------------------------------------------
            _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
cardiovas~1w1 |     2.46601    1.035718      2.15    0.032       1.08266      5.61691
respirato~1w1 |    17.40503     16.3103      3.05    0.002      2.773394      109.229
      mhlthw2 |    1.006864    .0135753      0.51    0.612      .9806052     1.033826
--------------+----------------------------------------------------------------

. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      0.06        3         0.9960
      ------------+---------------------------------------------------

. cap stcox cardiovascular1w2-surgeryanytype1w2 if gender==1, nolog  // nothing

. cap stcox cardiovascular1w3-surgeryanytype1w3 if gender==1, nolog  // nothing

. cap stcox dermatologic2w2 gastrointestinal2w2 peripheralvascular2w2 if gender==1, nolog  // nothing

. cap stcox dermatologic2w3 gastrointestinal2w3 peripheralvascular2w3 if gender==1, nolog  // nothing

. cap stcox cardiovascular2w3-surgeryanytype3w3 if gender==1, nolog  // nothing

. cap stcox cardiovascular2w1 if gender==1, nolog  // insufficient obs

. *stcox respiratory4w1-rheumatologic4w1 if gender==1, nolog  // nothing
.
. *stcox  gastrointestinal2w2  if gender==1, nolog  // nothing
. *stcox respiratory4w1-rheumatologic4w1 if gender==1, nolog  // nothing
. *stcox respiratory4w1-rheumatologic4w1 if gender==2, nolog  // nothing
.
. *stcox cardiovascular2w3-surgeryanytype2w3 if gender==1, nolog  // nothing
. stcox  neurological2w3 peripheralvascular2w3 rheumatologic2w3 if gender==1, nolog // 2 good

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =           68                     Number of obs   =        68
No. of failures =           68
Time at risk    =          808
                                                   LR chi2(3)      =      7.71
Log likelihood  =   -224.57886                     Prob > chi2     =    0.0523

--------------+----------------------------------------------------------------
            _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
neurologi~2w3 |    2.202126    .9794686      1.77    0.076      .9209626     5.265532
periphera~2w3 |    1.731672    .8321355      1.14    0.253      .6751967     4.441206
rheumatol~2w3 |    3.073246    1.347921      2.56    0.010      1.300953      7.25994
--------------+----------------------------------------------------------------

. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      0.51        3         0.9163
      ------------+---------------------------------------------------

. *stcox cardiovascular3w1-respiratory3w1 if gender==1, nolog // nothing
.
. str2d stcox  neurological2w3 peripheralvascular2w3 rheumatologic2w3 if gender==1, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
  3464       68    0.141553    0.082830   0.017880  0.314490  0.831  0.283
--------------------------------------------------------------------------

. cap drop m5r2dt

. gen m5r2dt = r(r2)

. di "m5r2dt = ",m5r2dt
m5r2dt =  .14155276

. cap gen m54r2dcha = m5r2dt - m4r2dt

. di "m54r2dcha = ", m54r2dcha
m54r2dcha =  .09196895

.
.
.
.
. di as input "Chunk 5--------Self-perceived illnesses -----------spi----------------"
Chunk 5--------Self-perceived illnesses -----------spi----------------

. di as input "male self-perceived illness-- trimmed"
male self-perceived illness-- trimmed

. set more off

. ** waves 1 2 and 3
. set more off

. des mhlthw2 cardiovascular1w1 respiratory1w1

              storage  display     value
variable name   type   format      label      variable label
-------------


mhlthw2           byte     %8.0g                        level of general psychological/mental health in 1996


cardiovascu~1w1   byte     %8.0g                        nil1w1==2


respiratory1w1    byte     %8.0g                        nil1w1==13


. summ mhlthw2  if gender==1

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
     mhlthw2 |     10569    89.98269    16.66722          0        100

.
.
. stcox cardiovascular1w1 respiratory1w1  mhlthw2  if gender==1, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =           40                     Number of obs   =        40
No. of failures =           39
Time at risk    =          413
                                                   LR chi2(3)      =     10.05
Log likelihood  =   -108.85728                     Prob > chi2     =    0.0181

--------------+----------------------------------------------------------------
            _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
cardiovas~1w1 |     2.46601    1.035718      2.15    0.032       1.08266      5.61691
respirato~1w1 |    17.40503     16.3103      3.05    0.002      2.773394      109.229
      mhlthw2 |    1.006864    .0135753      0.51    0.612      .9806052     1.033826
--------------+----------------------------------------------------------------

. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      0.06        3         0.9960
      ------------+---------------------------------------------------

. estat concordance

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =       40
  Number of comparison pairs (P)      =      709
  Number of orderings as expected (E)  =      420
  Number of tied predictions (T)      =       86

          Harrell's C = (E + T/2) / P  =     .653
                            Somers' D  =    .3061

.
. matrix define m5bstb = e(b)'

. matrix define m5bstv = e(V)

. local modtype5 Self_perceived_illnesses

. str2d stcox cardiovascular1w1 respiratory1w1  mhlthw2  if gender==1, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
  2210       39    0.156939    0.106906   0.008686  0.374090  0.883  0.357
--------------------------------------------------------------------------

. cap gen m5r2d = e(r2_p)

. cap gen m5llt = e(ll)

. cap gen m5dft = e(rank)

. cap gen m54r2dcha = m5r2d - m4r2d

. label var m54r2dcha "R sq. chnge bet female trimmed models of `modtype4' and `modtype3'"
note: label truncated to 80 characters

. qui : {
Difference between male trimmed models
*******************************************************
Difference between level 5 and level 4 female trimmed models:
Difference between Self_perceived_illnesses
 and  buffers_and_supports  models
m5r2d =  .04413959
m4r2d =  .0495838
Pseudo R^2 change:
m5r2d - m4r2d =  -.00544421
******************************************************

.
. qui : {
Between Major_negative_life_events and geosocidemog for male full models:
 m21r2dcha =  .07917648
Between stress_and_hassles and Major_negative_life_events for male full models:
 m32r2dcha =  -.00238129
Between buffers_and_supports and stress_and_hassles for male full models:
m43r2dcha =  -.05688707
Between Self_perceived_illnesses and buffers_and_supports for male full models:
m54r2dcha =  .09196895

.
.
. des Zhitomirskiy age mar3w2 mar3w3   emplw23 occ2w2 occ4w2  deaw1 deaw2 ///
>   accdw3 shhousw1 shhlw2  shfamw3  phlthw2

              storage  display     value
variable name   type   format      label      variable label
-------------


Zhitomirskiy      byte     %8.0g                        ranown==102


age               byte     %8.0g                    *   Respondent's age


mar3w2            byte     %9.0g                        married in 1996


mar3w3            byte     %9.0g                        married at interview


emplw23           byte     %8.0g                        emplw2==2. part time


occ2w2            byte     %15.0g        LABJ           technical sales admin support in 1996


occ4w2            byte     %15.0g        LABJ           precision prod mechan craft construction in 1996


deaw1             byte     %8.0g                        Total number of death experienced in time period 1986


deaw2             byte     %8.0g                        Total number of death experienced in time period 1996


accdw3            byte     %8.0g                        Total number of accidents experienced in time period 1996-NOW


shhousw1          byte     %8.0g                        Percentage of strains and hassles related to housing in 1986


shhlw2            byte     %8.0g                        Percentage of strains and hassles related to health in 1996


shfamw3           byte     %8.0g                        Percentage of strains and hassles related to family NOW


phlthw2           byte     %8.0g                        level of general physical health in 1996


.  stcox age phlthw2  if gender==1, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          154                     Number of obs   =       154
No. of failures =          152
Time at risk    =         1980
                                                   LR chi2(2)      =      9.81
Log likelihood  =   -631.75629                     Prob > chi2     =    0.0074

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
         age |    1.013453    .0072763      1.86    0.063      .9992917     1.027815
     phlthw2 |     .990045    .0040106     -2.47    0.014      .9822154      .997937
-------------+----------------------------------------------------------------

.
.
.
.
.
. *----chunk five for the female respondents
.
.  set more off

. cap stcox cardiovascular1w1-surgeryanytype1w1 if gender==2, nolog // general scan

. stcox peripheralvascular1w1-rheumatologic1w1 if gender==2, nolog // 3  good

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =           56                     Number of obs   =        56
No. of failures =           54
Time at risk    =          648
                                                   LR chi2(3)      =     10.76
Log likelihood  =   -170.13165                     Prob > chi2     =    0.0131

--------------+----------------------------------------------------------------
            _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
periphera~1w1 |    3.536546    1.946549      2.29    0.022      1.202458     10.40133
respirato~1w1 |    2.849314    1.249358      2.39    0.017      1.206447     6.729339
rheumatol~1w1 |       3.469    1.778293      2.43    0.015      1.270158     9.474378
--------------+----------------------------------------------------------------

. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      0.38        3         0.9443
      ------------+---------------------------------------------------

.
.
. *stcox cardiovascular2w2-surgeryanytype2w2 if gender==2, nolog  // nothing
. *stcox cardiovascular2w3-surgeryanytype2w3 if gender==2, nolog
. stcox dermatologic2w3  respiratory2w3  if gender==2, nolog     // 2 good

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          122                     Number of obs   =       122
No. of failures =          121
Time at risk    =         1451
                                                   LR chi2(2)      =     10.76
Log likelihood  =   -471.45845                     Prob > chi2     =    0.0046

--------------+----------------------------------------------------------------
            _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
dermatolo~2w3 |    11.51334     8.83881      3.18    0.001      2.557008     51.84062
respirato~2w3 |    .4789706    .1781757     -1.98    0.048      .2310278     .9930096
--------------+----------------------------------------------------------------

. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      0.95        2         0.6222
      ------------+---------------------------------------------------

. *stcox cardiovascular3w3-respiratory3w3 if gender==1, nolog // nothing
. * stcox cardiovascular3w3-respiratory3w3 if gender==2, nolog // nothing
. stcox peripheralvascular1w1-rheumatologic1w1 phlthw3 if gender==2, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =           56                     Number of obs   =        56
No. of failures =           54
Time at risk    =          648
                                                   LR chi2(4)      =     16.03
Log likelihood  =   -167.49592                     Prob > chi2     =    0.0030

--------------+----------------------------------------------------------------
            _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
periphera~1w1 |    3.258426    1.791191      2.15    0.032      1.109413     9.570227
respirato~1w1 |    2.884991    1.258535      2.43    0.015      1.226931     6.783733
rheumatol~1w1 |    2.450852    1.294124      1.70    0.090      .8706763      6.89886
      phlthw3 |    .9814799    .0079709     -2.30    0.021      .9659809     .9972276
--------------+----------------------------------------------------------------

. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      peripher~1w1 |     0.00289         0.00        1         0.9832
      respirat~1w1 |     0.06024         0.21        1         0.6453
      rheumato~1w1 |     0.08398         0.38        1         0.5364
      phlthw3     |      0.15631         1.26        1         0.2618
      ------------+---------------------------------------------------
      global test |                      1.61        4         0.8061
      ------------+---------------------------------------------------

. estat concordance

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =       56
  Number of comparison pairs (P)      =     1360
  Number of orderings as expected (E)  =      912
  Number of tied predictions (T)      =      110

          Harrell's C = (E + T/2) / P  =     .711
                            Somers' D  =    .4221

. matrix define f5bsbt = e(b)'

. matrix define f5bsvt = e(V)

. local modtype5 Self-Perceived Illnesses

.
. str2d stcox peripheralvascular1w1-rheumatologic1w1 phlthw3 if gender==2, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
  3489       54    0.189828    0.078103   0.055822  0.344501  0.991  0.252
--------------------------------------------------------------------------

.
. cap gen f5r2dt = r(r2)

. cap gen f5llt = e(ll)

. cap gen f5dft = e(rank)

. cap gen f54r2dcha = f5r2dt - f4r2dt

. label var f43r2pfcha "R square change bet female trimmed models of `modtype5' and `modtype4'"
note: label truncated to 80 characters

. qui : {
Difference between female trimmed models
*******************************************************
Difference between level 5 and level 4 female trimmed models:
Difference between Self-Perceived Illnesses
 and  buffers_and_supports  models
f5r2dt =  .1898281
f4r2dt =  .00942887
Pseudo R^2 change:
f5r2dt - f4r2dt =  .18039922
******************************************************

.
. qui : {
Between Major_negative_life_events and geosocidemog for female trimmed models:
 f21r2dcha =  -.02746414
Between stress_and_hassles and Major_negative_life_events for female trimmed models:
 f32r2dcha =  -.05885519
Between buffers_and_supports and stress_and_hassles for female trimmed models:
 f43r2dcha =  -.05771671
Between Self-Perceived Illnesses and buffers_and_supports for female trimmed models:
 f54r2dcha =  .18039922

.
. qui : {
Adding Major_negative_life_events to geosocidemog female trimmed models:
f1r2pf =  .05859507
f2r2pf =  .08105822
Adding stress_and_hassles to Major_negative_life_events female trimmed models:
f3r2pf =  .0999422
Adding buffers_and_supports to stress_and_hassles female trimmed models:
 f4r2dt =  .00942887
Adding Self-Perceived Illnesses to buffers_and_supports female trimmed models:
 f5r2dt =  .1898281

.
.
.
. di "{hline}"
-------------

. ******  Medical diagnosis
.
. di as input "*--chunk ---6 --------- Male medical diagnosis ---------mmd------------------"
*--chunk ---6 --------- Male medical diagnosis ---------mmd------------------

. di as input "Trimmed model"
Trimmed model

. set more off

.  des  icdx3nr9-icdx3nr10 ///
>            icdx4nr9

              storage  display     value
variable name   type   format      label      variable label
-------------


icdx3nr9          byte     %8.0g                        icdx3nr==gastritis/duodenitis


icdx3nr10         byte     %8.0g                        icdx3nr==575.1 cholecystitis


icdx4nr9          byte     %8.0g                        icdx4nr==434.91 crbrl art ocl nos w infarc


.   stcox  icdx3nr9-icdx3nr10 ///
>            icdx4nr9 if gender==1, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          154                     Number of obs   =       154
No. of failures =          152
Time at risk    =         1980
                                                   LR chi2(3)      =     10.58
Log likelihood  =   -631.37264                     Prob > chi2     =    0.0142

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
    icdx3nr9 |    2.228061    .9335263      1.91    0.056      .9801345     5.064873
   icdx3nr10 |    11.72413    12.17174      2.37    0.018      1.532432     89.69743
    icdx4nr9 |    33.78582    37.10585      3.21    0.001      3.925435     290.7911
-------------+----------------------------------------------------------------

. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      icdx3nr9    |     -0.06435         0.61        1         0.4345
      icdx3nr10   |      0.01588         0.04        1         0.8454
      icdx4nr9    |      0.00298         0.00        1         0.9707
      ------------+---------------------------------------------------
      global test |                      0.66        3         0.8826
      ------------+---------------------------------------------------

.
. matrix define m6bmmdbt = e(b)'

. matrix define m6mmdvt = e(V)

. str2d  stcox  icdx3nr9-icdx3nr10 ///
>            icdx4nr9 if gender==1, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 10569      152    0.156664    0.083503   0.026213  0.327572  0.882  0.279
--------------------------------------------------------------------------

.            local modtype6 Medical_Diag

. cap gen m6r2dt = r(r2)

. cap gen m6llt = e(ll)

. cap gen m6dft = e(rank)

. cap gen m65r2dcha = m6r2dt - m5r2dt

.
. label var m65r2pfcha "R square chnge bet male trimmed models of `modtype6' and `modtype5'"
note: label truncated to 80 characters

. qui : {
Difference between male trimmed models
*******************************************************
Difference between level 6 and level 5 male trimmed models:
Difference between Medical_Diag
 and  Self-Perceived Illnesses  models
mdt6r2dt =  .15666422
m5r2dt =  .14155276
Pseudo R^2 change:
m6r2dt - m5r2dt =  .01511146
******************************************************

. cap gen m65r2dcha = m6r2dt - m5r2dt

.
. qui : {
Adtding Major_negative_life_events to geosocidemog male trimmed models:
m1r2dt =  .02967568
m2r2dt =  .10885216
Adding stress_and_hassles to Major_negative_life_events male trimmed models:
m3r2dt =  .10647088
Adding  to stress_and_hassles male trimmed models:
 m4r2dt =  .0495838
Adding  Self-Perceived Illnesses to buffers_and_supports male trimmed models:
 m5r2dt =  .14155276
Adding Medical_Diag to Self-Perceived Illnesses male trimmed models:
 m6r2dt =  .15666422

.
.
. qui : {
Between Major_negative_life_events and geosocidemog male full models:
m1r2dt =  .02967568
m2r2dt =  .10885216
 m21r2dcha =  .07917648
Between stress_and_hassles and Major_negative_life_events male full models:
 m32r2dcha =  -.00238129
Between buffers_and_supports and stress_and_hassles male full models:
 m43r2dcha =  -.05688707
Between Self-Perceived Illnesses and buffers_and_supports male full models:
 m54r2dcha =  .09196895
Between Medical_Diag and Self-Perceived Illnesses male full modtdtdtdtdtdtdtels:
 m65r2dcha =  .01511146
 m6r2dt =  .15666422

.
.
. di as input "Chunk 6 ---   female trimmed medical diagnosis----------------------------"
Chunk 6 ---   female trimmed medical diagnosis----------------------------

. des icdx3nr5 icdx3nr11 icdx4nr7  ///     //icdx3nr5, icdx5nr5 = hypertension   icdx3nr11=chronic pancreatitus icdx4nr7=myocard infarc  5nr12=cholestistitis
>    icdx5nr5 icdx5nr12

              storage  display     value
variable name   type   format      label      variable label
-------------


icdx3nr5          byte     %8.0g                        icdx3nr==hypertension


icdx3nr11         byte     %8.0g                        icdx3nr==577.1 chronic pancreatitis


icdx4nr7          byte     %8.0g                        icdx4nr==acute myocardial infarct


icdx5nr5          byte     %8.0g                        icdx5nr==hypertension


icdx5nr12         byte     %8.0g                        icdx5nr==575.1 cholecystitis


.         set more off

. // some items were dropped owing to collinearity -Andrushevskiy and some icdx items
. stcox icdx3nr5 icdx3nr11 icdx4nr7  ///     //icdx3nr5, icdx5nr5 = hypertension   icdx3nr11=chronic pancreatitus icdx4nr7=myocard infarc  5nr12=cholestistitis
>    icdx5nr5 icdx5nr12 if gender==2, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(5)      =     19.23
Log likelihood  =   -788.40871                     Prob > chi2     =    0.0017

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
    icdx3nr5 |    2.081883    .6867055      2.22    0.026      1.090659     3.973962
   icdx3nr11 |    3.363755     2.42621      1.68    0.093      .8182188     13.82864
    icdx4nr7 |    55.56689    62.24548      3.59    0.000      6.184555     499.2564
    icdx5nr5 |    3.363755     2.42621      1.68    0.093      .8182188     13.82864
   icdx5nr12 |    5.248423    2.710823      3.21    0.001      1.907134     14.44363
-------------+----------------------------------------------------------------

. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      icdx3nr5    |     -0.00086         0.00        1         0.9908
      icdx3nr11   |      0.00967         0.02        1         0.8963
      icdx4nr7    |     -0.00067         0.00        1         0.9929
      icdx5nr5    |      0.00967         0.02        1         0.8963
      icdx5nr12   |     -0.02356         0.10        1         0.7530
      ------------+---------------------------------------------------
      global test |                      0.14        5         0.9996
      ------------+---------------------------------------------------

. estat concordance

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      186
  Number of comparison pairs (P)      =    15940
  Number of orderings as expected (E)  =     2350
  Number of tied predictions (T)      =    12999

          Harrell's C = (E + T/2) / P  =    .5552
                            Somers' D  =    .1104

. matrix define f6bfmdbt = e(b)'

. matrix define f6fmdvt = e(V)

. str2d stcox icdx3nr5 icdx3nr11 icdx4nr7  ///     //icdx3nr5, icdx5nr5 = hypertension   icdx3nr11=chronic pancreatitus icdx4nr7=myocard infarc  5nr12=cholestistitis
>    icdx5nr5 icdx5nr12 if gender==2, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 11328      182    0.170333    0.063948   0.059790  0.299601  0.927  0.210
--------------------------------------------------------------------------

. local modtype6 Medical_Diag

. cap gen f6r2dt = r(r2)

. cap gen f6llt = e(ll)

. cap gen f6dft = e(rank)

. cap gen f65r2dcha = f6r2dt - f5r2dt

. replace f65r2dcha = f6r2dt - f5r2dt
(0 real changes made)

.
. label var f65r2dcha "R square chnge bet female trimmed models of `modtype6' and `modtype5'"
note: label truncated to 80 characters

. qui : {
Difference between female trimmed models
*******************************************************
Difference between level 6 and level 5 male full models:
Difference between Medical_Diag
 and  Self-Perceived Illnesses  models
f6r2dt =  .17033306
f5r2dt =  .11425582
Pseudo R^2 change:
f6r2dt - f5r2dt =  -.01949504
******************************************************

. local tr trimmed

. qui : {
Between Major_negative_life_events and geosocidemog female trimmed models:
f1r2dt =  .15346491
f2r2dt =  .15346491
 f21r2dcha =  -.02746414
Between stress_and_hassles and Major_negative_life_events female trimmed models:
f3r2dt =  .06714559
 f32r2dcha =  -.05885519
Between buffers_and_supports and stress_and_hassles female trimmed models:
 f4r2pt =  .00251654
 f43r2ptcha =  -.00980158
Between Self-Perceived Illnesses and buffers_and_supports female trimmed models:
 f5r2pt =  .04814757
 f43r2ptcha =  -.05284315
Between Medical_Diag and Self-Perceived Illnesses female trimmed models:
 f6r2pt =  .26219413
 f65r2pfcha =  .14793831

.  local tr trimmed

. qui : {
Adding Major_negative_life_events to geosocidemog female trimmed models:
f1r2pt =  .0539759
f2r2pt =  .01692335
Adding stress_and_hassles to Major_negative_life_events female trimmed models:
f3r2pt =  .01231812
Adding  buffers_and_supports to stress_and_hassles female trimmed models:
 f4r2pt =  .00251654
Adding Self-Perceived Illnesses to buffers_and_supports female trimmed models:
 f5r2pt =  .04814757
Adding Medical_Diag to Self-Perceived Illnesses female trimmed models:
 f6r2pt =  .26219413

.
. di "{hline}"
-------------

. di as input "*--chunk ---7 --------- Male Health behaviors ---------mhb------------------"
*--chunk ---7 --------- Male Health behaviors ---------mhb------------------

. di as input "The trimmed model"
The trimmed model

. set more off

.    * waves 1 2 and 3
. des contw3

              storage  display     value
variable name   type   format      label      variable label
-------------


contw3            byte     %15.0g        LABC           use of any contraception method in 1997-now


. stcox contw3 if gender==1, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          154                     Number of obs   =       154
No. of failures =          152
Time at risk    =         1980
                                                   LR chi2(1)      =      8.23
Log likelihood  =   -632.54994                     Prob > chi2     =    0.0041

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
      contw3 |    1.614892     .268431      2.88    0.004      1.165882     2.236825
-------------+----------------------------------------------------------------

. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      contw3      |     -0.05168         0.41        1         0.5195
      ------------+---------------------------------------------------
      global test |                      0.41        1         0.5195
      ------------+---------------------------------------------------

. estat concordance

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      154
  Number of comparison pairs (P)      =    10789
  Number of orderings as expected (E)  =     3672
  Number of tied predictions (T)      =     5202

          Harrell's C = (E + T/2) / P  =    .5814
                            Somers' D  =    .1629

.
. str2d stcox contw3 if gender==1, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 10569      152    0.057196    0.037580   0.006079  0.146631  0.504  0.176
--------------------------------------------------------------------------

. matrix define m6bhdbt = e(b)'

. matrix define m6mhbdvt = e(V)

. local modtypdte7 Health_Behaviors

. cap drop m7r2dt

. cap gen m7r2dt = r(r2)

. cap gen m7llt = e(ll)

. cap gen m7dft = e(rank)

. cap gen m76r2dcha = m7r2dt - m6r2dt

. local tr trimmed

.
.
. label var m76r2dcha "R square chnge bet male `tr' models of `modtype7' and `modtype6'"

. qui : {
Difference between male trimmed models
*******************************************************
Difference between level 7 and level 6 male trimmed models:
Difference between
 and  Medical_Diag  models
m7r2dt =  .0571961
m6r2dt =  .15666422
Pseudo R^2 change:
m7r2dt - m6r2dt =  -.09946812
******************************************************

.
.
. qui : {
Between Major_negative_life_events and geosocidemog male trimmed models:
m1r2dt =  .02967568
m2r2dt =  .10885216
 m21r2dcha =  .07917648
Between stress_and_hassles and Major_negative_life_events male trimmed models:
m3r2dt =  .10647088
 m32r2dcha =  -.00238129
Between buffers_and_supports and stress_and_hassles male trimmed models:
 m4r2dt =  .0495838
 m43r2dcha =  -.05688707
Between Self-Perceived Illnesses and buffers_and_supports male trimmed models:
 m5r2dt =  .14155276
 m54r2dcha =  .09196895
Between Medical_Diag and Self-Perceived Illnesses male trimmed models:
 m6r2dt =  .15666422
 m65r2dcha =  .01511146
 m7r2dt =  .0571961
 m76r2dcha =  -.09946813

.
. qui : {
Adding Major_negative_life_events to geosocidemog male trimmed models:
                   m1r2pt =  .0225024
                   m2r2pt =  .01579614
Adding stress_and_hassles to Major_negative_life_events male trimmed models:
                   m3r2pt =  .17381422
Adding buffers_and_supports to stress_and_hassles male trimmed models:
                   m4r2pt =  .18195252
Adding Self-Perceived Illnesses to buffers_and_supports male trimmed models:
                   m5r2pt =  .13856983
Adding Medical_Diag to Self-Perceived Illnesses male trimmed models:
                   m6r2pt =  .1550981
Adding  to Medical_Diag male trimmed models:
                   m7r2pt =  .00646096

.
.
. di as input "*--chunk ---7 --------- Female Health behaviors ---------fhb------------------"
*--chunk ---7 --------- Female Health behaviors ---------fhb------------------

.
. di as input "The female health behaviors trimmed model"
The female health behaviors trimmed model

.
. set more off

. stcox  ncontw2 if gender==2, nolog     //  washed out

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(1)      =      0.71
Log likelihood  =   -797.66956                     Prob > chi2     =    0.3987

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
     ncontw2 |    .8860257    .1267342     -0.85    0.398      .6694117     1.172734
-------------+----------------------------------------------------------------

. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      ncontw2     |     -0.06961         0.83        1         0.3623
      ------------+---------------------------------------------------
      global test |                      0.83        1         0.3623
      ------------+---------------------------------------------------

.
. matrix define f7fbhdbt = e(b)'

. matrix define f7fhbdvt = e(V)

. local modtype7 Health_Behaviors

. str2d stcox  ncontw2 if gender==2, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 11328      182    0.003084    0.007675   0.000009  0.035518  0.114  0.142
--------------------------------------------------------------------------

. cap gen f7r2dt = r(r2)

. cap gen f7llt= e(ll)

. cap gen f7dft = e(rank)

. gen f76r2dcha = f7r2dt - f6r2dt

. local tr trimmed

.
.
. label var m76r2ptcha "R square chnge bet female `tr' models of `modtype7' and `modtype6'"

. qui : {
Difference between male trimmed models
*******************************************************
Difference between level 7 and level 6 male trimmed models:
Difference between Health_Behaviors
 and  Medical_Diag  models
f7r2pt =  .26283634
f6r2pt =  .26219413
Pseudo R^2 change:
f7r2pt - f6r2pt =  .00064221
******************************************************

. local tr trimmed

.
. qui : {
Between Major_negative_life_events and geosocidemog female trimmed models:
f1r2pt =  .0539759
f2r2pt =  .01692335
 f21r2ptcha =  -.03705255
Between stress_and_hassles and Major_negative_life_events female trimmed models:
f3r2pt =  .17381422
 f32r2ptcha =  -.00460523
Between buffers_and_supports and stress_and_hassles female trimmed models:
 f4r2pt =  .00251654
 f43r2ptcha =  -.00980158
Between Self-Perceived Illnesses and buffers_and_supports female trimmed models:
 f5r2pt =  .04814757
 f43r2ptcha =  -.05284315
Between Medical_Diag and Self-Perceived Illnesses female trimmed models:
 f6r2pt =  .1550981
 f65r2ptcha =  .01652826
 f7r2pt =  .26283634
 f76r2ptcha =  .00064221

.
. qui : {
Adding Major_negative_life_events to geosocidemog female trimmed models:
                   f1r2pt =  .0539759
                   f2r2pt =  .01692335
Adding stress_and_hassles to Major_negative_life_events female trimmed models:
                   f3r2pt =  .01231812
Adding buffers_and_supports to stress_and_hassles female trimmed models:
                   f4r2pt =  .00251654
Adding Self-Perceived Illnesses to buffers_and_supports female trimmed models:
                   f5r2pt =  .04814757
Adding Medical_Diag to Self-Perceived Illnesses female trimmed models:
                   f6r2pt =  .26219413
Adding Health_Behaviors to Medical_Diag female trimmed models:
                   f7r2pt =  .26283634

.
.
. di "{hline}"
-------------

. di as input "*=====Chunk 8    male model health scales======= "
*=====Chunk 8    male model health scales=======

.
.
. // working on the trimming of the male health scales
.
. di as input "*=====Chunk 8   full male model health scales======= "
*=====Chunk 8   full male model health scales=======

. di as input "*--chunk ---8 --------- Male Health scales ---------mhs------------------"
*--chunk ---8 --------- Male Health scales ---------mhs------------------

. di as input "Trimmed"
Trimmed

. des CSavoid BSIposymp BSIips  MiPTSD

              storage  display     value
variable name   type   format      label      variable label
-------------


CSavoid           byte     %9.0g                        Coping Avoidance subscale


BSIposymp         int      %9.0g                        Brief Symptom inventory positive symptom total subscale


BSIips            byte     %9.0g                        Basic symptom invenstory interpersonal sensitivity subscale


MiPTSD            byte     %9.0g                        Misssissipi post-traumatic stress disorder scale


. set more off

.    * waves 1 2 and 3
. stcox CSprbslv WHPel WHPer MiPTSD  if gender==1, nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          153                     Number of obs   =       153
No. of failures =          151
Time at risk    =         1978
                                                   LR chi2(4)      =     22.68
Log likelihood  =    -620.2684                     Prob > chi2     =    0.0001

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
    CSprbslv |    1.049643    .0204408      2.49    0.013      1.010334      1.09048
       WHPel |     1.00781     .003101      2.53    0.011       1.00175     1.013906
       WHPer |    .9879022    .0064811     -1.86    0.064      .9752809     1.000687
      MiPTSD |    1.019473    .0076423      2.57    0.010      1.004604     1.034562
-------------+----------------------------------------------------------------

. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      CSprbslv    |     -0.06764         0.72        1         0.3947
      WHPel       |      0.02024         0.07        1         0.7936
      WHPer       |     -0.12547         2.43        1         0.1193
      MiPTSD      |      0.06122         0.41        1         0.5217
      ------------+---------------------------------------------------
      global test |                      3.21        4         0.5233
      ------------+---------------------------------------------------

. estat concordance

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      153
  Number of comparison pairs (P)      =    10639
  Number of orderings as expected (E)  =     6879
  Number of tied predictions (T)      =        5

          Harrell's C = (E + T/2) / P  =    .6468
                            Somers' D  =    .2936

.              // smoking aborw beer and liq pills items cause crashes
.
.
. matrix define m8mhsbt = e(b)'

. matrix define m8mhsdvt = e(V)

. local modtype Health_Scales

. str2d stcox CSprbslv WHPel WHPer MiPTSD  if gender==1, nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 10507      151    0.101358    0.037563   0.038503  0.181924  0.687  0.142
--------------------------------------------------------------------------

. cap gen m8r2dt = r(r2)

. cap gen m8llt = e(ll)

. cap gen m8dft = e(rank)

. cap gen m87r2dcha = m8r2dt - m8r2dt

.
. label var m76r2dcha "R square chnge bet male full models of `modtype7' and `modtype6'"

. qui : {
Difference between male full models
*******************************************************
Difference between level 7 and level 6 male full models:
Difference between Health_Behaviors
 and  Medical_Diag  models
m8r2dt =  .10135787
m7r2dt =  .0571961
Pseudo R^2 change:
m8r2dt - m7r2dt =  .04416177
******************************************************

. local tr trimmed

.
. qui : {
Between Major_negative_life_events and geosocidemog male trimmed models:
m1r2dt =  .02967568
m2r2dt =  .10885216
 m21r2dcha =  .07917648
Between stress_and_hassles and Major_negative_life_events male trimmed models:
m3r2dt =  .10647088
 m32r2dcha =  -.00238129
Between buffers_and_supports and stress_and_hassles male trimmed models:
 m4r2dt =  .0495838
 m43r2dcha =  -.05688707
Between Self-Perceived Illnesses and buffers_and_supports male trimmed models:
 m5r2dt =  .20506182
 m43r2dcha =  .09196895
Between Medical_Diag and Self-Perceived Illnesses male trimmed models:
 m6r2dt =  .15666422
 m65r2dcha =  .01511146
 m7r2dt =  .29739588
 m76r2dcha =  -.09946813
 m8r2dt =  .29653504
 m87r2dcha =  0

.
. qui : {
Adding Major_negative_life_events to geosocidemog male trimmed models:
m1r2pf =  .0464948
m2r2pf =  .1194814
Adding stress_and_hassles to Major_negative_life_events male trimmed models:
m3r2pf =  .17696157
Adding buffers_and_supports to stress_and_hassles male trimmed models:
 m4r2pt =  .18195252
Adding Self-Perceived Illnesses to buffers_and_supports male trimmed models:
 m5r2pf =  .20506182
Adding Medical_Diag to Self-Perceived Illnesses male trimmed models:
 m6r2pf =  .24497625
Adding Medical_Diag to Self-Perceived Illnesses male trimmed models:
 m6r2pf =  .24497625
Adding Health_Behaviors to Medical_Diag male trimmed models:
m7r2pf =  .29739588
Adding  to Health_Behaviors male trimmed models:
m8r2pf =  .29653504

.
. di as input "*--chunk ---8 --------- Female Health scales ---------fhs------------------"
*--chunk ---8 --------- Female Health scales ---------fhs------------------

.
. di as input " Chunk 8 Female trimmed health scales model"
 Chunk 8 Female trimmed health scales model

. cap drop ptsdXoc

. gen ptsdXoc = MiPTSD*BSIoc

. cap drop ptsdXanx

. gen ptsdXanx = MiPTSD*BSIanx

. cap drop ptsdXer

. gen ptsdXer = MiPTSD*WHPer

. cap drop ptsdXsoma

. cap gen ptsdXsoma = MiPTSD*BSIsoma

. label var ptsdXsoma  "Cross-product interaction of MiPTSD and BSIsoma"

. label var ptsdXanx "Cross-product interaction of MiPTSD and BSIanx"

. label var ptsdXer "Cross-product interaction of MiPTSD and BSIer"

. des WHPer BSIanx MiPTSD ptsdXanx

              storage  display     value
variable name   type   format      label      variable label
-------------


WHPer             float    %9.0g                        Wtd Health Profile Emotional reaction Pt 1 subscale


BSIanx            byte     %9.0g                        Basic symptom inventory Anxiety subscale


MiPTSD            byte     %9.0g                        Misssissipi post-traumatic stress disorder scale


ptsdXanx          float    %9.0g                        Cross-product interaction of MiPTSD and BSIanx


. set more off

. // some items were dropped owing to collinearity -Andrushevskiy and some icdx items
. // sometimes ptsd alone will be significant
. stcox MiPTSD if gender==2, iterate(20) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(1)      =     10.95
Log likelihood  =   -792.55087                     Prob > chi2     =    0.0009

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
      MiPTSD |    1.020699    .0061914      3.38    0.001      1.008636     1.032907
-------------+----------------------------------------------------------------

. di e(r2_p)
.0068605

. // sometimes PTSD may be partly masked by the other variables or their interactions
. stcox MiPTSD BSIsoma if gender==2,  iterate(20)  nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(2)      =     16.47
Log likelihood  =   -789.79253                     Prob > chi2     =    0.0003

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
      MiPTSD |    1.011624    .0071736      1.63    0.103      .9976608     1.025782
     BSIsoma |    1.039199    .0166401      2.40    0.016      1.007091      1.07233
-------------+----------------------------------------------------------------

. di e(r2_p)
.01031696

. cap drop ptsdXoc

. gen ptsdXoc = MiPTSD*BSIoc

. cap drop ptsdXanx

. gen ptsdXanx = MiPTSD*BSIanx

. cap drop ptsdXer

. gen ptsdXer = MiPTSD*WHPer

. cap drop ptsdXpain

. gen ptsdXpain = MiPTSD*WHPpain

. pwcorr MiPTSD BSIoc BSIanx WHPpain ptsdXpain ptsdXoc ptsdXanx, sig

             |   MiPTSD    BSIoc   BSIanx  WHPpain ptsdXp~n  ptsdXoc ptsdXanx
-------------+---------------------------------------------------------------
      MiPTSD |   1.0000
             |
             |
       BSIoc |   0.6330   1.0000
             |   0.0000
             |
      BSIanx |   0.5500   0.6433   1.0000
             |   0.0000   0.0000
             |
     WHPpain |   0.4125   0.4707   0.4502   1.0000
             |   0.0000   0.0000   0.0000
             |
   ptsdXpain |   0.5630   0.5352   0.5203   0.9607   1.0000
             |   0.0000   0.0000   0.0000   0.0000
             |
     ptsdXoc |   0.8389   0.9309   0.6567   0.4777   0.6030   1.0000
             |   0.0000   0.0000   0.0000   0.0000   0.0000
             |
    ptsdXanx |   0.7983   0.6931   0.9190   0.4797   0.6138   0.8134   1.0000
             |   0.0000   0.0000   0.0000   0.0000   0.0000   0.0000
             |

. // sometimes PTSD may be fully cloaked or masked by the other variables
. stcox MiPTSD BSIoc ptsdXoc if gender==2, iterate(20) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(3)      =     20.99
Log likelihood  =   -787.53015                     Prob > chi2     =    0.0001

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
      MiPTSD |    1.016642    .0167145      1.00    0.315       .984404     1.049935
       BSIoc |    1.106309    .0796857      1.40    0.161       .960651     1.274052
     ptsdXoc |    .9993537    .0011996     -0.54    0.590      .9970053     1.001708
-------------+----------------------------------------------------------------

. //sometimes PTSD will be enhanced by the other variables and their interaction
. stcox MiPTSD BSIanx ptsdXanx if gender==2, iterate(20) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(3)      =     21.31
Log likelihood  =   -787.36898                     Prob > chi2     =    0.0001

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
      MiPTSD |    1.033518    .0183175      1.86    0.063       .998233     1.070051
      BSIanx |    1.215102     .105569      2.24    0.025      1.024848     1.440674
    ptsdXanx |    .9978934    .0014099     -1.49    0.136      .9951339     1.000661
-------------+----------------------------------------------------------------

. di e(r2_p)
.01335388

. //sometimes PTSD will be enhanced by the other variables and their interaction
. stcox MiPTSD WHPpain ptsdXpain if gender==2, iterate(20) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(3)      =     16.48
Log likelihood  =   -789.78473                     Prob > chi2     =    0.0009

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
      MiPTSD |    1.028712    .0108541      2.68    0.007      1.007656     1.050207
     WHPpain |      1.0353    .0176512      2.03    0.042      1.001276      1.07048
   ptsdXpain |    .9994739    .0003086     -1.70    0.088      .9988693     1.000079
-------------+----------------------------------------------------------------

. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      MiPTSD      |     -0.13941         4.12        1         0.0423
      WHPpain     |     -0.10334         2.09        1         0.1484
      ptsdXpain   |      0.09645         1.88        1         0.1705
      ------------+---------------------------------------------------
      global test |                      5.84        3         0.1197
      ------------+---------------------------------------------------

. estat concordance

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      186
  Number of comparison pairs (P)      =    15940
  Number of orderings as expected (E)  =    10043
  Number of tied predictions (T)      =       66

          Harrell's C = (E + T/2) / P  =    .6321
                            Somers' D  =    .2642

. // different flavors of the syndrome are available depending upon the types of
. // conditions in which they arise and the other factors at play at the time
.
. ******************* Note bene: ****************************************************
. // Just because some combinations are more variance encompassing than others does *
. // not mean that the less powerful cannot occur or will not occasonally occur.    *
. //  the question may be which flavor of what syndrome will be characteristic of   *
. //  the phenomenon.  What conditions are necessary and which conditions are       *
. //   sufficient  for a particular interaction to emerge.                          *
. //   some interactions will suppress the significance of the main effects         *
. //   others may reinforce the significance of the main effects                    *
. //   others may reinforce one variable and supress the other                      *
. //  Depending upon the circumstances, different scenarios are plausible and       *
. //   different interactions may emerge                                            *
. //  Certain conditions may be necessary to effect a particular interaction rather *
. //   than another.                                                                *
. //  Just because an interaction is possible does not mean that it is probable     *
. //   These questions remain to be explored before a definitive specification of   *
. //    the situation can be posed.                                                                                         *
. ***********************************************************************************
. str2d stcox MiPTSD WHPpain ptsdXpain if gender==2, iterate(20) nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 11328      182    0.062416    0.028433   0.017942  0.126682  0.528  0.128
--------------------------------------------------------------------------

. matrix define f8fbhdbt = e(b)'

. matrix define f8fhbdvt = e(V)

. local modtype8 Health_scales

. cap drop f8r2dt

. gen f8r2dt = r(r2)

. di f8r2dt
.06241624

. cap gen f8llt= e(ll)

. cap gen f8dft = e(rank)

. di f8r2dt
.06241624

. cap gen f87r2dcha = f8r2dt - f7r2dt

. di f87r2dcha
.05933208

. local tr trimmed

.
.
. label var m87r2ptcha "R square chnge bet female `tr' models of `modtype8' and `modtype7'"

. qui : {
Difference between male trimmed models
*******************************************************
Difference between level 8 and level 7 male trimmed models:
Difference between Health_scales
 and  Health_Behaviors  models
f8r2dt =  .06241624
f7r2dt =  .00308416
Pseudo R^2 change:
f8r2dt - f7r2dt =  .05933208
******************************************************

.
.
. qui : {
Between Major_negative_life_events and geosocidemog female trimmed models:
f1r2dt =  .15346491
f2r2dt =  .12600078
 f21r2dcha =  -.02746414
Between stress_and_hassles and Major_negative_life_events female trimmed models:
f3r2dt =  .10647088
 f32r2dcha =  -.05885519
Between buffers_and_supports and stress_and_hassles female trimmed models:
 f4r2dt =  .00942887
 f43r2dcha =  -.05771671
Between Self-Perceived Illnesses and buffers_and_supports female trimmed models:
 f5r2dt =  .1898281
 f43r2dcha =  .18039922
Between Medical_Diag and Self-Perceived Illnesses female trimmed models:
 f6r2dt =  .15666422
 f65r2dcha =  .01511146
 f7r2dt =  .00308416
 f76r2dcha =  -.1672489
 f8r2dt =  .06241624
 f87r2dcha =  .05933208

.
. qui : {
Adding Major_negative_life_events to geosocidemog female trimmed models:
                   f1r2dt =  .15346491
                   f2r2dt =  .12600078
Adding stress_and_hassles to Major_negative_life_events female trimmed models:
                   f3r2dt =  .06714559
Adding buffers_and_supports to stress_and_hassles female trimmed models:
                   f4r2dt =  .00942887
Adding Self-Perceived Illnesses to buffers_and_supports female trimmed models:
                   f5r2dt =  .1898281
Adding Medical_Diag to Self-Perceived Illnesses female trimmed models:
                   f6r2dt =  .17033306
Adding Health_Behaviors to Medical_Diag female trimmed models:
                   f7r2dt =  .00308416
Adding Health_scales to Health_Behaviors female trimmed models:
                   f8r2dt =  .06241624

.
. di "{hline}"
-------------

. ******-----chunk 9 ** Male risk awareness trimmed model*************************
. di as input "RISK Awareness"
RISK Awareness

.
. di as input "*=====Chunk 9   trimmed male gen risk radiation Chornobyl ======= "
*=====Chunk 9   trimmed male gen risk radiation Chornobyl =======

. di as input "*--chunk ---9 --------- Male gen risk radiation ---------mgrrc----"
*--chunk ---9 --------- Male gen risk radiation ---------mgrrc----

. di as input "Trimmed set male model"
Trimmed set male model

. set more off

.    * waves 1 2 and 3
. des defnw2 efradw2 ecprw3 polprw3 carcin trgovw1

              storage  display     value
variable name   type   format      label      variable label
-------------


defnw2            byte     %8.0g                    *   consider hazardous (in percent) - deficiencies in essential nutrition in 1996


efradw2           byte     %8.0g                        consider hazardous (in percent) - effects of radiation in 1996


ecprw3            byte     %8.0g                        consider hazardous (in percent) - economic problems, NOW


polprw3           byte     %8.0g                        consider hazardous (in percent) - political problems NOW


carcin            byte     %8.0g                    *   a person exposed to carcinogen  is likely to get cancer (% of agreement)


trgovw1           byte     %8.0g                        level of trust in government reports about chornobyl in time period 1976-1986


.
. stcox defnw2 efradw2 ecprw3 polprw3 trgovw1 if gender==1, iterate(20) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          139                     Number of obs   =       139
No. of failures =          137
Time at risk    =         1877
                                                   LR chi2(5)      =     13.34
Log likelihood  =   -554.04914                     Prob > chi2     =    0.0204

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
      defnw2 |    .9816901    .0077102     -2.35    0.019      .9666941     .9969187
     efradw2 |    1.014139    .0051729      2.75    0.006      1.004051     1.024329
      ecprw3 |    1.018219     .008312      2.21    0.027      1.002057     1.034641
     polprw3 |    .9896777    .0049962     -2.06    0.040      .9799336     .9995187
     trgovw1 |    1.005287    .0022805      2.32    0.020      1.000828     1.009767
-------------+----------------------------------------------------------------

. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      defnw2      |     -0.00827         0.02        1         0.9025
      efradw2     |      0.06782         0.56        1         0.4527
      ecprw3      |      0.01938         0.08        1         0.7769
      polprw3     |     -0.07369         0.74        1         0.3904
      trgovw1     |     -0.01562         0.03        1         0.8594
      ------------+---------------------------------------------------
      global test |                      0.94        5         0.9673
      ------------+---------------------------------------------------

.
. cap drop m9r2dt

. matrix define m9mgrrcbt = e(b)'

. matrix define m9mgrrcvt = e(V)

. local modtype9 Gen_rad_risk

. str2d stcox defnw2 efradw2 ecprw3 polprw3 trgovw1 if gender==1, iterate(20) nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
  9545      137    0.076490    0.037768   0.018424  0.161327  0.589  0.157
--------------------------------------------------------------------------

. cap gen m9r2dt = r(r2)

. di m9r2dt
.07649028

. di m9r2dt
.07649028

. cap gen m9llf = e(ll)

. cap gen m9dff = e(rank)

. cap drop m98r2dcha

. cap gen m98r2dcha = m9r2dt - m8r2dt

. di m98r2dcha
-.02486759

. local tr trimmed

.
.
. label var m98r2dcha "R square chnge bet male trimmed models of `modtype9' and `modtype8'"

. qui : {
Difference between male trimmed models
*******************************************************
Difference between level 9 and level 8 male trimmed  models:
Difference between Gen_rad_risk
 and  Health_scales  models
m9r2dt =  .07649028
m8r2dt =  .10135787
Pseudo R^2 change:
m9r2dt - m8r2dt =  -.02486759
******************************************************

.
. qui : {
Between Major_negative_life_events and geosocidemog male trimmed models:
m1r2dt =  .02967568
m2r2dt =  .10885216
 m21r2dcha =  .07917648
Between stress_and_hassles and Major_negative_life_events male trimmed models:
m3r2dt =  .10647088
 m32r2dcha =  -.00238129
Between buffers_and_supports and stress_and_hassles male trimmed models:
 m4r2dt =  .0495838
 m43r2dcha =  -.05688707
Between Self-Perceived Illnesses and buffers_and_supports male trimmed models:
 m5r2dt =  .14155276
 m43r2dcha =  .09196895
Between Medical_Diag and Self-Perceived Illnesses male trimmed models:
 m6r2dt =  .15666422
 m65r2dcha =  .01511146
 m7r2dt =  .0571961
 m76r2dcha =  -.09946813
 m8r2dt =  .10135787
 m87r2dcha =  0
 m9r2dt =  .07649028
 m98r2dcha =  -.02486759

.
. qui : {
Adding Major_negative_life_events to geosocidemog male trimmed models:
m1r2dt =  .02967568
m2r2dt =  .10885216
Adding stress_and_hassles to Major_negative_life_events male trimmed models:
m3r2dt =  .10647088
Adding buffers_and_supports to stress_and_hassles male trimmed models:
 m4r2dt =  .0495838
Adding Self-Perceived Illnesses to buffers_and_supports male trimmed models:
 m5r2dt =  .14155276
Adding Medical_Diag to Self-Perceived Illnesses male trimmed models:
 m6r2dt =  .15666422
Adding Medical_Diag to Self-Perceived Illnesses male trimmed models:
 m6r2dt =  .15666422
Adding Health_Behaviors to Medical_Diag male trimmed models:
m7r2dt =  .0571961
Adding Health_scales to Health_Behaviors male trimmed models:
m8r2dt =  .10135787
Adding Gen_rad_risk to Health_scales male trimmed models:
m9r2dt =  .07649028

.
.
.
. di as input "*--chunk ---10 ---------female radiation issues ---------frrrdd------------------"
*--chunk ---10 ---------female radiation issues ---------frrrdd------------------

. di as input "General Model tests radiation issues "
General Model tests radiation issues

.
.
.
. stcox  radhlw2 radfmw2 woman if gender==2,  iterate(20) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(3)      =     14.81
Log likelihood  =   -790.62088                     Prob > chi2     =    0.0020

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
     radhlw2 |    .9914244     .003333     -2.56    0.010      .9849133     .9979785
     radfmw2 |    1.009704    .0038623      2.52    0.012      1.002163     1.017302
       woman |    1.006174    .0028103      2.20    0.028      1.000681     1.011697
-------------+----------------------------------------------------------------

. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      1.75        3         0.6253
      ------------+---------------------------------------------------

. estat concordance

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      186
  Number of comparison pairs (P)      =    15940
  Number of orderings as expected (E)  =     9279
  Number of tied predictions (T)      =      479

          Harrell's C = (E + T/2) / P  =    .5971
                            Somers' D  =    .1943

.
.
. ***************9. ***** General male risk awareness **********************************************
. di as input "Trimmed male model for generalrisk savvy -----------------------"
Trimmed male model for generalrisk savvy -----------------------

. stcox  defnw2 efradw2 polprw3  ecprw3  trgovw1 if gender==1,  iterate(20) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          139                     Number of obs   =       139
No. of failures =          137
Time at risk    =         1877
                                                   LR chi2(5)      =     13.34
Log likelihood  =   -554.04914                     Prob > chi2     =    0.0204

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
      defnw2 |    .9816901    .0077102     -2.35    0.019      .9666941     .9969187
     efradw2 |    1.014139    .0051729      2.75    0.006      1.004051     1.024329
     polprw3 |    .9896777    .0049962     -2.06    0.040      .9799336     .9995187
      ecprw3 |    1.018219     .008312      2.21    0.027      1.002057     1.034641
     trgovw1 |    1.005287    .0022805      2.32    0.020      1.000828     1.009767
-------------+----------------------------------------------------------------

.
. label var m98r2dcha "R square chnge bet female `tr' models of `modtype8' and `modtype7'"

. qui : {
Difference between male trimmed models
*******************************************************
Difference between level 9 and level 8 male trimmed models:
Difference between Gen_rad_risk
 and  Health_scales  models
m9r2dt =  .07649028
m8r2dt =  .10135787
Pseudo R^2 change:
m9r2dt - m8r2dt =  -.02486759
******************************************************

.
. di as input "Trimmed male model -----------------------"
Trimmed male model -----------------------

. str2d stcox  defnw1 defnw2  efradw3  ecprw3  trgovw1 if gender==1,  iterate(20) nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
  9545      137    0.052810    0.034749   0.005664  0.136076  0.483  0.168
--------------------------------------------------------------------------

. replace m9r2dt = r(r2)
(21897 real changes made)

. label var m98r2dcha "R square chnge bet female `tr' models of `modtype8' and `modtype7'"

. qui : {
Difference between male trimmed models
*******************************************************
Difference between level 9 and level 8 male trimmed models:
Difference between Gen_rad_risk
 and  Health_scales  models
m9r2dt =  .05281045
m8r2dt =  .10135787
Pseudo R^2 change:
m9r2dt - m8r2dt =  -.04854742
******************************************************

.
.
. qui : {
Between Major_negative_life_events and geosocidemog male trimmed models:
m1r2dt =  .02967568
m2r2dt =  .10885216
 m21r2dcha =  .07917648
Between stress_and_hassles and Major_negative_life_events male trimmed models:
m3r2dt =  .10647088
 m32r2dcha =  -.00238129
Between buffers_and_supports and stress_and_hassles female trimmed models:
 m4r2dt =  .0495838
 m43r2dcha =  -.05688707
Between Self-Perceived Illnesses and buffers_and_supports female trimmed models:
 m5r2pt =  .13856983
 m43r2ptcha =  -.04338269
Between Medical_Diag and Self-Perceived Illnesses female trimmed models:
 m6r2pt =  .1550981
 m65r2ptcha =  .01652826
 m7r2pt =  .00646096
 m76r2ptcha =  .13771795
 m8r2pt =  .29292864
 m87r2ptcha =  0
 m8r2pt =  .29292864
 m87r2ptcha =  0
 m9r2pt =  .01189235
 m98r2ptcha =  -.28103629

.
. qui : {
Adding Major_negative_life_events to geosocidemog male trimmed models:
                   m1r2pt =  .0225024
                   m2r2pt =  .01579614
Adding stress_and_hassles to Major_negative_life_events male trimmed models:
                   m3r2pt =  .17381422
Adding buffers_and_supports to stress_and_hassles male trimmed models:
                   m4r2pt =  .18195252
Adding Self-Perceived Illnesses to buffers_and_supports male trimmed models:
                   m5r2pt =  .13856983
Adding Medical_Diag to Self-Perceived Illnesses male trimmed models:
                   m6r2pt =  .1550981
Adding Health_Behaviors to Medical_Diag male trimmed models:
                   m7r2pt =  .00646096
Adding Health_scales to Health_Behaviors male trimmed models:
                   m8r2pt =  .29292864
Adding Gen_rad_risk to Health_scales male trimmed models:
                   m9r2pt =  .01189235

.
. ***** Chunk 9  general risk awareness for female trimmed models  "general risk  awareness"
.
. di as input "Trimmed female model -----------------------"
Trimmed female model -----------------------

. stcox woman polprw2 radw2 if gender==2 ,  iterate(20) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(3)      =     15.13
Log likelihood  =    -790.4608                     Prob > chi2     =    0.0017

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
       woman |    1.006807    .0026148      2.61    0.009      1.001695     1.011945
     polprw2 |    1.003977    .0019707      2.02    0.043      1.000122     1.007847
       radw2 |    1.004335    .0022169      1.96    0.050       .999999     1.008689
-------------+----------------------------------------------------------------

. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      3.97        3         0.2646
      ------------+---------------------------------------------------

. cap drop f9r2pt

. matrix define f9mgrrcbt = e(b)'

. matrix define f9mgrrcvt = e(V)

. local modtype9 Gen_rad_risk

. str2d stcox woman polprw2 radw2 if gender==2 ,  iterate(20) nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 11328      182    0.045651    0.023272   0.010746  0.099928  0.448  0.120
--------------------------------------------------------------------------

. cap gen f9r2dt = r(r2)

. di f9r2dt
.04565085

. di f9r2dt
.04565085

. cap gen f9llf = e(ll)

. cap gen f9dff = e(rank)

. cap drop f98r2dcha

. gen f98r2dcha = m9r2dt - m8r2dt

. di f98r2dcha
-.04854742

. local tr trimmed

.
.
. label var f98r2dcha "R square chnge bet female trimmed models of `modtype9' and `modtype8'"

. qui : {
Difference between female trimmed models
*******************************************************
Difference between level 9 and level 8 female trimmed  models:
Difference between Gen_rad_risk
 and  Health_scales  models
f9r2dt =  .04565085
f8r2dt =  .06241624
Pseudo R^2 change:
f9r2dt - f8r2dt =  -.01676539
******************************************************

.
. qui : {
Between Major_negative_life_events and geosocidemog female trimmed models:
f1r2dt =  .15346491
f2r2dt =  .12600078
 f21r2dcha =  -.02746414
Between stress_and_hassles and Major_negative_life_events female trimmed models:
f3r2dt =  .06714559
 f32r2dcha =  -.05885519
Between buffers_and_supports and stress_and_hassles female trimmed models:
 f4r2dt =  .00942887
 f43r2dcha =  -.05771671
Between Self-Perceived Illnesses and buffers_and_supports female trimmed models:
 f5r2dt =  .1898281
 f43r2dcha =  .18039922
Between Medical_Diag and Self-Perceived Illnesses female trimmed models:
 f6r2dt =  .17033306
 f65r2dcha =  -.01949504
 f7r2dt =  .00308416
 f76r2dcha =  -.1672489
 f8r2dt =  .06241624
 f87r2dcha =  .05933208
 f9r2dt =  .04565085
 f98r2dcha =  -.04854742

.
. qui : {
Adding Major_negative_life_events to geosocidemog female trimmed models:
f1r2pt =  .0539759
f2r2pt =  .01692335
Adding stress_and_hassles to Major_negative_life_events female trimmed models:
f3r2pt =  .01231812
Adding  to stress_and_hassles female trimmed models:
 f4r2pt =  .00251654
Adding Self-Perceived Illnesses to buffers_and_supports female trimmed models:
 f5r2pt =  .04814757
Adding Medical_Diag to Self-Perceived Illnesses female trimmed models:
 f6r2pt =  .26219413
Adding Medical_Diag to Self-Perceived Illnesses female trimmed models:
 f6r2pt =  .26219413
Adding Health_Behaviors to Medical_Diag female trimmed models:
f7r2pt =  .26283634
Adding Health_scales to Health_Behaviors female trimmed models:
f8r2pt =  .01032673
Adding Gen_rad_risk to Health_scales female trimmed models:
f9r2pt =  .00947955

.
.
.
.
.
. ********************************************************************************
. *****   chunk 10  Trimmed Model for radiation and Chornobyl  related          *
. ******* issues *****************************************************************
. di as input "*-- Chunk 10 male radiation and Chornobyl risk model"
*-- Chunk 10 male radiation and Chornobyl risk model

.
. des goferw2 radchw3 radtlw1-radtlw3 radchw1-radchw3 radhlw1-radhlw3 radfmw1-radfmw3

              storage  display     value
variable name   type   format      label      variable label
-------------


goferw2           byte     %8.0g                        level of fear in percent from going outdoors in 1987-1996


radchw3           byte     %8.0g                        believed % of polution related to chornobyl NOW


radtlw1           byte     %8.0g                        believed % of cumulative radiation exposed to in a lifetime in 1986


radtlw2           byte     %8.0g                        believed % of cumulative radiation exposed to in a lifetime in 1996


radtlw3           byte     %8.0g                        believed % of cumulative radiation exposed to in a lifetime NOW


radchw1           byte     %8.0g                        believed % of polution related to chornobyl in 1986


radchw2           byte     %8.0g                        believed % of polution related to chornobyl in 1996


radchw3           byte     %8.0g                        believed % of polution related to chornobyl NOW


radhlw1           byte     %8.0g                        how much believed personal health is affected by radiation in 1986


radhlw2           byte     %8.0g                        how much believed personal health is affected by radiation in 1996


radhlw3           byte     %8.0g                        Observed


radfmw1           byte     %8.0g                        how much believed family health is affected by radiation in 1986


radfmw2           byte     %8.0g                        how much believed family health is affected by radiation in 1996


radfmw3           byte     %8.0g                        how much believed family health is affected by radiation NOW


. stcox radw2 radchw2 radtlw3  if gender==1,  iterate(20) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          149                     Number of obs   =       149
No. of failures =          147
Time at risk    =         1905
                                                   LR chi2(3)      =     19.36
Log likelihood  =   -601.23062                     Prob > chi2     =    0.0002

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
       radw2 |    1.009665    .0029245      3.32    0.001      1.003949     1.015413
     radchw2 |    .9892434    .0032574     -3.28    0.001      .9828796     .9956483
     radtlw3 |    1.007286    .0031668      2.31    0.021      1.001099     1.013512
-------------+----------------------------------------------------------------

.
. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      radw2       |      0.02247         0.08        1         0.7804
      radchw2     |     -0.01939         0.06        1         0.8056
      radtlw3     |     -0.03564         0.20        1         0.6547
      ------------+---------------------------------------------------
      global test |                      0.73        3         0.8655
      ------------+---------------------------------------------------

. cap drop m10r2pt

. gen m10r2pt = e(r2_p)

. matrix define m10bt = e(b)'

. matrix define m109vt = e(V)

. local modtype10 RadChRel

. str2d stcox radw2 radchw2 radtlw3  if gender==1,  iterate(20) nolog

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 10350      147    0.097227    0.039485   0.032576  0.182729  0.672  0.151
--------------------------------------------------------------------------

. di m10r2pt
.01584264

. cap gen m10r2dt = r(r2)

. di m9r2pt
.01189235

. cap gen m10llf = e(ll)

. cap gen m10dff = e(rank)

. cap drop m109r2ptcha

. cap gen m109r2dcha = m10r2dt - m9r2dt

. di m109r2dcha
.04441682

. local tr trimmed

. local tr trimmed

. label var m109r2dcha "R square chnge bet male `tr' models of `modtype10' and `modtype9'"

. qui : {
Difference between male trimmed models
*******************************************************
Difference between level 10 and level 9 male trimmed models:
Difference between RadChRel
 and  Gen_rad_risk  models
m10r2d =  .09722728
m10r2dt =  .09722728
m9r2dt =  .05281045
Pseudo R^2 change:
m10r2dt - m9r2dt =  .04441682
******************************************************

.
.
. qui : {
Between Major_negative_life_events and geosocidemog male trimmed models:
m1r2dt =  .02967568
m2r2dt =  .10885216
 m21r2dcha =  .07917648
Between stress_and_hassles and Major_negative_life_events male trimmed models:
m3r2dt =  .10647088
 m32r2dcha =  -.00238129
Between buffers_and_supports and stress_and_hassles male trimmed models:
 m4r2dt =  .0495838
 m43r2dcha =  -.05688707
Between Self-Perceived Illnesses and buffers_and_supports male trimmed models:
 m5r2dt =  .14155276
 m43r2dcha =  .09196895
Between Medical_Diag and Self-Perceived Illnesses male trimmed models:
 m6r2dt =  .15666422
 m65r2dcha =  .01511146
 m7r2dt =  .0571961
 m76r2dcha =  -.09946813
 m8r2dt =  .10135787
 m87r2dcha =  0
 m9r2dt =  .05281045
 m98r2dcha =  -.02486759
 m10r2dt =  .09722728
 m109r2dcha =  .04441682

.
. qui : {
Adding Major_negative_life_events to geosocidemog male trimmed models:
                   m1r2dt =  .02967568
                   m2r2dt =  .10885216
Adding stress_and_hassles to Major_negative_life_events male trimmed models:
                   m3r2dt =  .10647088
Adding buffers_and_supports to stress_and_hassles male trimmed models:
                   m4r2dt =  .0495838
Adding Self-Perceived Illnesses to buffers_and_supports male trimmed models:
                   m5r2dt =  .14155276
Adding Medical_Diag to Self-Perceived Illnesses male trimmed models:
                   m6r2dt =  .15666422
Adding Health_Behaviors to Medical_Diag male trimmed models:
                   m7r2dt =  .0571961
Adding Health_scales to Health_Behaviors male trimmed models:
                   m8r2dt =  .10135787
Adding Gen_rad_risk to Health_scales male trimmed models:
                   m9r2dt =  .05281045
Adding RadChRel to Gen_rad_risk male trimmed models:
                   m10r2dt =  .09722728

.
.
. di as input "*-chunk 10 Female radiation and Chornobyl risk model"
*-chunk 10 Female radiation and Chornobyl risk model

. di as input "The trimmed female model"  // partial trimming to get it to run
The trimmed female model

. set more off

.
. des goferw2 radchw3 radtlw1-radtlw3 radchw1-radchw3 toxic

              storage  display     value
variable name   type   format      label      variable label
-------------


goferw2           byte     %8.0g                        level of fear in percent from going outdoors in 1987-1996


radchw3           byte     %8.0g                        believed % of polution related to chornobyl NOW


radtlw1           byte     %8.0g                        believed % of cumulative radiation exposed to in a lifetime in 1986


radtlw2           byte     %8.0g                        believed % of cumulative radiation exposed to in a lifetime in 1996


radtlw3           byte     %8.0g                        believed % of cumulative radiation exposed to in a lifetime NOW


radchw1           byte     %8.0g                        believed % of polution related to chornobyl in 1986


radchw2           byte     %8.0g                        believed % of polution related to chornobyl in 1996


radchw3           byte     %8.0g                        believed % of polution related to chornobyl NOW


toxic             byte     %8.0g                        all radioactive materials remain toxic for thousands of years (% of agreement)


. stcox toxic goferw2 radchw3 if gender==2,  iterate(20)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Iteration 0:   log likelihood = -792.81677
Iteration 1:   log likelihood = -789.95721
Iteration 2:   log likelihood = -789.56805
Iteration 3:   log likelihood = -789.56575
Iteration 4:   log likelihood = -789.56575
Refining estimates:
Iteration 0:   log likelihood = -789.56575

Cox regression -- Breslow method for ties

No. of subjects =          185                     Number of obs   =       185
No. of failures =          181
Time at risk    =         2347
                                                   LR chi2(3)      =      6.50
Log likelihood  =   -789.56575                     Prob > chi2     =    0.0896

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
       toxic |    .9985424    .0023031     -0.63    0.527      .9940385     1.003067
     goferw2 |    1.009286    .0033927      2.75    0.006      1.002659     1.015958
     radchw3 |    1.000491    .0023034      0.21    0.831      .9959861     1.005015
-------------+----------------------------------------------------------------

. estat phtest

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      7.05        3         0.0702
      ------------+---------------------------------------------------

. estat concordance

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      185
  Number of comparison pairs (P)      =    15758
  Number of orderings as expected (E)  =     9221
  Number of tied predictions (T)      =      337

          Harrell's C = (E + T/2) / P  =    .5959
                            Somers' D  =    .1917

. // some items were dropped owing to collinearity -Andrushevskiy and some icdx items
.
.
. di as input "Fractional Polynomial Trimmed Female Adjustment"
Fractional Polynomial Trimmed Female Adjustment

. cap drop f10r2dt

. stcox age goferw2 radchw3 if gender==2,  iterate(20)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Iteration 0:   log likelihood = -792.81677
Iteration 1:   log likelihood =  -784.8265
Iteration 2:   log likelihood = -784.61074
Iteration 3:   log likelihood = -784.61002
Refining estimates:
Iteration 0:   log likelihood = -784.61002

Cox regression -- Breslow method for ties

No. of subjects =          185                     Number of obs   =       185
No. of failures =          181
Time at risk    =         2347
                                                   LR chi2(3)      =     16.41
Log likelihood  =   -784.61002                     Prob > chi2     =    0.0009

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
         age |    1.021543    .0068041      3.20    0.001      1.008293     1.034966
     goferw2 |    1.012231    .0036199      3.40    0.001      1.005161     1.019351
     radchw3 |    1.000104    .0022768      0.05    0.964      .9956514     1.004576
-------------+----------------------------------------------------------------

. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      age         |     -0.19234         6.71        1         0.0096
      goferw2     |     -0.20764         5.95        1         0.0147
      radchw3     |      0.09465         1.58        1         0.2081
      ------------+---------------------------------------------------
      global test |                     11.51        3         0.0093
      ------------+---------------------------------------------------

. estat concordance

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      185
  Number of comparison pairs (P)      =    15758
  Number of orderings as expected (E)  =    10014
  Number of tied predictions (T)      =       26

          Harrell's C = (E + T/2) / P  =    .6363
                            Somers' D  =    .2726

. fracpoly, compare :stcox age goferw2 radchw3 if gender==2, iterate(20)
-> gen double Igofe__1 = goferw2-8.065592635 if e(sample)
-> gen double Iradc__1 = radchw3-61.50048685 if e(sample)
........
-> gen double Iage__1 = X^-2-.0380024006 if e(sample)
-> gen double Iage__2 = X^-2*ln(X)-.0621359381 if e(sample)
   (where: X = age/10)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Iteration 0:   log likelihood = -792.81677
Iteration 1:   log likelihood = -784.02286
Iteration 2:   log likelihood = -783.60054
Iteration 3:   log likelihood = -783.59687
Iteration 4:   log likelihood = -783.59687
Refining estimates:
Iteration 0:   log likelihood = -783.59687

Cox regression -- Breslow method for ties

No. of subjects =          185                     Number of obs   =       185
No. of failures =          181
Time at risk    =         2347
                                                   LR chi2(4)      =     18.44
Log likelihood  =   -783.59687                     Prob > chi2     =    0.0010

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
     Iage__1 |    1.01e-10    2.57e-09     -0.91    0.365      2.30e-32     4.46e+11
     Iage__2 |    191192.1     5066165      0.46    0.646      5.33e-18     6.86e+27
    Igofe__1 |    1.014054    .0039707      3.56    0.000      1.006301     1.021866
    Iradc__1 |    1.000278    .0022782      0.12    0.903      .9958227     1.004753
-------------+----------------------------------------------------------------
Deviance:  1567.19. Best powers of age among 44 models fit: -2 -2.

Fractional polynomial model comparisons:
---------------------------------------------------------------
age              df       Deviance   Dev. dif.  P (*)  Powers
---------------------------------------------------------------
Not in model      0       1579.526    12.332    0.015
Linear            1       1569.220     2.026    0.567  1
m = 1             2       1567.407     0.213    0.899  -2
m = 2             4       1567.194        --       --  -2 -2
---------------------------------------------------------------
(*) P-value from deviance difference comparing reported model with m = 2 model

. stcox Igofe__1 Iradc__1 Iage__2 if gender==2, iterate(20)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Iteration 0:   log likelihood = -792.81677
Iteration 1:   log likelihood = -784.27342
Iteration 2:   log likelihood = -784.02055
Iteration 3:   log likelihood = -784.01991
Refining estimates:
Iteration 0:   log likelihood = -784.01991

Cox regression -- Breslow method for ties

No. of subjects =          185                     Number of obs   =       185
No. of failures =          181
Time at risk    =         2347
                                                   LR chi2(3)      =     17.59
Log likelihood  =   -784.01991                     Prob > chi2     =    0.0005

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
    Igofe__1 |    1.013131     .003763      3.51    0.000      1.005783     1.020533
    Iradc__1 |    1.000124    .0022729      0.05    0.957      .9956789     1.004588
     Iage__2 |    8.43e-06    .0000301     -3.27    0.001      7.69e-09     .0092492
-------------+----------------------------------------------------------------

. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      Igofe__1    |     -0.19772         5.88        1         0.0153
      Iradc__1    |      0.09697         1.66        1         0.1979
      Iage__2     |      0.19809         7.41        1         0.0065
      ------------+---------------------------------------------------
      global test |                     11.65        3         0.0087
      ------------+---------------------------------------------------

. estat concordance

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      185
  Number of comparison pairs (P)      =    15758
  Number of orderings as expected (E)  =    10036
  Number of tied predictions (T)      =       26

          Harrell's C = (E + T/2) / P  =    .6377
                            Somers' D  =    .2754

. str2d stcox age goferw2 radchw3 if gender==2,  iterate(20)

R^2 (explained variation - D method): Cox model

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 11297      181    0.061898    0.030340   0.015468  0.131080  0.526  0.137
--------------------------------------------------------------------------

.
. gen f10r2dt = r(r2)

. di f10r2dt
.06189839

.
. estat phtest, detail

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      age         |     -0.19234         6.71        1         0.0096
      goferw2     |     -0.20764         5.95        1         0.0147
      radchw3     |      0.09465         1.58        1         0.2081
      ------------+---------------------------------------------------
      global test |                     11.51        3         0.0093
      ------------+---------------------------------------------------

. matrix define f10fhsdbt = e(b)'

. matrix define f10fhsdvt = e(V)

. local modtype10 Gen_rad_risk

.
. di e(r2_p)
.01035138

. di f10r2dt
.06189839

. cap gen f10llt = e(ll)

. cap gen f10dft = e(rank)

. di f9r2dt
.04565085

. cap gen f109r2dcha = f10r2dt - f9r2dt

. di f109r2dcha
.01624754

. local tr trimmed

.
.
. label var m109r2dcha "R square chnge bet female `tr' models of `modtype10' and `modtype9'"

. qui : {
Difference between female trimmed models
*******************************************************
Difference between level 10 and level 9 female trimmed models:
Difference between Gen_rad_risk
 and  Gen_rad_risk  models
f10r2dt =  .06189839
f9r2dt =  .04565085
Pseudo R^2 change:
f10r2dt - f9r2dt =  .01624754
******************************************************

.
.
. qui : {
Between Major_negative_life_events and geosocidemog female trimmed models:
f1r2dt =  .15346491
f2r2dt =  .12600078
 f21r2dcha =  -.02746414
Between stress_and_hassles and Major_negative_life_events female trimmed models:
f3r2dt =  .10647088
 f32r2dcha =  -.05885519
Between buffers_and_supports and stress_and_hassles female trimmed models:
 f4r2dt =  .00942887
 f43r2dcha =  -.05771671
Between Self-Perceived Illnesses and buffers_and_supports female trimmed models:
 f5r2dt =  .1898281
 f43r2dcha =  .18039922
Between Medical_Diag and Self-Perceived Illnesses female trimmed models:
 f6r2dt =  .15666422
 f65r2dcha =  .01511146
 f7r2dt =  .00308416
 f76r2dcha =  -.1672489
 f8r2dt =  .06241624
 f87r2dcha =  .05933208
 f9r2dt =  .04565085
 f98r2dcha =  -.04854742
 f10r2dt =  .06189839
 f109r2dcha =  .01624754

.
. qui : {
Adding Major_negative_life_events to geosocidemog female trimmed models:
                   f1r2dt =  .15346491
                   f2r2dt =  .12600078
Adding stress_and_hassles to Major_negative_life_events female trimmed models:
                   f3r2dt =  .06714559
Adding buffers_and_supports to stress_and_hassles female trimmed models:
                   f4r2dt =  .00942887
Adding Self-Perceived Illnesses to buffers_and_supports female trimmed models:
                   f5r2dt =  .1898281
Adding Medical_Diag to Self-Perceived Illnesses female trimmed models:
                   f6r2dt =  .17033306
Adding Health_Behaviors to Medical_Diag female trimmed models:
                   f7r2dt =  .00308416
Adding Health_scales to Health_Behaviors female trimmed models:
                   f8r2dt =  .06241624
Adding Gen_rad_risk to Health_scales female trimmed models:
                   f9r2dt =  .04565085
Adding Gen_rad_risk to Gen_rad_risk female trimmed models:
                   f10r2dt =  .06189839

.
. scalar f10r2dt = f10r2dt

. forvalues i=1/10 {
  2. scalar f`i'r2dt = f`i'r2dt
  3. scalar m`i'r2dt = m`i'r2dt
  4. }

.
. scalar m1r2pf = m1r2pf

. scalar m2r2pf = m2r2pf

. scalar f7r2pf = f7r2pf

. forvalues i=1/10 {
  2. scalar f`i'r2dt = f`i'r2dt
  3. scalar m`i'r2dt = m`i'r2dt
  4. }

.
. ***********  Construction of summary matrices for R2D for Domains********************************************************************
.
. matrix define mr2dt = [ m1r2dt \ m2r2dt \ m3r2dt \m4r2dt \ m5r2dt \ m6r2dt \ ///
>     m7r2dt \ m8r2dt \ m9r2dt \ m10r2dt ]

.
. matrix colnames mr2dt = r2d

. matrix rownames mr2dt = geosociodem MajNegEvts StrsHasls BuffsSpts SlfPcdIlls  MedDx HlthBhv HlthScls risksavy radissues

. matlist mr2dt

   | r2d
-------------+-----------
geosociodem   |  .0296757
MajNegEvts   |  .1088522
StrsHasls   |  .1064709
BuffsSpts   |  .0495838
SlfPcdIlls   |  .1415528
MedDx   |  .1566642
HlthBhv   |  .0571961
HlthScls   |  .1013579
risksavy   |  .0528105
radissues   |  .0972273

.
.
.
.
.
.
. matrix define fr2dt = [ f1r2dt \ f2r2dt \ f3r2dt \f4r2dt \ f5r2dt \ f6r2dt \ f7r2dt \ f8r2dt \ f9r2dt \ f10r2dt ]

.
. matrix colnames fr2dt = r2d

. matrix rownames fr2dt = geosociodem MajNegEvts StrsHasls BuffsSpts SlfPcdIlls  MedDx HlthBhv HlthScls risksavy radissues

. matlist fr2dt

   | r2d
-------------+-----------
geosociodem   |  .1534649
MajNegEvts   |  .1260008
StrsHasls   |  .0671456
BuffsSpts   |  .0094289
SlfPcdIlls   |  .1898281
MedDx   |  .1703331
HlthBhv   |  .0030842
HlthScls   |  .0624162
risksavy   |  .0456509
radissues   |  .0618984

.
. matrix domainr2d = [ mr2dt, fr2dt ]

. matrix colnames domainr2d = male female

. matrix rownames domainr2d = geosociodem MajNegEvts StrsHasls BuffsSpts SlfPcdIlls  MedDx HlthBhv HlthScls risksavy radissues

. matlist domainr2d

   | male    female
-------------+----------------------
geosociodem   |  .0296757     .1534649
MajNegEvts   |  .1088522     .1260008
StrsHasls   |  .1064709     .0671456
BuffsSpts   |  .0495838     .0094289
SlfPcdIlls   |  .1415528     .1898281
MedDx   |  .1566642     .1703331
HlthBhv   |  .0571961     .0030842
HlthScls   |  .1013579     .0624162
risksavy   |  .0528105     .0456509
radissues   |  .0972273     .0618984

.
.
.
. cap gen risktime= _t - _t0

.
.
. ///// / ********   Full models    //***************** */
> set more off

. di as input "Chunk 12 male radiation and Chornobyl related model "
Chunk 12 male radiation and Chornobyl related model

.
. ******* Omnibus male model
. des Korostenskiy ///
>      Narodichevskiy ///
>    Radomischevskiy Tarascheskiy Zhitomirskiy ///
>    age  mar3w1 mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>        suprtw1  suchrw1 ///
>          mhlthw2 cardiovascular1w1 respiratory1w1     mhlthw3  ///
>              icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3  ecprw3  ///
>                 trgovw1

              storage  display     value
variable name   type   format      label      variable label
-------------


Korostenskiy      byte     %8.0g                        ranown==69


Narodichevskiy    byte     %8.0g                        ranown==78


Radomischevskiy   byte     %8.0g                        ranown==86


Tarascheskiy      byte     %8.0g                        ranown==93


Zhitomirskiy      byte     %8.0g                        ranown==102


age               byte     %8.0g                    *   Respondent's age


mar3w1            byte     %9.0g                        Married in 1986


mar5w1            byte     %9.0g                        Divorced in wave 1


occ5w3            byte     %15.0g        LABJ           factory laborer machinist transp cleaner now


dvcew2            byte     %8.0g                        Total number of divorces experienced in time period 1987-1996


cataw3            byte     %8.0g                        Total number of disasters experienced in time period 1996-NOW


shfamw1           byte     %8.0g                        Percentage of strains and hassles related to family in 1986


shrelaw1          byte     %8.0g                        Percentage of strains and hassles related to relationships in 1986


shjobw2           byte     %8.0g                        Percentage of strains and hassles related to job in 1996


shhlw2            byte     %8.0g                        Percentage of strains and hassles related to health in 1996


shhousw3          byte     %8.0g                        Percentage of strains and hassles related to housing NOW


suprtw1           byte     %8.0g                        Level of support (in percent) from partner in 1986


suchrw1           byte     %8.0g                        Level of support (in percent) from Chernobyl survivor benefits in 1986


mhlthw2           byte     %8.0g                        level of general psychological/mental health in 1996


cardiovascu~1w1   byte     %8.0g                        nil1w1==2


respiratory1w1    byte     %8.0g                        nil1w1==13


mhlthw3           byte     %8.0g                        level of general psychological/mental health now


icdx3nr6          byte     %8.0g                        icdx3nr==acute myocardial infarct


ncontw1           byte     %15.0g        LABC           use of natural contraception in 1976-1986


MiPTSD            byte     %9.0g                        Misssissipi post-traumatic stress disorder scale


defnw1            byte     %8.0g                    *   consider hazardous (in percent) - deficiencies in essential nutrition in 1986


defnw2            byte     %8.0g                    *   consider hazardous (in percent) - deficiencies in essential nutrition in 1996


efradw3           byte     %8.0g                        consider hazardous (in percent) - effects of radiation NOW


ecprw3            byte     %8.0g                        consider hazardous (in percent) - economic problems, NOW


trgovw1           byte     %8.0g                        level of trust in government reports about chornobyl in time period 1976-1986


.
.  ****** Cox Proportioal Hazards regression  model for males
.  stcox Korostenskiy ///
>      Narodichevskiy ///
>    Radomischevskiy Tarascheskiy Zhitomirskiy ///
>    age  mar3w1 mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>        suprtw1  suchrw1 ///
>          mhlthw2  mhlthw3  ///  // cardiovascular1w1   same as the icdx3nr6
>              icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3  ecprw3  ///
>                 trgovw1 if gender==1,  iterate(20) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          138                     Number of obs   =       138
No. of failures =          136
Time at risk    =         1871
                                                   LR chi2(28)     =     94.69
Log likelihood  =   -508.16552                     Prob > chi2     =    0.0000

--------------+----------------------------------------------------------------
            _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
 Korostenskiy |    2547.232    3465.215      5.77    0.000      177.0546     36646.27
Narodichevs~y |    30.74272    40.66074      2.59    0.010      2.301079     410.7268
Radomischev~y |    28.50788    36.79579      2.60    0.009      2.271429     357.7921
 Tarascheskiy |    .0590859    .0650946     -2.57    0.010       .006819     .5119747
 Zhitomirskiy |    2.680468    .9326266      2.83    0.005      1.355341     5.301183
          age |    1.061576    .0187196      3.39    0.001      1.025514     1.098908
       mar3w1 |    .3640617    .1359438     -2.71    0.007      .1751173     .7568694
       mar5w1 |    .2753806    .1860833     -1.91    0.056      .0732402     1.035421
       occ5w3 |    .2824997    .1235527     -2.89    0.004      .1198783     .6657258
       dvcew2 |    4.986525    3.274371      2.45    0.014      1.376771     18.06068
       cataw3 |    .0060443    .0076461     -4.04    0.000      .0005065      .072131
      shfamw1 |    .9874573    .0039896     -3.12    0.002      .9796686     .9953078
     shrelaw1 |    1.016219    .0044466      3.68    0.000      1.007541     1.024972
      shjobw2 |    1.007412    .0038565      1.93    0.054      .9998821     1.014999
       shhlw2 |    .9898465    .0041637     -2.43    0.015      .9817194      .998041
     shhousw3 |    .9902823    .0036482     -2.65    0.008      .9831577     .9974585
      suprtw1 |    1.032123    .0195893      1.67    0.096      .9944345     1.071241
      suchrw1 |    .9710358    .0153686     -1.86    0.063      .9413763      1.00163
      mhlthw2 |    .9679392    .0065782     -4.79    0.000      .9551317     .9809185
      mhlthw3 |    1.021049    .0063609      3.34    0.001      1.008658     1.033592
     icdx3nr6 |    .0013066    .0021522     -4.03    0.000      .0000518     .0329765
      ncontw1 |     1.80818    .4561703      2.35    0.019      1.102806     2.964722
       MiPTSD |      1.0577    .0117622      5.04    0.000      1.034895     1.081006
       defnw1 |    .9890603    .0048379     -2.25    0.025      .9796234      .998588
       defnw2 |    .9846339    .0069572     -2.19    0.028       .971092     .9983645
      efradw3 |    1.014134    .0040878      3.48    0.000      1.006153     1.022177
       ecprw3 |    1.011382       .0071      1.61    0.107      .9975618     1.025394
      trgovw1 |    1.012962     .003036      4.30    0.000      1.007029      1.01893
--------------+----------------------------------------------------------------

.  estat phtest        // ph assumption met

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                     23.99       28         0.6821
      ------------+---------------------------------------------------

.  estat concordance   // good fit for males

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      138
  Number of comparison pairs (P)      =     8664
  Number of orderings as expected (E)  =     6793
  Number of tied predictions (T)      =        0

          Harrell's C = (E + T/2) / P  =     .784
                            Somers' D  =    .5681

.
.
. cap drop m12r2pf

. matrix define m12fbhdbf = e(b)'

. matrix define m12fhbdvf = e(V)

. local modtype12 FullMaleModel

. cap gen m12r2pf = e(r2_p)

. di m12r2pf
.0852285

. cap gen m12llf= e(ll)

. cap gen m12dff = e(rank)

. di m12r2pf
.0852285

. cap drop m1110r2pfcha

.
.
.
.
. stcox Korostenskiy ///
>      Narodichevskiy ///
>    Radomischevskiy Tarascheskiy Zhitomirskiy ///
>    age mar3w1 mar5w1 occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>         suprtw1 suchrw1 ///
>          mhlthw2  ///
>             mhlthw3  ///
>              icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2 efradw3 ecprw3  ///
>                 trgovw1 if gender==1, nolog iterate(20)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          138                     Number of obs   =       138
No. of failures =          136
Time at risk    =         1871
                                                   LR chi2(28)     =     94.69
Log likelihood  =   -508.16552                     Prob > chi2     =    0.0000

--------------+----------------------------------------------------------------
            _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
 Korostenskiy |    2547.232    3465.215      5.77    0.000      177.0546     36646.27
Narodichevs~y |    30.74272    40.66074      2.59    0.010      2.301079     410.7268
Radomischev~y |    28.50788    36.79579      2.60    0.009      2.271429     357.7921
 Tarascheskiy |    .0590859    .0650946     -2.57    0.010       .006819     .5119747
 Zhitomirskiy |    2.680468    .9326266      2.83    0.005      1.355341     5.301183
          age |    1.061576    .0187196      3.39    0.001      1.025514     1.098908
       mar3w1 |    .3640617    .1359438     -2.71    0.007      .1751173     .7568694
       mar5w1 |    .2753806    .1860833     -1.91    0.056      .0732402     1.035421
       occ5w3 |    .2824997    .1235527     -2.89    0.004      .1198783     .6657258
       dvcew2 |    4.986525    3.274371      2.45    0.014      1.376771     18.06068
       cataw3 |    .0060443    .0076461     -4.04    0.000      .0005065      .072131
      shfamw1 |    .9874573    .0039896     -3.12    0.002      .9796686     .9953078
     shrelaw1 |    1.016219    .0044466      3.68    0.000      1.007541     1.024972
      shjobw2 |    1.007412    .0038565      1.93    0.054      .9998821     1.014999
       shhlw2 |    .9898465    .0041637     -2.43    0.015      .9817194      .998041
     shhousw3 |    .9902823    .0036482     -2.65    0.008      .9831577     .9974585
      suprtw1 |    1.032123    .0195893      1.67    0.096      .9944345     1.071241
      suchrw1 |    .9710358    .0153686     -1.86    0.063      .9413763      1.00163
      mhlthw2 |    .9679392    .0065782     -4.79    0.000      .9551317     .9809185
      mhlthw3 |    1.021049    .0063609      3.34    0.001      1.008658     1.033592
     icdx3nr6 |    .0013066    .0021522     -4.03    0.000      .0000518     .0329765
      ncontw1 |     1.80818    .4561703      2.35    0.019      1.102806     2.964722
       MiPTSD |      1.0577    .0117622      5.04    0.000      1.034895     1.081006
       defnw1 |    .9890603    .0048379     -2.25    0.025      .9796234      .998588
       defnw2 |    .9846339    .0069572     -2.19    0.028       .971092     .9983645
      efradw3 |    1.014134    .0040878      3.48    0.000      1.006153     1.022177
       ecprw3 |    1.011382       .0071      1.61    0.107      .9975618     1.025394
      trgovw1 |    1.012962     .003036      4.30    0.000      1.007029      1.01893
--------------+----------------------------------------------------------------

. estat phtest    //  this fulfills the proportional hazards assumption

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                     23.99       28         0.6821
      ------------+---------------------------------------------------

. estat concordance  // but the fit could be better

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      138
  Number of comparison pairs (P)      =     8664
  Number of orderings as expected (E)  =     6793
  Number of tied predictions (T)      =        0

          Harrell's C = (E + T/2) / P  =     .784
                            Somers' D  =    .5681

.
. cap drop sc1

. gen sc1 = -2*e(ll) + ln(e(N))*e(rank)

. scalar sc1 = sc1

. di "Schwartz criterion = ",sc1
Schwartz criterion =  1154.2942

. cap drop staic

. gen staic = -2*e(ll) + 2*e(rank)

. scalar staic = staic

. di "staic= ", staic
staic=  1072.3311

. scalar typeMod = 1

. cap label var typeMod 1 "male" 2 "female"

.
. replace sc1 = sc1
(0 real changes made)

. replace staic = staic
(0 real changes made)

. matrix define MaleModelCf = [staic, sc1]

. matrix rownames MaleModelCf = stcox

. matrix colnames MaleModelCf = aic sc

. matlist MaleModelCf

   | aic    sc
-------------+----------------------
stcox   |  1072.331     1154.294

.
.
.
. ****** Adjusted R^2 validation with a bootstrap of 30 reps******************
. *** with cluster robust variance estimates
.
.
. str2ph stcox Korostenskiy ///
>      Narodichevskiy ///
>    Radomischevskiy Tarascheskiy Zhitomirskiy ///
>    age  mar3w1 mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>        suprtw1  suchrw1 ///
>          mhlthw2  ///
>             mhlthw3  ///
>              icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3  ecprw3  ///
>                 trgovw1 if gender==1,  nolog vce(cluster id)

R^2 (explained variation): Cox model

   Obs    Events     R^2       Boot. SE   95% conf. interval
------------------------------------------------------------
  9514      136    0.379542           .          .         .
------------------------------------------------------------

.
.
.
. str2ph stcox Korostenskiy ///
>      Narodichevskiy ///
>    Radomischevskiy Tarascheskiy Zhitomirskiy ///
>    age  mar3w1 mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>        suprtw1  suchrw1 ///
>          mhlthw2  ///
>             mhlthw3  ///
>              icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3  ecprw3  ///
>                 trgovw1 if gender==1,  nolog vce(cluster id) ///
>                  adjust

R^2 (explained variation): Cox model

   Obs    Events   Adj. R^2    Boot. SE   95% conf. interval
------------------------------------------------------------
  9514      136    0.277860           .          .         .
------------------------------------------------------------

.
. *************************************************************************************************
. // flexibile parametric version with restricted cubic splines is not as good as Weibull model
. *************************************************************************************************
. *      running stpm2 requires downloading and installing into Stata the following package *******
. * SJ-9-2  st0165  . Further dev. of flexible param. models for survival analysis
. *         . . . . . . . . . . . . . . . . . . . . . P. C. Lambert and P. Royston
. *        (help stpm2, stpm2_postestimation if installed)
. *        Q2/09   SJ 9(2):265--290
. *************************************************************************************************
.
.
.
. stpm2 Korostenskiy ///
>      Narodichevskiy ///
>    Radomischevskiy Tarascheskiy Zhitomirskiy ///
>    age  mar3w1 mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>        suprtw1  suchrw1 ///
>          mhlthw2  mhlthw3  ///  // cardiovascular1w1   same as the icdx3nr6
>              icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3  ecprw3  ///
>                 trgovw1 if gender==1, df(3) scale(odds) iterate(20) nolog

Log likelihood = -93.358488                       Number of obs   =        138

--------------+----------------------------------------------------------------
              |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
xb            |
 Korostenskiy |    10.23866    1.880951      5.44    0.000      6.552061     13.92525
Narodichevs~y |      4.7441    1.881183      2.52    0.012      1.057049     8.431151
Radomischev~y |    4.543148    1.978424      2.30    0.022      .6655095     8.420787
 Tarascheskiy |   -4.873246    1.638676     -2.97    0.003     -8.084993    -1.661499
 Zhitomirskiy |    1.353559    .6055235      2.24    0.025      .1667549     2.540363
          age |    .0891509    .0277486      3.21    0.001      .0347647     .1435371
       mar3w1 |   -.7797144    .5666428     -1.38    0.169     -1.890314     .3308852
       mar5w1 |   -2.039819    1.095558     -1.86    0.063     -4.187073     .1074341
       occ5w3 |    -2.36812    .6752442     -3.51    0.000     -3.691574    -1.044666
       dvcew2 |       1.944    .9573619      2.03    0.042      .0676056     3.820395
       cataw3 |   -9.306471    1.938162     -4.80    0.000      -13.1052    -5.507742
      shfamw1 |   -.0165647    .0063595     -2.60    0.009     -.0290291    -.0041003
     shrelaw1 |    .0273005    .0077161      3.54    0.000      .0121773     .0424237
      shjobw2 |    .0151838    .0062346      2.44    0.015      .0029643     .0274033
       shhlw2 |   -.0113893     .006457     -1.76    0.078     -.0240447     .0012661
     shhousw3 |   -.0142718    .0072406     -1.97    0.049     -.0284631    -.0000805
      suprtw1 |    .0512331    .0290961      1.76    0.078     -.0057941     .1082604
      suchrw1 |   -.0429447    .0237202     -1.81    0.070     -.0894354      .003546
      mhlthw2 |   -.0364187    .0109718     -3.32    0.001      -.057923    -.0149144
      mhlthw3 |    .0268481    .0107619      2.49    0.013      .0057551     .0479411
     icdx3nr6 |   -9.129049    2.322314     -3.93    0.000      -13.6807    -4.577397
      ncontw1 |    1.249684    .4230078      2.95    0.003      .4206043     2.078764
       MiPTSD |    .0755526    .0173099      4.36    0.000      .0416258     .1094794
       defnw1 |   -.0200452    .0082226     -2.44    0.015     -.0361611    -.0039292
       defnw2 |   -.0226845    .0113973     -1.99    0.047     -.0450227    -.0003463
      efradw3 |    .0242455    .0066521      3.64    0.000      .0112076     .0372834
       ecprw3 |     .010759    .0111781      0.96    0.336     -.0111496     .0326676
      trgovw1 |    .0174225    .0049555      3.52    0.000      .0077099     .0271351
        _rcs1 |    2.748285    .2187835     12.56    0.000      2.319478     3.177093
        _rcs2 |    .2183368    .2591312      0.84    0.399     -.2895509     .7262245
        _rcs3 |   -.2606144    .1070716     -2.43    0.015     -.4704708    -.0507579
        _cons |   -8.848297    2.075378     -4.26    0.000     -12.91596    -4.780631
--------------+----------------------------------------------------------------

. di e(AIC)    // better than stcox but not better than Weibull
250.71698

. di e(BIC)
343.92193

.
. cap drop sc2

. gen sc2 = -2*e(ll) + (ln(e(N))*e(rank)-1)

. replace sc2 = sc2
(0 real changes made)

. scalar sc2 = sc2

. di "Schwartz criterion = ",sc2
Schwartz criterion =  343.3891

. cap drop staic2

. gen staic2 = -2*e(ll) + 2*e(rank)

. scalar staic2 = staic2

. di "staic= ", staic2
staic=  250.71698

. scalar typeMod = 1

. cap label var typeMod 1 "male" 2 "female"

.
. replace sc2 = sc2
(0 real changes made)

. replace staic2 = staic2
(0 real changes made)

. matrix define MaleModelCf = [staic, sc1\ staic2, sc2]

. matrix rownames MaleModelCf = stcox stpm2

. matrix colnames MaleModelCf = aic sc

. matlist MaleModelCf

   | aic    sc
-------------+----------------------
stcox   |  1072.331     1154.294
stpm2   |   250.717     343.3891

.
.
. di as input " Chunk 12 Full Female radiation and Chornobyl related model"
 Chunk 12 Full Female radiation and Chornobyl related model

. des Irpenskiy Kyivskiy  ///
>        age mar2w1  ///
>        occ5w1  occ4w2 occ5w2  ///
>      deaw1 cataw1  ///
>          icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///
>                     injothr   ///
>                      contw2   ///
>                        WHPer BSIoc BSIanx HP2work neiw1 toxic  ///
>                        goferw2

              storage  display     value
variable name   type   format      label      variable label
-------------


Irpenskiy         byte     %8.0g                        ranown==67


Kyivskiy          byte     %8.0g                        ranown==72


age               byte     %8.0g                    *   Respondent's age


mar2w1            byte     %9.0g                        cohabiting in 1986


occ5w1            byte     %15.0g        LABJ           factory laborer machinist transp cleaner  in 1986


occ4w2            byte     %15.0g        LABJ           precision prod mechan craft construction in 1996


occ5w2            byte     %15.0g        LABJ           factory laborer machinist transp cleaner in 1996


deaw1             byte     %8.0g                        Total number of death experienced in time period 1986


cataw1            byte     %8.0g                        Total number of disasters experienced in time period 1976-1986


icdx3nr9          byte     %8.0g                        icdx3nr==gastritis/duodenitis


icdx4nr7          byte     %8.0g                        icdx4nr==acute myocardial infarct


icdx4nr9          byte     %8.0g                        icdx4nr==434.91 crbrl art ocl nos w infarc


icdx5nr2          byte     %8.0g                        icdx5nr==thyrotoxicosis


icdx5nr11         byte     %8.0g                        icdx5nr==gastritis/duodenitis


injothr           byte     %9.0g         inj            Was anyone u know injured by Chornobyl accident?


contw2            byte     %15.0g        LABC           use of any contraception method in 1987-1996


WHPer             float    %9.0g                        Wtd Health Profile Emotional reaction Pt 1 subscale


BSIoc             byte     %9.0g                        Basic Symptom Inventory Obsessive compulsive subscale


BSIanx            byte     %9.0g                        Basic symptom inventory Anxiety subscale


HP2work           byte     %9.0g         hp2fmt         Nottingham Health profile subscale Part2: paid employment


neiw1             byte     %8.0g                        level of danger by neighbors (in percent) in 1986


toxic             byte     %8.0g                        all radioactive materials remain toxic for thousands of years (% of agreement)


goferw2           byte     %8.0g                        level of fear in percent from going outdoors in 1987-1996


.
.
. // nb: icdx3nr9 = gastritis duodenitis
. // nb: icdx4nr7 = myocad infarction
. // nb: icdx4nr9 = cerebral artery oclusion w infarction
. // nb: icdx5nr12 = choestitis
. // nb: icdx5nr11 = gastritis duodenitis
.
.
.
. set more off

. stcox Irpenskiy Kyivskiy ///
>       age mar2w1 ///
>        occ5w1  occ4w2 occ5w2  ///
>      deaw1 cataw1 ///
>       icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///    //  peripheralvascular1w1-rheumatologic1w1
>                           injothr   ///
>                       contw2   ///
>                        WHPer BSIoc BSIanx HP2work neiw1 toxic  ///
>                         if gender==2, iterate(20) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Cox regression -- Breslow method for ties

No. of subjects =          186                     Number of obs   =       186
No. of failures =          182
Time at risk    =         2360
                                                   LR chi2(22)     =    114.66
Log likelihood  =   -740.69403                     Prob > chi2     =    0.0000

-------------+----------------------------------------------------------------
           _t | Haz. Ratio    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .2099189    .1186485     -2.76    0.006      .0693335     .6355651
    Kyivskiy |    .5906375    .1095523     -2.84    0.005      .4106189     .8495776
         age |    1.015977    .0080361      2.00    0.045      1.000348      1.03185
      mar2w1 |    8.298633    5.156921      3.41    0.001      2.455017     28.05166
      occ5w1 |    .0190842    .0226223     -3.34    0.001      .0018692     .1948417
      occ4w2 |    .4124851    .1618752     -2.26    0.024      .1911453      .890129
      occ5w2 |    34.66535    37.33761      3.29    0.001      4.198336     286.2292
       deaw1 |    1.675044    .2579252      3.35    0.001      1.238674     2.265141
      cataw1 |     2.79702    .7162107      4.02    0.000      1.693304     4.620149
    icdx3nr9 |    40.87909    66.55461      2.28    0.023      1.681409      993.869
    icdx4nr7 |    45.64662    55.05932      3.17    0.002      4.292225     485.4392
    icdx4nr9 |     75.4339    92.86335      3.51    0.000      6.756003     842.2544
    icdx5nr2 |    174.8943    273.7982      3.30    0.001      8.132303     3761.297
   icdx5nr11 |    .0492925    .0526093     -2.82    0.005      .0060856     .3992617
     injothr |    1.620654    .4500906      1.74    0.082      .9403578     2.793105
      contw2 |    2.072071    .3741065      4.04    0.000      1.454529     2.951797
       WHPer |    .9861731    .0053288     -2.58    0.010       .975784     .9966729
       BSIoc |    1.100168    .0274174      3.83    0.000      1.047722      1.15524
      BSIanx |    1.084312    .0293758      2.99    0.003      1.028239     1.143444
     HP2work |    .6461041    .1270554     -2.22    0.026      .4394556     .9499265
       neiw1 |    1.004753    .0024777      1.92    0.054      .9999087     1.009621
       toxic |    .9936079    .0026478     -2.41    0.016      .9884318     .9988111
-------------+----------------------------------------------------------------

.
. estat phtest   //  Proportional hazards assumption met

      Test of proportional-hazards assumption

      Time:  Time
      ------------+---------------------------------------------------
                  |                      chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      global test |                      9.83       22         0.9878
      ------------+---------------------------------------------------

. estat concordance   // good fit

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

  Harrell's C concordance statistic

  Number of subjects (N)              =      186
  Number of comparison pairs (P)      =    15940
  Number of orderings as expected (E)  =    12091
  Number of tied predictions (T)      =        0

          Harrell's C = (E + T/2) / P  =    .7585
                            Somers' D  =    .5171

.
.
.
. cap drop f12r2pf

. matrix define f12fbhdbf = e(b)'

. matrix define f12fhbdvf = e(V)

. local modtype12 FullModel

. cap gen f12r2pf = e(r2_p)

. di f12r2pf
.07184192

. cap gen f12llf= e(ll)

. cap gen f12dff = e(rank)

. di f12r2pf
.07184192

.
.
. // for later model comparison
. cap drop sc3

. gen sc3 = -2*e(ll) + ln(e(N))*e(df_m)

. scalar sc3 = sc3

.  di sc3
1596.3545

. cap drop staic3

. gen staic3 = -2*e(ll) + 2*e(df_m)

. scalar staic3 = staic3

. di "Staic = ", staic3
Staic =  1525.3881

.
.
.
. matrix define FemaleModelCf =  (staic3, sc3)

. matrix rownames FemaleModelCf = stcox

. matrix colnames FemaleModelCf = aic sc

. matlist FemaleModelCf

   | aic    sc
-------------+----------------------
stcox   |  1525.388     1596.354

.
. // testing peripheralvascular1w1-rheumatologic1w1
. set more off

. xi: stpm2 Irpenskiy Kyivskiy ///
>       i.agegrp3 mar2w1 ///
>        occ5w1  occ4w2 occ5w2  ///
>      deaw1 cataw1 ///
>       icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///
>                           injothr   ///
>                       contw2   ///
>                        WHPer BSIoc BSIanx HP2work neiw1 toxic  ///
>                         if gender==2, iterate(10) nolog df(3) scale(odds)
i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

Log likelihood = -128.38412                       Number of obs   =        186

-------------+----------------------------------------------------------------
             |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
xb           |
   Irpenskiy |   -2.003913    1.239839     -1.62    0.106     -4.433953     .4261262
    Kyivskiy |    -.533547    .3070309     -1.74    0.082     -1.135316     .0682224
 _Iagegrp3_2 |    .4589715    .3549067      1.29    0.196     -.2366329     1.154576
 _Iagegrp3_3 |    .9305772    .3935028      2.36    0.018      .1593259     1.701829
      mar2w1 |    3.070223    .9096738      3.38    0.001      1.287295     4.853151
      occ5w1 |   -4.198285    1.706058     -2.46    0.014     -7.542097     -.854473
      occ4w2 |   -1.867703    .6295258     -2.97    0.003     -3.101551    -.6338551
      occ5w2 |    3.393727    1.511015      2.25    0.025      .4321922     6.355262
       deaw1 |    1.063931    .2962325      3.59    0.000      .4833264     1.644536
      cataw1 |    1.540537    .4084936      3.77    0.000      .7399041     2.341169
    icdx3nr9 |    4.183171    2.355111      1.78    0.076     -.4327612     8.799102
    icdx4nr7 |     8.13443    2.082022      3.91    0.000      4.053742     12.21512
    icdx4nr9 |    10.02645    2.109779      4.75    0.000      5.891356     14.16154
    icdx5nr2 |    6.331484    2.233066      2.84    0.005      1.954755     10.70821
   icdx5nr11 |   -5.519614    1.552021     -3.56    0.000     -8.561519    -2.477709
     injothr |    .9313346    .4814595      1.93    0.053     -.0123088     1.874978
      contw2 |    .9677563    .3312947      2.92    0.003      .3184306     1.617082
       WHPer |   -.0214282    .0089519     -2.39    0.017     -.0389735    -.0038828
       BSIoc |    .1386611    .0410627      3.38    0.001      .0581796     .2191425
      BSIanx |     .132589    .0439182      3.02    0.003       .046511     .2186671
     HP2work |   -.6917033    .3231946     -2.14    0.032     -1.325153    -.0582536
       neiw1 |    .0130005    .0042891      3.03    0.002       .004594     .0214069
       toxic |   -.0085278    .0042887     -1.99    0.047     -.0169335    -.0001222
       _rcs1 |    2.707832    .1947467     13.90    0.000      2.326135     3.089528
       _rcs2 |    .1603968    .1970379      0.81    0.416     -.2257905      .546584
       _rcs3 |   -.2579362    .0908932     -2.84    0.005     -.4360836    -.0797887
       _cons |   -5.626732    .8679382     -6.48    0.000      -7.32786    -3.925604
-------------+----------------------------------------------------------------

.
. cap drop sc4

. gen sc4 = -2*e(ll) + ln(e(N))*e(rank)

. scalar sc4 = sc4

. cap drop staic4

. gen staic4= -2*e(ll) + e(rank)*2

. scalar staic4=staic4

.
. matrix define FemaleModelCf =  (staic3, sc3 \ staic4, sc4)

. matrix rownames FemaleModelCf = stcox stpm2

. matrix colnames FemaleModelCf = aic sc

. matlist FemaleModelCf

   | aic    sc
-------------+----------------------
stcox   |  1525.388     1596.354
stpm2   |  310.7682     397.8634

.
.
. ****** omnibus R^2 and adj R^2 *************************************
. **** with cluster robust variance estimates
.
.
.
. set more off

. str2ph stcox Irpenskiy Kyivskiy ///
>       age mar2w1 ///
>        occ5w1  occ4w2 occ5w2  ///
>      deaw1 cataw1 ///
>       icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///
>                          injothr   ///
>                       contw2   ///
>                        WHPer BSIoc BSIanx HP2work toxic neiw1 ///
>                         if gender==2,  adjust vce(cluster id)

R^2 (explained variation): Cox model

   Obs    Events   Adj. R^2    Boot. SE   95% conf. interval
------------------------------------------------------------
 11328      182    0.287535           .          .         .
------------------------------------------------------------

.
.
.
. set more off

. str2ph stcox Irpenskiy Kyivskiy ///
>       age mar2w1 ///
>        occ5w1  occ4w2 occ5w2  ///
>      deaw1 cataw1 ///
>       icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///
>                          injothr   ///
>                       contw2   ///
>                        WHPer BSIoc BSIanx HP2work toxic neiw1 ///
>                         if gender==2,  vce(cluster id)

R^2 (explained variation): Cox model

   Obs    Events     R^2       Boot. SE   95% conf. interval
------------------------------------------------------------
 11328      182    0.347916           .          .         .
------------------------------------------------------------

.
.
.
.
. **********  Accelerated Failture time models *********
. * for males
. set more off

. *******   parametric model selection through model comparison  *******
. * nb: gamma distribution model for males does not converge
. // cardiovascular1w1   same as the icdx3nr6
.
. foreach model in exponential weibull lognormal loglogistic  {
  2. set more off
  3. title(AFT male full `x' model in the accelerated failure time metric)
  4. xi:streg Korostenskiy ///
>      Narodichevskiy ///
>    Radomischevskiy Tarascheskiy Zhitomirskiy ///
>    i.agegrp3  mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>        suprtw1  suchrw1 ///
>          mhlthw2  mhlthw3  ///
>                       icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3   ///
>                 trgovw1 if gender==1,  dist(`model') iterate(20) time nolog
  5.
.       estimates store m`model'
  6.
. capture confirm variable `x'sc
  7. if _rc !=0 {
  8.  cap gen  `x'sc = -2*e(ll) + ln(e(N))*e(rank)
  9.  }
 10.  scalar `x'sc = `x'sc
 11.  di "`x'sc = ",`x'sc
 12.
.
.
.
.  }


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                                male                                 *****
*****                                full                                 *****
*****                               model                                 *****
*****                                 in                                  *****
*****                                the                                  *****
*****                            accelerated                              *****
*****                              failure                                *****
*****                                time                                 *****
*****                              metric)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:41:59  *****
*******************************************************************************
*******************************************************************************


i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Exponential regression -- accelerated failure-time form

No. of subjects =          138                     Number of obs   =       138
No. of failures =          136
Time at risk    =         1871
                                                   LR chi2(27)     =     31.81
Log likelihood  =   -153.83859                     Prob > chi2     =    0.2392

--------------+----------------------------------------------------------------
            _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
 Korostenskiy |   -3.126664    1.144677     -2.73    0.006     -5.370189    -.8831391
Narodichevs~y |   -1.020736     1.21799     -0.84    0.402     -3.407953     1.366482
Radomischev~y |   -.6440688    1.115611     -0.58    0.564     -2.830626     1.542489
 Tarascheskiy |    1.126544    1.085236      1.04    0.299      -1.00048     3.253567
 Zhitomirskiy |    -.312691    .3288932     -0.95    0.342     -.9573099     .3319278
  _Iagegrp3_2 |   -.3671912    .2559358     -1.43    0.151     -.8688161     .1344337
  _Iagegrp3_3 |   -.4885908    .3091235     -1.58    0.114     -1.094462     .1172802
       mar5w1 |    .3886664    .6291565      0.62    0.537     -.8444576      1.62179
       occ5w3 |    .7076284     .430454      1.64    0.100     -.1360459     1.551303
       dvcew2 |   -.7085278    .6252077     -1.13    0.257     -1.933912     .5168567
       cataw3 |    2.558639    1.189535      2.15    0.031      .2271939     4.890083
      shfamw1 |    .0045567    .0036945      1.23    0.217     -.0026844     .0117978
     shrelaw1 |   -.0071965    .0041532     -1.73    0.083     -.0153367     .0009436
      shjobw2 |   -.0048433    .0038957     -1.24    0.214     -.0124787      .002792
       shhlw2 |    .0053248    .0040791      1.31    0.192     -.0026702     .0133198
     shhousw3 |    .0055676    .0037322      1.49    0.136     -.0017474     .0128826
      suprtw1 |   -.0090962     .016891     -0.54    0.590     -.0422019     .0240096
      suchrw1 |    .0098111     .014513      0.68    0.499     -.0186338      .038256
      mhlthw2 |    .0112286    .0064411      1.74    0.081     -.0013957     .0238529
      mhlthw3 |   -.0088011    .0058203     -1.51    0.130     -.0202086     .0026064
     icdx3nr6 |    2.638605    1.513437      1.74    0.081     -.3276774     5.604887
      ncontw1 |   -.3105127    .2400856     -1.29    0.196     -.7810719     .1600464
       MiPTSD |   -.0257186    .0097177     -2.65    0.008     -.0447649    -.0066723
       defnw1 |    .0049462    .0045234      1.09    0.274     -.0039196      .013812
       defnw2 |    .0033101    .0033065      1.00    0.317     -.0031705     .0097907
      efradw3 |    -.006939     .003634     -1.91    0.056     -.0140616     .0001835
      trgovw1 |   -.0064816    .0029913     -2.17    0.030     -.0123444    -.0006187
        _cons |    4.212028    .9456825      4.45    0.000      2.358524     6.065531
--------------+----------------------------------------------------------------
sc =  445.64029


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                                male                                 *****
*****                                full                                 *****
*****                               model                                 *****
*****                                 in                                  *****
*****                                the                                  *****
*****                            accelerated                              *****
*****                              failure                                *****
*****                                time                                 *****
*****                              metric)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:41:59  *****
*******************************************************************************
*******************************************************************************


i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects =          138                     Number of obs   =       138
No. of failures =          136
Time at risk    =         1871
                                                   LR chi2(27)     =    106.76
Log likelihood  =   -93.481912                     Prob > chi2     =    0.0000

--------------+----------------------------------------------------------------
            _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
 Korostenskiy |   -3.222631    .4625559     -6.97    0.000     -4.129224    -2.316038
Narodichevs~y |   -1.139051    .4937214     -2.31    0.021     -2.106727    -.1713747
Radomischev~y |   -.8834981     .450012     -1.96    0.050     -1.765505    -.0014908
 Tarascheskiy |    .9267874    .4360449      2.13    0.034      .0721551      1.78142
 Zhitomirskiy |   -.3444434    .1296739     -2.66    0.008     -.5985996    -.0902871
  _Iagegrp3_2 |   -.2075432    .1094395     -1.90    0.058     -.4220406     .0069543
  _Iagegrp3_3 |   -.2598133    .1275506     -2.04    0.042     -.5098079    -.0098187
       mar5w1 |    .1848296    .2509861      0.74    0.461      -.307094     .6767533
       occ5w3 |    .6114881    .1778148      3.44    0.001      .2629774     .9599988
       dvcew2 |   -.6733914    .2615678     -2.57    0.010     -1.186055    -.1607279
       cataw3 |     2.19357    .4816916      4.55    0.000      1.249472     3.137669
      shfamw1 |    .0043426    .0015604      2.78    0.005      .0012843     .0074008
     shrelaw1 |   -.0067526    .0017028     -3.97    0.000     -.0100901    -.0034151
      shjobw2 |   -.0035695    .0017095     -2.09    0.037     -.0069201    -.0002188
       shhlw2 |    .0054384    .0017259      3.15    0.002      .0020556     .0088212
     shhousw3 |    .0038411    .0014256      2.69    0.007       .001047     .0066353
      suprtw1 |   -.0070305    .0078008     -0.90    0.367     -.0223197     .0082587
      suchrw1 |    .0110702     .006921      1.60    0.110     -.0024947      .024635
      mhlthw2 |    .0120858    .0024154      5.00    0.000      .0073516     .0168199
      mhlthw3 |   -.0080502    .0022989     -3.50    0.000      -.012556    -.0035444
     icdx3nr6 |    2.517863    .6043694      4.17    0.000      1.333321     3.702406
      ncontw1 |   -.2576819    .0994587     -2.59    0.010     -.4526173    -.0627465
       MiPTSD |   -.0259352    .0040946     -6.33    0.000     -.0339604    -.0179099
       defnw1 |    .0045086    .0018516      2.43    0.015      .0008795     .0081376
       defnw2 |    .0028913    .0013989      2.07    0.039      .0001496      .005633
      efradw3 |   -.0067753    .0015015     -4.51    0.000     -.0097182    -.0038325
      trgovw1 |   -.0058623    .0012673     -4.63    0.000     -.0083462    -.0033784
        _cons |    3.999459    .3812591     10.49    0.000      3.252205     4.746713
--------------+----------------------------------------------------------------
        /ln_p |    .9221928    .0692084     13.32    0.000      .7865468     1.057839
--------------+----------------------------------------------------------------
             p |   2.514799    .1740452                    2.195801     2.880139
           1/p |   .3976461    .0275205                    .3472054     .4554147
--------------+----------------------------------------------------------------
sc =  445.64029


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                                male                                 *****
*****                                full                                 *****
*****                               model                                 *****
*****                                 in                                  *****
*****                                the                                  *****
*****                            accelerated                              *****
*****                              failure                                *****
*****                                time                                 *****
*****                              metric)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:41:59  *****
*******************************************************************************
*******************************************************************************


i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Lognormal regression -- accelerated failure-time form

No. of subjects =          138                     Number of obs   =       138
No. of failures =          136
Time at risk    =         1871
                                                   LR chi2(27)     =     93.08
Log likelihood  =   -103.69758                     Prob > chi2     =    0.0000

--------------+----------------------------------------------------------------
            _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
 Korostenskiy |   -2.850179    .5822249     -4.90    0.000     -3.991319    -1.709039
Narodichevs~y |   -.9863068    .6241906     -1.58    0.114     -2.209698     .2370844
Radomischev~y |   -.4351639    .5678478     -0.77    0.443     -1.548125     .6777973
 Tarascheskiy |    1.352245    .5538933      2.44    0.015      .2666342     2.437856
 Zhitomirskiy |    -.252227    .1739829     -1.45    0.147     -.5932272     .0887732
  _Iagegrp3_2 |   -.4918749    .1268108     -3.88    0.000     -.7404195    -.2433303
  _Iagegrp3_3 |   -.6259661    .1558823     -4.02    0.000     -.9314898    -.3204423
       mar5w1 |    .5584147    .3257337      1.71    0.086     -.0800117     1.196841
       occ5w3 |    .8300744    .2179709      3.81    0.000      .4028591      1.25729
       dvcew2 |     -.63435    .3182293     -1.99    0.046     -1.258068     -.010632
       cataw3 |    2.655854    .6019215      4.41    0.000       1.47611     3.835599
      shfamw1 |    .0050793    .0018635      2.73    0.006      .0014268     .0087317
     shrelaw1 |   -.0075585    .0021116     -3.58    0.000     -.0116972    -.0034199
      shjobw2 |   -.0059802    .0019186     -3.12    0.002     -.0097405    -.0022199
       shhlw2 |    .0048877    .0020277      2.41    0.016      .0009134      .008862
     shhousw3 |    .0063047     .001984      3.18    0.001      .0024161     .0101932
      suprtw1 |   -.0095203    .0081982     -1.16    0.246     -.0255884     .0065478
      suchrw1 |     .007587    .0066435      1.14    0.253      -.005434     .0206081
      mhlthw2 |    .0095502    .0033936      2.81    0.005       .002899     .0162015
      mhlthw3 |   -.0087005    .0030645     -2.84    0.005     -.0147068    -.0026942
     icdx3nr6 |    2.609115    .7737263      3.37    0.001      1.092639      4.12559
      ncontw1 |   -.3061668    .1206177     -2.54    0.011     -.5425732    -.0697605
       MiPTSD |   -.0219041    .0048998     -4.47    0.000     -.0315076    -.0123006
       defnw1 |    .0056708     .002343      2.42    0.016      .0010787      .010263
       defnw2 |    .0031027    .0016656      1.86    0.062     -.0001617     .0063671
      efradw3 |   -.0072286    .0018641     -3.88    0.000     -.0108822     -.003575
      trgovw1 |   -.0063668    .0015018     -4.24    0.000     -.0093104    -.0034232
        _cons |    4.129085      .48731      8.47    0.000      3.173975     5.084196
--------------+----------------------------------------------------------------
      /ln_sig |   -.6706387    .0607709    -11.04    0.000     -.7897475    -.5515299
--------------+----------------------------------------------------------------
         sigma |   .5113818    .0310771                    .4539594     .5760678
--------------+----------------------------------------------------------------
sc =  445.64029


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                                male                                 *****
*****                                full                                 *****
*****                               model                                 *****
*****                                 in                                  *****
*****                                the                                  *****
*****                            accelerated                              *****
*****                              failure                                *****
*****                                time                                 *****
*****                              metric)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:42:00  *****
*******************************************************************************
*******************************************************************************


i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Loglogistic regression -- accelerated failure-time form

No. of subjects =          138                     Number of obs   =       138
No. of failures =          136
Time at risk    =         1871
                                                   LR chi2(27)     =    112.15
Log likelihood  =   -95.854648                     Prob > chi2     =    0.0000

--------------+----------------------------------------------------------------
            _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
 Korostenskiy |   -2.893592    .4495557     -6.44    0.000     -3.774705    -2.012479
Narodichevs~y |    -1.04849    .4829686     -2.17    0.030     -1.995091    -.1018893
Radomischev~y |   -.4987425     .435792     -1.14    0.252     -1.352879     .3553941
 Tarascheskiy |    1.218869    .4262581      2.86    0.004      .3834189      2.05432
 Zhitomirskiy |   -.2990351    .1587342     -1.88    0.060     -.6101484     .0120782
  _Iagegrp3_2 |   -.4168611    .1132184     -3.68    0.000     -.6387651    -.1949571
  _Iagegrp3_3 |   -.5495865    .1431827     -3.84    0.000     -.8302194    -.2689536
       mar5w1 |    .4970656    .2639146      1.88    0.060     -.0201976     1.014329
       occ5w3 |    .7765487    .1750156      4.44    0.000      .4335244     1.119573
       dvcew2 |   -.5779092    .2627011     -2.20    0.028     -1.092794    -.0630246
       cataw3 |    2.510318    .4695186      5.35    0.000      1.590078     3.430558
      shfamw1 |    .0045036    .0016512      2.73    0.006      .0012672       .00774
     shrelaw1 |   -.0079932    .0019714     -4.05    0.000      -.011857    -.0041293
      shjobw2 |   -.0053134    .0016484     -3.22    0.001     -.0085442    -.0020826
       shhlw2 |    .0047661    .0017387      2.74    0.006      .0013583     .0081739
     shhousw3 |    .0046804    .0019384      2.41    0.016      .0008812     .0084797
      suprtw1 |   -.0110224    .0076483     -1.44    0.150     -.0260127     .0039679
      suchrw1 |    .0099483    .0067379      1.48    0.140     -.0032578     .0231544
      mhlthw2 |    .0100376    .0028001      3.58    0.000      .0045495     .0155256
      mhlthw3 |   -.0089551    .0027105     -3.30    0.001     -.0142676    -.0036426
     icdx3nr6 |    2.582443    .5833382      4.43    0.000      1.439121     3.725765
      ncontw1 |   -.3679682    .1087398     -3.38    0.001     -.5810944     -.154842
       MiPTSD |    -.022985    .0042161     -5.45    0.000     -.0312485    -.0147216
       defnw1 |    .0056021    .0020715      2.70    0.007      .0015421     .0096622
       defnw2 |     .003719    .0014714      2.53    0.011      .0008351     .0066028
      efradw3 |   -.0071355    .0016806     -4.25    0.000     -.0104294    -.0038415
      trgovw1 |   -.0054483    .0013202     -4.13    0.000     -.0080359    -.0028608
        _cons |    4.245024    .4143453     10.25    0.000      3.432922     5.057125
--------------+----------------------------------------------------------------
      /ln_gam |   -1.331356    .0729159    -18.26    0.000     -1.474269    -1.188444
--------------+----------------------------------------------------------------
         gamma |   .2641188    .0192585                     .228946      .304695
--------------+----------------------------------------------------------------
sc =  445.64029

.
.  di "Male model comparison:
Male model comparison:

.  estimates stats _all

-------------+---------------------------------------------------------------
       Model |    Obs    ll(null)   ll(model)     df          AIC         BIC
-------------+---------------------------------------------------------------
ffexponent~l   |   186  -228.1075   -207.3755     18     450.7511    508.8145
ffweibull    |    186   -195.5575   -126.4254     19     290.8509    352.1401
fflognormal   |   186   -202.8786   -141.1965     19      320.393    381.6822
ffloglogis~c   |   186  -200.5616   -132.9925     19     303.9849    365.2741
ffgamma      |    186   -194.9136   -126.3458     20     292.6916    357.2065
ftexponent~l   |   186  -228.1075    -207.336     18      450.672    508.7354
ftweibull    |    186   -195.5575   -126.7005     19      291.401    352.6902
ftlognormal   |   186   -202.8786   -140.8154     19     319.6308      380.92
ftloglogis~c   |   186  -200.5616   -132.7448     19     303.4896    364.7788
ftgamma      |    186   -194.9136   -126.6969     20     293.3939    357.9088
ft           |    186   -195.5575   -126.7005     19      291.401    352.6902
fmodel       |    186   -195.5575   -126.1944     20     292.3887    356.9037
mexponential   |   138  -169.7442   -153.8386     28     363.6772    445.6403
mweibull     |    138   -146.8617   -93.48191     29     244.9638    329.8542
mlognormal   |    138   -150.2378   -103.6976     29     265.3952    350.2855
mloglogistic   |   138  -151.9291   -95.85465     29     249.7093    334.5997
-------------+---------------------------------------------------------------


Note:  N=Obs used in calculating BIC; see [R] BIC note


.
.  scalar exponentialsc = exponentialsc

.  scalar weibullsc = weibullsc

.  scalar lognormalsc = lognormalsc

.  scalar loglogisticsc =  loglogisticsc

.  matrix define SCmodCF = [exponentialsc \ weibullsc \ lognormalsc \ loglogisticsc ]

.  matrix rownames SCmodCF = exponential weibull lognormal loglogistic

.  matrix colnames SCmodCF = sc

.  di "  "


. qui: {
Comparison by Schwartz Criterion
Male models:

. qui {

   | sc
-------------+-----------
exponential   |  445.6403
weibull   |  329.8542
lognormal   |  350.2855
loglogistic   |  334.5996

.  // weibull model for males is optimal   frailty was infintesmal and therefore dropped
.  //  theta = 6.38e-88 and  theta ci were 1.12e-88 and 3.62e-07
.
. ************   Optimal model is the Weibull model for both men and women
.
. // tabular estimates of the risk spectrum for males and females
. forvalues i = 10(10)90  {
  2. set more off
  3. stci, by(agegrp3) p(`i')
  4. }

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

             |    no. of
agegrp3      |  subjects         10%     Std. Err.     [95% Conf. Interval]
-------------+-------------------------------------------------------------
    lower 1/ |        96           6       .249351            6          6
    middle 1 |       130           6      .4349524            4          6
    upper 1/ |       114           4      1.059626            1          5
-------------+-------------------------------------------------------------
       total |       340           6      .2664786            4          6

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

             |    no. of
agegrp3      |  subjects         20%     Std. Err.     [95% Conf. Interval]
-------------+-------------------------------------------------------------
    lower 1/ |        96           7      .4941659            6          8
    middle 1 |       130           6      .1730456            6          6
    upper 1/ |       114           6      .2805863            4          6
-------------+-------------------------------------------------------------
       total |       340           6      .1074687            6          6

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

             |    no. of
agegrp3      |  subjects         30%     Std. Err.     [95% Conf. Interval]
-------------+-------------------------------------------------------------
    lower 1/ |        96           9       1.21106            7         12
    middle 1 |       130           6      .2899682            6          8
    upper 1/ |       114           6      .1523183            6          6
-------------+-------------------------------------------------------------
       total |       340           6      .1794839            6          7

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

             |    no. of
agegrp3      |  subjects         40%     Std. Err.     [95% Conf. Interval]
-------------+-------------------------------------------------------------
    lower 1/ |        96          13      1.620185            9         15
    middle 1 |       130           8      .8964614            6         10
    upper 1/ |       114           6      .1523183            6          7
-------------+-------------------------------------------------------------
       total |       340           8       .621771            7          9

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

             |    no. of
agegrp3      |  subjects         50%     Std. Err.     [95% Conf. Interval]
-------------+-------------------------------------------------------------
    lower 1/ |        96          15      1.223681           12         17
    middle 1 |       130          10      .8135431            9         12
    upper 1/ |       114           7      .3479512            6          9
-------------+-------------------------------------------------------------
       total |       340          10      .7372445            9         12

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

             |    no. of
agegrp3      |  subjects         60%     Std. Err.     [95% Conf. Interval]
-------------+-------------------------------------------------------------
    lower 1/ |        96          17      .9582971           15         19
    middle 1 |       130          12      .8688075           10         15
    upper 1/ |       114           9      1.624325            7         14
-------------+-------------------------------------------------------------
       total |       340          13      .8592411           12         15

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

             |    no. of
agegrp3      |  subjects         70%     Std. Err.     [95% Conf. Interval]
-------------+-------------------------------------------------------------
    lower 1/ |        96          19      .8708234           17         23
    middle 1 |       130          15      1.567482           12         18
    upper 1/ |       114          14      2.442317            9         18
-------------+-------------------------------------------------------------
       total |       340          17      .7262454           15         18

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

             |    no. of
agegrp3      |  subjects         80%     Std. Err.     [95% Conf. Interval]
-------------+-------------------------------------------------------------
    lower 1/ |        96          23      2.082022           19         27
    middle 1 |       130          19      1.216187           16         23
    upper 1/ |       114          19      1.944736           15         23
-------------+-------------------------------------------------------------
       total |       340          20      .8700913           18         22

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

             |    no. of
agegrp3      |  subjects         90%     Std. Err.     [95% Conf. Interval]
-------------+-------------------------------------------------------------
    lower 1/ |        96          28      .6468295           26         29
    middle 1 |       130          25      1.607127           21         28
    upper 1/ |       114          25      1.271747           21         28
-------------+-------------------------------------------------------------
       total |       340          26      .7655588           24         28

.
. // cardiovascular1w1   same as the icdx3nr6
.
. //  we run this cluster robust in the ph metric
.   set more off

. title(AFT male full weibull model with cluster robust standard errors in the ph metric)


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                                male                                 *****
*****                                full                                 *****
*****                              weibull                                *****
*****                               model                                 *****
*****                                with                                 *****
*****                              cluster                                *****
*****                               robust                                *****
*****                              standard                               *****
*****                               errors                                *****
*****                                 in                                  *****
*****                                the                                  *****
*****                                 ph                                  *****
*****                              metric)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:43:49  *****
*******************************************************************************
*******************************************************************************


. xi:streg Korostenskiy ///
>      Narodichevskiy ///
>    Radomischevskiy Tarascheskiy Zhitomirskiy ///
>    i.agegrp3  mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>         suchrw1 ///
>          mhlthw2  mhlthw3  ///               icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3   ///
>                trgovw1 if gender==1, dist(weibull) iterate(20) time  vce(cluster id) nolog
i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects      =          138                Number of obs   =       138
No. of failures      =          136
Time at risk         =         1871
                                                   Wald chi2(21)   =   1370.90
Log pseudolikelihood =   -98.502727                Prob > chi2     =    0.0000

(Std. Err. adjusted for 138 clusters in id)
--------------+----------------------------------------------------------------
              |               Robust
            _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
 Korostenskiy |   -.9963829    .3403484     -2.93    0.003     -1.663453    -.3293123
Narodichevs~y |   -1.178417    .2901808     -4.06    0.000     -1.747161    -.6096735
Radomischev~y |   -.9740981     .233309     -4.18    0.000     -1.431375    -.5168209
 Tarascheskiy |    .8260866    .1420935      5.81    0.000      .5475884     1.104585
 Zhitomirskiy |   -.3435472    .1002216     -3.43    0.001      -.539978    -.1471165
  _Iagegrp3_2 |   -.1983284    .1161046     -1.71    0.088     -.4258892     .0292324
  _Iagegrp3_3 |   -.2390946    .1471653     -1.62    0.104     -.5275332      .049344
       mar5w1 |     .201895    .1472174      1.37    0.170     -.0866458     .4904358
       occ5w3 |    .5935331    .1277461      4.65    0.000      .3431553     .8439109
       dvcew2 |     -.63601    .2376757     -2.68    0.007     -1.101846    -.1701743
       cataw3 |    2.087678    .2886899      7.23    0.000      1.521856       2.6535
      shfamw1 |    .0038937    .0013066      2.98    0.003      .0013327     .0064547
     shrelaw1 |   -.0061111    .0017761     -3.44    0.001     -.0095922    -.0026301
      shjobw2 |   -.0034516    .0013993     -2.47    0.014     -.0061941    -.0007091
       shhlw2 |    .0050635    .0014403      3.52    0.000      .0022405     .0078865
     shhousw3 |    .0032641    .0017774      1.84    0.066     -.0002195     .0067478
      suchrw1 |    .0054589    .0037293      1.46    0.143     -.0018503     .0127682
      mhlthw2 |    .0118387    .0018465      6.41    0.000      .0082196     .0154577
      mhlthw3 |   -.0078765    .0020962     -3.76    0.000     -.0119849    -.0037681
      ncontw1 |   -.2505501    .1013987     -2.47    0.013     -.4492879    -.0518124
       MiPTSD |   -.0259255    .0035371     -7.33    0.000     -.0328581    -.0189929
       defnw1 |    .0038642    .0019018      2.03    0.042      .0001369     .0075916
       defnw2 |    .0030625    .0012777      2.40    0.017      .0005582     .0055668
      efradw3 |   -.0063821    .0015391     -4.15    0.000     -.0093987    -.0033655
      trgovw1 |   -.0052938    .0012488     -4.24    0.000     -.0077415    -.0028462
        _cons |    3.999406    .3462472     11.55    0.000      3.320774     4.678038
--------------+----------------------------------------------------------------
        /ln_p |    .8926257    .0763812     11.69    0.000      .7429212      1.04233
--------------+----------------------------------------------------------------
             p |   2.441532    .1864872                    2.102067     2.835817
           1/p |   .4095789    .0312841                     .352632     .4757222
--------------+----------------------------------------------------------------

.
.
.
.  ********** Estimating a male baseline Weibull hazard model *******************
.  set more off

. title(AFT male Basline weibull model with ordinary standard errors)


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                                male                                 *****
*****                              Basline                                *****
*****                              weibull                                *****
*****                               model                                 *****
*****                                with                                 *****
*****                              ordinary                               *****
*****                              standard                               *****
*****                              errors)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:43:49  *****
*******************************************************************************
*******************************************************************************


. xi:streg i.agegrp if gender==1, nohr dist(weibull) iterate(20) time vce(cluster id) nolog
i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects      =          154                Number of obs   =       154
No. of failures      =          152
Time at risk         =         1980
                                                   Wald chi2(2)    =      7.37
Log pseudolikelihood =   -164.55337                Prob > chi2     =    0.0252

(Std. Err. adjusted for 154 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
 _Iagegrp3_2 |   -.2693131    .1127615     -2.39    0.017     -.4903216    -.0483046
 _Iagegrp3_3 |   -.2515251    .1236339     -2.03    0.042      -.493843    -.0092072
       _cons |    2.839837    .0707758     40.12    0.000      2.701119     2.978555
-------------+----------------------------------------------------------------
       /ln_p |    .4940428    .0462585     10.68    0.000      .4033779     .5847077
-------------+----------------------------------------------------------------
            p |   1.638929    .0758143                    1.496872     1.794466
          1/p |   .6101547    .0282248                    .5572687     .6680596
-------------+----------------------------------------------------------------

. predict maleBL_lnmedtime, lntime  // predicting the ln median survival time
(option log median time assumed; predicted median log time)
(21557 missing values generated)

. predict mhazard, hazard
(21557 missing values generated)

. predict mBLsurv, surv
(21557 missing values generated)

. predict mBLcsurv, csurv
(21743 missing values generated)

. label var maleBL_lnmedtime "predicted baseline ln of median survival time"

. summarize maleBL_lnmedtime, detail

        predicted baseline ln of median survival time
-------------------------------------------------------------
      Percentiles      Smallest
 1%     2.346895       2.346895
 5%     2.346895       2.346895
10%     2.346895       2.346895       Obs                 340
25%     2.346895       2.346895       Sum of Wgt.         340

50%     2.364682                      Mean             2.4289
                        Largest       Std. Dev.      .1179025
75%     2.616208       2.616208
90%     2.616208       2.616208       Variance        .013901
95%     2.616208       2.616208       Skewness       .9534831
99%     2.616208       2.616208       Kurtosis       1.928868

. tabstat  maleBL_lnmedtime, stat(median mean )

variable   |       p50      mean
-------------+--------------------
maleBL_lnm~e   |  2.364682    2.4289
-------------+--------------------

.
. // gen h = p * t ^ (p-1) * exp(a)
.
. gen mbh= (1.6809*_t^(.68))*exp(2.828)
(21557 missing values generated)

. label var mbh "male baseline wiebull hazard function"

.
. line mbh mhazard _t, c(l) sort title(Male baseline hazard function vs male predicted hazard) ///
>    subtitle(Weibull model) ytitle(hazard rate)  xtitle(Study time) legend(rows(2))

.  graph save mbh.gph, replace
(file mbh.gph saved)

.  graph export mbh.eps, replace
(file mbh.eps written in EPS format)

.
.
.
.  // cardiovascular1w1   same as the icdx3nr6
.
.  set more off

. title(AFT male full weibull model with ordinary standard errors)


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                                male                                 *****
*****                                full                                 *****
*****                              weibull                                *****
*****                               model                                 *****
*****                                with                                 *****
*****                              ordinary                               *****
*****                              standard                               *****
*****                              errors)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:43:51  *****
*******************************************************************************
*******************************************************************************


. xi:streg Korostenskiy ///
>      Narodichevskiy ///
>    Radomischevskiy Tarascheskiy Zhitomirskiy ///
>    i.agegrp3  mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>         suchrw1 ///
>          mhlthw2  mhlthw3  ///
>              icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3   ///
>                trgovw1 if gender==1, dist(weibull) iterate(20) time vce(cluster id) nolog
i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects      =          138                Number of obs   =       138
No. of failures      =          136
Time at risk         =         1871
                                                   Wald chi2(20)   =   2260.46
Log pseudolikelihood =   -93.898227                Prob > chi2     =    0.0000

(Std. Err. adjusted for 138 clusters in id)
--------------+----------------------------------------------------------------
              |               Robust
            _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
 Korostenskiy |    -3.17356    .2166919    -14.65    0.000     -3.598268    -2.748852
Narodichevs~y |   -1.215731    .2867179     -4.24    0.000     -1.777688    -.6537743
Radomischev~y |   -.9009331     .221497     -4.07    0.000     -1.335059    -.4668069
 Tarascheskiy |    .8409987    .1408393      5.97    0.000      .5649588     1.117039
 Zhitomirskiy |   -.3504347    .1003906     -3.49    0.000     -.5471966    -.1536728
  _Iagegrp3_2 |   -.2071715    .1141079     -1.82    0.069     -.4308188     .0164759
  _Iagegrp3_3 |   -.2513432    .1449232     -1.73    0.083     -.5353874      .032701
       mar5w1 |    .1923914    .1451708      1.33    0.185      -.092138     .4769209
       occ5w3 |    .6114913    .1275284      4.79    0.000      .3615403     .8614423
       dvcew2 |   -.6366733    .2363822     -2.69    0.007     -1.099974    -.1733726
       cataw3 |    2.126682    .2810774      7.57    0.000      1.575781     2.677584
      shfamw1 |     .003844    .0012799      3.00    0.003      .0013353     .0063526
     shrelaw1 |    -.006487    .0017279     -3.75    0.000     -.0098735    -.0031005
      shjobw2 |   -.0034972    .0014052     -2.49    0.013     -.0062514     -.000743
       shhlw2 |    .0054587    .0013906      3.93    0.000      .0027331     .0081842
     shhousw3 |    .0037509    .0016953      2.21    0.027      .0004281     .0070736
      suchrw1 |    .0059198     .003673      1.61    0.107     -.0012792     .0131188
      mhlthw2 |     .012213    .0017879      6.83    0.000      .0087087     .0157173
      mhlthw3 |   -.0083313    .0020259     -4.11    0.000     -.0123021    -.0043605
     icdx3nr6 |    2.474383    .2170497     11.40    0.000      2.048973     2.899792
      ncontw1 |   -.2495329    .1005855     -2.48    0.013      -.446677    -.0523889
       MiPTSD |   -.0266719    .0034345     -7.77    0.000     -.0334034    -.0199404
       defnw1 |    .0043464    .0018357      2.37    0.018      .0007486     .0079443
       defnw2 |    .0029555     .001288      2.29    0.022       .000431     .0054799
      efradw3 |   -.0067045    .0015022     -4.46    0.000     -.0096486    -.0037603
      trgovw1 |   -.0056413    .0011851     -4.76    0.000     -.0079641    -.0033185
        _cons |    4.030417     .337542     11.94    0.000      3.368847     4.691987
--------------+----------------------------------------------------------------
        /ln_p |    .9208884    .0751875     12.25    0.000      .7735237     1.068253
--------------+----------------------------------------------------------------
             p |   2.511521     .188835                     2.16739     2.910291
           1/p |   .3981651     .029937                    .3436082     .4613844
--------------+----------------------------------------------------------------

.
.
.  // cardiovascular1w1   same as the icdx3nr6
.  set more off

. title(AFT male full weibull model with cluster robust standard errors)


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                                male                                 *****
*****                                full                                 *****
*****                              weibull                                *****
*****                               model                                 *****
*****                                with                                 *****
*****                              cluster                                *****
*****                               robust                                *****
*****                              standard                               *****
*****                              errors)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:43:51  *****
*******************************************************************************
*******************************************************************************


. xi:streg Korostenskiy ///
>      Narodichevskiy ///
>    Radomischevskiy Tarascheskiy Zhitomirskiy ///
>    i.agegrp3  mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>         suchrw1 ///
>          mhlthw2  mhlthw3  ///
>              icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3   ///
>                trgovw1 if gender==1, dist(weibull) iterate(20) time vce(cluster id)  nolog
i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects      =          138                Number of obs   =       138
No. of failures      =          136
Time at risk         =         1871
                                                   Wald chi2(20)   =   2260.46
Log pseudolikelihood =   -93.898227                Prob > chi2     =    0.0000

(Std. Err. adjusted for 138 clusters in id)
--------------+----------------------------------------------------------------
              |               Robust
            _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
 Korostenskiy |    -3.17356    .2166919    -14.65    0.000     -3.598268    -2.748852
Narodichevs~y |   -1.215731    .2867179     -4.24    0.000     -1.777688    -.6537743
Radomischev~y |   -.9009331     .221497     -4.07    0.000     -1.335059    -.4668069
 Tarascheskiy |    .8409987    .1408393      5.97    0.000      .5649588     1.117039
 Zhitomirskiy |   -.3504347    .1003906     -3.49    0.000     -.5471966    -.1536728
  _Iagegrp3_2 |   -.2071715    .1141079     -1.82    0.069     -.4308188     .0164759
  _Iagegrp3_3 |   -.2513432    .1449232     -1.73    0.083     -.5353874      .032701
       mar5w1 |    .1923914    .1451708      1.33    0.185      -.092138     .4769209
       occ5w3 |    .6114913    .1275284      4.79    0.000      .3615403     .8614423
       dvcew2 |   -.6366733    .2363822     -2.69    0.007     -1.099974    -.1733726
       cataw3 |    2.126682    .2810774      7.57    0.000      1.575781     2.677584
      shfamw1 |     .003844    .0012799      3.00    0.003      .0013353     .0063526
     shrelaw1 |    -.006487    .0017279     -3.75    0.000     -.0098735    -.0031005
      shjobw2 |   -.0034972    .0014052     -2.49    0.013     -.0062514     -.000743
       shhlw2 |    .0054587    .0013906      3.93    0.000      .0027331     .0081842
     shhousw3 |    .0037509    .0016953      2.21    0.027      .0004281     .0070736
      suchrw1 |    .0059198     .003673      1.61    0.107     -.0012792     .0131188
      mhlthw2 |     .012213    .0017879      6.83    0.000      .0087087     .0157173
      mhlthw3 |   -.0083313    .0020259     -4.11    0.000     -.0123021    -.0043605
     icdx3nr6 |    2.474383    .2170497     11.40    0.000      2.048973     2.899792
      ncontw1 |   -.2495329    .1005855     -2.48    0.013      -.446677    -.0523889
       MiPTSD |   -.0266719    .0034345     -7.77    0.000     -.0334034    -.0199404
       defnw1 |    .0043464    .0018357      2.37    0.018      .0007486     .0079443
       defnw2 |    .0029555     .001288      2.29    0.022       .000431     .0054799
      efradw3 |   -.0067045    .0015022     -4.46    0.000     -.0096486    -.0037603
      trgovw1 |   -.0056413    .0011851     -4.76    0.000     -.0079641    -.0033185
        _cons |    4.030417     .337542     11.94    0.000      3.368847     4.691987
--------------+----------------------------------------------------------------
        /ln_p |    .9208884    .0751875     12.25    0.000      .7735237     1.068253
--------------+----------------------------------------------------------------
             p |   2.511521     .188835                     2.16739     2.910291
           1/p |   .3981651     .029937                    .3436082     .4613844
--------------+----------------------------------------------------------------

.
.
.   cap predict maleFM_medtime, median time

.   // test for equality of ranks of survival functions
.   cap  predict maleFM_lnmedtime, lntime

.   label var maleFM_medtime "male Full model median survival time"

.   label var maleFM_lnmedtime "male full model: ln(median survival time)"

.   tabstat maleBL_lnmedtime maleFM_lnmedtime, stat(median mean)

   stats |  maleBL~e  maleFM..
---------+--------------------
p50   |  2.364682  2.441422
mean   |    2.4289  2.391357
---------+--------------------

.   label var maleBL_lnmedtime "Pred. ln(median survival time)"

.   sts test maleBL_lnmedtime  maleFM_lnmedtime, wilcoxon

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id


Wilcoxon (Breslow) test for equality of survivor functions


                    |   Events         Events        Sum of
maleBL~e, maleFM~e  |  observed       expected        ranks
--------------------+--------------------------------------
2.346895, -.3165197 |         1           0.80          -32
2.346895, -.2300425 |         1           0.80          -32
2.346895, -.0494774 |         1           0.34          166
2.346895, .5472145  |         1           0.03          260
2.346895, 1.278354  |         1           2.11         -211
2.346895, 1.347188  |         1           0.34          166
2.346895, 1.417721  |         1           0.65            5
2.346895, 1.499585  |         1           0.40           89
2.346895, 1.513149  |         1           0.34          166
2.346895, 1.533129  |         1           0.34          166
2.346895, 1.554618  |         0           2.11         -246
2.346895, 1.638972  |         1           0.34          166
2.346895, 1.644998  |         1           0.34          166
2.346895, 1.672789  |         1           0.73          -13
2.346895, 1.675245  |         1           2.82         -241
2.346895, 1.722345  |         1           0.53           44
2.346895, 1.78823   |         1           2.82         -241
2.346895, 1.793242  |         1           0.65            5
2.346895, 1.799352  |         1           0.47           65
2.346895, 1.818606  |         1           0.34          166
2.346895, 1.878533  |         1           0.34          166
2.346895, 1.88095   |         1           0.60           24
2.346895, 1.904655  |         1           0.34          166
2.346895, 1.924642  |         1           0.34          166
2.346895, 1.97552   |         1           0.34          166
2.346895, 1.981098  |         1           1.26         -117
2.346895, 2.012881  |         1           1.09          -97
2.346895, 2.027009  |         1           0.34          166
2.346895, 2.0547    |         1           0.60           24
2.346895, 2.082882  |         1           1.48         -153
2.346895, 2.088801  |         1           1.48         -153
2.346895, 2.095844  |         1           0.34          166
2.346895, 2.110237  |         1           0.73          -13
2.346895, 2.128723  |         1           0.93          -61
2.346895, 2.139643  |         1           0.34          166
2.346895, 2.143149  |         1           1.03          -81
2.346895, 2.154647  |         1           0.80          -32
2.346895, 2.212637  |         1           0.08          235
2.346895, 2.225953  |         1           0.60           24
2.346895, 2.231969  |         1           0.40           89
2.346895, 2.241345  |         1           0.34          166
2.346895, 2.260308  |         1           1.03          -81
2.346895, 2.262435  |         1           0.80          -32
2.346895, 2.302751  |         1           0.07          245
2.346895, 2.342478  |         1           0.34          166
2.346895, 2.349442  |         1           0.47           65
2.346895, 2.357381  |         1           0.02          269
2.346895, 2.379777  |         1           0.73          -13
2.346895, 2.407534  |         1           0.34          166
2.346895, 2.427984  |         1           0.40           89
2.346895, 2.461808  |         1           1.35         -138
2.346895, 2.468148  |         1           0.34          166
2.346895, 2.483814  |         1           0.40           89
2.346895, 2.513468  |         1           0.73          -13
2.346895, 2.514168  |         1           0.53           44
2.346895, 2.516866  |         1           3.37         -258
2.346895, 2.549983  |         1           0.60           24
2.346895, 2.550616  |         1           1.03          -81
2.346895, 2.556105  |         1           0.34          166
2.346895, 2.557366  |         1           1.26         -117
2.346895, 2.578231  |         1           0.40           89
2.346895, 2.627569  |         1           0.73          -13
2.346895, 2.647717  |         1           2.11         -211
2.346895, 2.664866  |         1           0.34          166
2.346895, 2.669089  |         1           2.11         -211
2.346895, 2.686763  |         1           0.34          166
2.346895, 2.688512  |         1           1.74         -183
2.346895, 2.693213  |         1           0.65            5
2.346895, 2.704593  |         1           0.60           24
2.346895, 2.706069  |         1           0.03          260
2.346895, 2.712304  |         1           1.26         -117
2.346895, 2.719682  |         1           0.60           24
2.346895, 2.7299    |         1           1.48         -153
2.346895, 2.732158  |         1           1.26         -117
2.346895, 2.73912   |         1           1.74         -183
2.346895, 2.739912  |         1           0.47           65
2.346895, 2.76183   |         1           0.34          166
2.346895, 2.764125  |         1           1.48         -153
2.346895, 2.783356  |         1           0.73          -13
2.346895, 2.785749  |         1           1.62         -175
2.346895, 2.786195  |         1           1.94         -200
2.346895, 2.789692  |         1           0.65            5
2.346895, 2.803003  |         1           0.53           44
2.346895, 2.814178  |         1           0.34          166
2.346895, 2.832151  |         1           1.26         -117
2.346895, 2.832931  |         1           0.04          254
2.346895, 2.85483   |         1           0.34          166
2.346895, 2.87577   |         1           1.35         -138
2.346895, 2.879646  |         1           1.81         -192
2.346895, 3.007915  |         1           0.34          166
2.346895, 3.023293  |         1           0.73          -13
2.346895, 3.045346  |         1           1.03          -81
2.346895, 3.047262  |         1           1.94         -200
2.346895, 3.062538  |         1           1.26         -117
2.346895, 3.070718  |         0           3.37         -269
2.346895, 3.096562  |         1           0.93          -61
2.346895, 3.114436  |         1           3.37         -258
2.346895, 3.159789  |         1           2.82         -241
2.346895, 3.162497  |         1           0.34          166
2.346895, 3.238328  |         1           0.73          -13
2.346895, 3.261819  |         1           0.93          -61
2.346895, 3.366629  |         1           0.80          -32
2.346895, 3.54306   |         1           1.58         -167
2.364682, -.8649958 |         1           1.03          -81
2.364682, .7737095  |         1           0.93          -61
2.364682, .9526796  |         2           0.09          508
2.364682, 1.318854  |         1           0.02          269
2.364682, 1.332998  |         1           1.94         -200
2.364682, 1.33878   |         1           0.47           65
2.364682, 1.413522  |         1           0.07          245
2.364682, 1.516936  |         1           1.94         -200
2.364682, 1.52021   |         1           0.07          245
2.364682, 1.60286   |         1           0.34          166
2.364682, 1.605948  |         1           0.02          269
2.364682, 1.689884  |         1           0.34          166
2.364682, 1.696707  |         1           0.53           44
2.364682, 1.707674  |         1           0.93          -61
2.364682, 1.748635  |         1           0.34          166
2.364682, 1.767792  |         1           0.34          166
2.364682, 1.788808  |         1           0.07          245
2.364682, 1.832193  |         1           0.40           89
2.364682, 1.853909  |         1           0.34          166
2.364682, 1.878449  |         1           3.37         -258
2.364682, 1.878903  |         1           0.34          166
2.364682, 1.884075  |         1           0.34          166
2.364682, 1.888208  |         1           0.93          -61
2.364682, 1.909088  |         1           0.34          166
2.364682, 1.912025  |         1           0.08          235
2.364682, 1.929941  |         1           0.84          -46
2.364682, 1.947335  |         1           0.34          166
2.364682, 1.960051  |         1           0.34          166
2.364682, 1.974162  |         1           0.47           65
2.364682, 2.007412  |         1           0.02          269
2.364682, 2.018297  |         1           0.34          166
2.364682, 2.021609  |         1           0.07          245
2.364682, 2.03004   |         1           0.60           24
2.364682, 2.063543  |         1           0.34          166
2.364682, 2.092568  |         1           0.47           65
2.364682, 2.126303  |         1           0.34          166
2.364682, 2.138273  |         1           0.53           44
2.364682, 2.151549  |         1           0.40           89
2.364682, 2.156652  |         1           0.60           24
2.364682, 2.162542  |         1           0.34          166
2.364682, 2.168602  |         1           1.35         -138
2.364682, 2.206223  |         1           0.34          166
2.364682, 2.251316  |         1           0.34          166
2.364682, 2.269282  |         1           0.34          166
2.364682, 2.283679  |         1           0.34          166
2.364682, 2.297041  |         1           1.26         -117
2.364682, 2.297258  |         1           0.07          245
2.364682, 2.318014  |         1           0.84          -46
2.364682, 2.326689  |         1           1.94         -200
2.364682, 2.343475  |         1           0.34          166
2.364682, 2.398475  |         1           0.47           65
2.364682, 2.431568  |         1           2.11         -211
2.364682, 2.431786  |         1           1.26         -117
2.364682, 2.440107  |         1           1.09          -97
2.364682, 2.468139  |         1           0.84          -46
2.364682, 2.478641  |         1           0.02          269
2.364682, 2.496458  |         1           0.53           44
2.364682, 2.500629  |         1           1.58         -167
2.364682, 2.523986  |         1           0.34          166
2.364682, 2.587136  |         1           0.34          166
2.364682, 2.703965  |         1           1.09          -97
2.364682, 2.735604  |         1           0.40           89
2.364682, 2.76041   |         1           1.03          -81
2.364682, 2.81568   |         1           0.34          166
2.364682, 2.853591  |         1           0.80          -32
2.364682, 2.854565  |         1           0.34          166
2.364682, 2.856796  |         1           1.26         -117
2.364682, 2.864683  |         1           2.82         -241
2.364682, 2.888398  |         1           0.34          166
2.364682, 2.904648  |         1           0.02          269
2.364682, 2.910735  |         1           2.82         -241
2.364682, 2.924933  |         1           2.82         -241
2.364682, 2.93224   |         1           2.32         -224
2.364682, 2.957353  |         1           3.37         -258
2.364682, 2.96941   |         1           2.32         -224
2.364682, 2.981863  |         1           0.47           65
2.364682, 3.022051  |         1           0.60           24
2.364682, 3.023512  |         1           0.34          166
2.364682, 3.030664  |         1           0.73          -13
2.364682, 3.098693  |         1           1.58         -167
2.364682, 3.111838  |         1           1.74         -183
2.364682, 3.112164  |         1           2.11         -211
2.364682, 3.148213  |         1           1.74         -183
2.364682, 3.155834  |         1           1.58         -167
2.364682, 3.177666  |         1           0.53           44
2.364682, 3.186272  |         1           2.82         -241
2.364682, 3.253457  |         1           0.03          260
2.364682, 3.263315  |         1           1.58         -167
2.364682, 4.537315  |         1           1.48         -153
2.616208, 1.317386  |         1           0.08          235
2.616208, 1.469685  |         1           1.35         -138
2.616208, 1.590163  |         1           0.60           24
2.616208, 1.676917  |         1           1.26         -117
2.616208, 1.835369  |         1           0.93          -61
2.616208, 1.911285  |         1           0.34          166
2.616208, 1.994758  |         1           0.34          166
2.616208, 2.005323  |         1           0.34          166
2.616208, 2.029274  |         1           0.40           89
2.616208, 2.035896  |         1           0.40           89
2.616208, 2.037598  |         1           0.47           65
2.616208, 2.055703  |         1           0.84          -46
2.616208, 2.147811  |         1           0.65            5
2.616208, 2.194039  |         1           0.93          -61
2.616208, 2.202769  |         1           0.34          166
2.616208, 2.233275  |         1           0.34          166
2.616208, 2.256885  |         1           0.53           44
2.616208, 2.271001  |         1           0.84          -46
2.616208, 2.274907  |         1           0.40           89
2.616208, 2.276052  |         1           0.47           65
2.616208, 2.282331  |         1           0.34          166
2.616208, 2.311877  |         1           2.82         -241
2.616208, 2.320136  |         1           0.34          166
2.616208, 2.320328  |         1           1.03          -81
2.616208, 2.320911  |         1           0.34          166
2.616208, 2.338825  |         1           0.80          -32
2.616208, 2.346224  |         1           0.73          -13
2.616208, 2.350458  |         1           1.03          -81
2.616208, 2.364892  |         1           0.80          -32
2.616208, 2.371863  |         1           1.03          -81
2.616208, 2.405618  |         1           0.34          166
2.616208, 2.425206  |         1           0.40           89
2.616208, 2.441422  |         1           0.80          -32
2.616208, 2.455262  |         1           1.26         -117
2.616208, 2.471657  |         1           0.60           24
2.616208, 2.49164   |         1           2.32         -224
2.616208, 2.517213  |         1           1.62         -175
2.616208, 2.525311  |         1           0.65            5
2.616208, 2.545291  |         1           0.65            5
2.616208, 2.556425  |         1           1.26         -117
2.616208, 2.58044   |         1           0.34          166
2.616208, 2.615502  |         1           0.53           44
2.616208, 2.619496  |         1           1.48         -153
2.616208, 2.626227  |         1           3.37         -258
2.616208, 2.640244  |         1           1.26         -117
2.616208, 2.64089   |         1           0.08          235
2.616208, 2.648412  |         1           1.09          -97
2.616208, 2.665481  |         1           0.47           65
2.616208, 2.669931  |         1           1.35         -138
2.616208, 2.682285  |         1           1.09          -97
2.616208, 2.682393  |         1           0.34          166
2.616208, 2.733924  |         1           0.34          166
2.616208, 2.741343  |         0           3.37         -269
2.616208, 2.768711  |         1           0.47           65
2.616208, 2.806995  |         1           1.58         -167
2.616208, 2.817242  |         1           0.34          166
2.616208, 2.871457  |         1           1.03          -81
2.616208, 2.873679  |         1           1.74         -183
2.616208, 2.875869  |         1           2.82         -241
2.616208, 2.883758  |         1           0.93          -61
2.616208, 2.888775  |         1           2.82         -241
2.616208, 2.907831  |         1           2.82         -241
2.616208, 2.915648  |         1           3.87         -268
2.616208, 2.947886  |         1           1.09          -97
2.616208, 2.974586  |         1           1.35         -138
2.616208, 3.008804  |         0           3.87         -270
2.616208, 3.020121  |         1           1.81         -192
2.616208, 3.03195   |         1           1.48         -153
2.616208, 3.0375    |         1           1.26         -117
2.616208, 3.040898  |         1           1.81         -192
2.616208, 3.074471  |         1           0.93          -61
2.616208, 3.083829  |         1           2.32         -224
2.616208, 3.106023  |         1           2.11         -211
2.616208, 3.190553  |         1           1.48         -153
2.616208, 3.27879   |         1           2.32         -224
2.616208, 3.366489  |         0           3.37         -269
2.616208, 3.405181  |         1           1.74         -183
2.616208, 3.439961  |         1           0.65            5
2.616208, 3.440683  |         1           1.35         -138
2.616208, 3.450873  |         1           3.37         -258
2.616208, 4.014441  |         1           2.32         -224
2.616208, 4.129042  |         1           0.34          166
--------------------+--------------------------------------
Total               |       270         270.00            0

                         chi2(273) =     818.01
                          Pr>chi2 =     0.0000

.   mlowess maleBL_lnmedtime _t  maleFM_lnmedtime _t , legend(rows(3))

275 observations, R-sq = 0.0710

.   gr save mlowMaleBLlnSurvtime.gph, replace
(file mlowMaleBLlnSurvtime.gph saved)

.   gr export mlowMaleBLlnSurvTime.eps, replace
(file mlowMaleBLlnSurvTime.eps written in EPS format)

.   // cardiovascular1w1   same as the icdx3nr6
.  // Display of Differential hazard and cumulative hazard rates for different age groups
.   set more off

. title(AFT male full weibull model with cluster robust standard errors)


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                                male                                 *****
*****                                full                                 *****
*****                              weibull                                *****
*****                               model                                 *****
*****                                with                                 *****
*****                              cluster                                *****
*****                               robust                                *****
*****                              standard                               *****
*****                              errors)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:10  *****
*******************************************************************************
*******************************************************************************


.  streg Korostenskiy ///
>      Narodichevskiy ///
>    Radomischevskiy Tarascheskiy Zhitomirskiy ///
>     agegrp3  mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>         suchrw1 ///
>          mhlthw2  mhlthw3  ///
>              icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3   ///
>                trgovw1 if gender==1, dist(weibull) iterate(20) time vce(cluster id)  nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects      =          138                Number of obs   =       138
No. of failures      =          136
Time at risk         =         1871
                                                   Wald chi2(19)   =   2255.54
Log pseudolikelihood =   -94.267935                Prob > chi2     =    0.0000

(Std. Err. adjusted for 138 clusters in id)
--------------+----------------------------------------------------------------
              |               Robust
            _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
 Korostenskiy |   -3.137538    .2145801    -14.62    0.000     -3.558107    -2.716969
Narodichevs~y |   -1.193066    .2701538     -4.42    0.000     -1.722558    -.6635748
Radomischev~y |   -.9760222    .1963052     -4.97    0.000     -1.360773     -.591271
 Tarascheskiy |    .8721961    .1375354      6.34    0.000      .6026316     1.141761
 Zhitomirskiy |   -.3569086    .1023683     -3.49    0.000     -.5575469    -.1562703
      agegrp3 |   -.1305388    .0714815     -1.83    0.068       -.27064     .0095624
       mar5w1 |    .1678762    .1312057      1.28    0.201     -.0892822     .4250347
       occ5w3 |    .5787532    .1220592      4.74    0.000      .3395215     .8179848
       dvcew2 |   -.6421208    .2218088     -2.89    0.004     -1.076858    -.2073835
       cataw3 |    2.135494    .2831708      7.54    0.000       1.58049     2.690499
      shfamw1 |    .0036437    .0012237      2.98    0.003      .0012453     .0060421
     shrelaw1 |   -.0065932    .0017508     -3.77    0.000     -.0100247    -.0031617
      shjobw2 |    -.003087    .0013075     -2.36    0.018     -.0056497    -.0005243
       shhlw2 |    .0050334    .0012493      4.03    0.000      .0025848      .007482
     shhousw3 |    .0036757    .0016966      2.17    0.030      .0003505      .007001
      suchrw1 |    .0060646    .0036262      1.67    0.094     -.0010426     .0131719
      mhlthw2 |    .0123026     .001784      6.90    0.000       .008806     .0157992
      mhlthw3 |   -.0081635    .0020172     -4.05    0.000     -.0121172    -.0042098
     icdx3nr6 |    2.461494    .2153663     11.43    0.000      2.039384     2.883604
      ncontw1 |   -.2618633    .0975413     -2.68    0.007     -.4530406    -.0706859
       MiPTSD |   -.0268803    .0033141     -8.11    0.000     -.0333758    -.0203848
       defnw1 |    .0043906    .0018572      2.36    0.018      .0007506     .0080306
       defnw2 |    .0030663    .0012686      2.42    0.016        .00058     .0055527
      efradw3 |   -.0068498    .0014926     -4.59    0.000     -.0097752    -.0039245
      trgovw1 |   -.0052119    .0010898     -4.78    0.000      -.007348    -.0030759
        _cons |    4.146304     .377181     10.99    0.000      3.407043     4.885565
--------------+----------------------------------------------------------------
        /ln_p |    .9200898     .075652     12.16    0.000      .7718147     1.068365
--------------+----------------------------------------------------------------
             p |   2.509516    .1898498                    2.163689     2.910616
           1/p |   .3984833     .030146                    .3435698     .4621736
--------------+----------------------------------------------------------------

.
.  stcurve, hazard at1(agegrp3 = 1) at2(agegrp3 = 2) at3(agegrp3 = 3) subtitle(for ln(time) till depression among males by age group) ///
>     caption(age group 1 is youngest and age group 3 is the oldest)

.  stcurve, cumhaz at1(agegrp3 = 1) at2(agegrp3 = 2) at3(agegrp3 = 3) subtitle(for ln(time) till depression among males by age group) ///
>     caption(age group 1 is youngest and age group 3 is the oldest)

.     gr save cumhazXagegp3.gph, replace
(file cumhazXagegp3.gph saved)

.     gr export cumhazXagegp3.eps, replace
(file cumhazXagegp3.eps written in EPS format)

.
. // Potential heterogeneity by age group  for males
. sts graph if gender==1, hazard by(agegrp3) kernel(gaussian)  subtitle(for male respondents)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

. stpower logrank .2  (.3 .4 .5 .6 .7 .8 .9), n(200 300) colwidth(7)


Estimated power for two-sample comparison of survivor functions


Log-rank test, Freedman method


Ho: S1(t) = S2(t)

  +---------------------------------------------------------------+
  |Power   N   N1   N2   E   S1   S2   HR   Alpha*  |
  +---------------------------------------------------------------+
  |.4227   200   100   100   150   .2   .3   .7481   .05   |
  |.58   300   150   150   225   .2   .3   .7481   .05   |
  |.901   200   100   100   140   .2   .4   .5693   .05   |
  |.9782   300   150   150   210   .2   .4   .5693   .05   |
  |.995   200   100   100   130   .2   .5   .4307   .05   |
  |.9998   300   150   150   195   .2   .5   .4307   .05   |
  |.9999   200   100   100   121   .2   .6   .3174   .05   |
  |1   300   150   150   181   .2   .6   .3174   .05   |
  |1   200   100   100   111   .2   .7   .2216   .05   |
  |1   300   150   150   165   .2   .7   .2216   .05   |
  |1   200   100   100   100   .2   .8   .1386   .05   |
  |1   300   150   150   150   .2   .8   .1386   .05   |
  |1   200   100   100   90   .2   .9   .0655   .05   |
  |1   300   150   150   135   .2   .9   .0655   .05   |
  +---------------------------------------------------------------+
  * two sided

. sts test gender

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id


Log-rank test for equality of survivor functions


          |   Events         Events
gender    |  observed       expected
----------+-------------------------
1. male   |       152         155.75
2. female |       182         178.25
----------+-------------------------
Total     |       334         334.00

                chi2(1) =       0.20
                Pr>chi2 =     0.6550

. sts test agegrp3

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id


Log-rank test for equality of survivor functions


           |   Events         Events
agegrp3    |  observed       expected
-----------+-------------------------
lower 1/3  |        93         120.54
middle 1/3 |       127         120.07
upper 1/3  |       114          93.39
-----------+-------------------------
Total      |       334         334.00

                 chi2(2) =      13.34
                 Pr>chi2 =     0.0013

. sts test gender agegrp3

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id


Log-rank test for equality of survivor functions


                      |   Events         Events
gender, agegrp3       |  observed       expected
----------------------+-------------------------
1. male, lower 1/3    |        50          65.61
1. male, middle 1/3   |        57          50.46
1. male, upper 1/3    |        45          39.68
2. female, lower 1/3  |        43          54.93
2. female, middle 1/3 |        70          69.60
2. female, upper 1/3  |        69          53.71
----------------------+-------------------------
Total                 |       334         334.00

                            chi2(5) =      14.50
                            Pr>chi2 =     0.0127

.
.  // cardiovascular1w1   same as the icdx3nr6
.
. title(AFT male full weibull model with cluster robust standard errors)


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                                male                                 *****
*****                                full                                 *****
*****                              weibull                                *****
*****                               model                                 *****
*****                                with                                 *****
*****                              cluster                                *****
*****                               robust                                *****
*****                              standard                               *****
*****                              errors)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:23  *****
*******************************************************************************
*******************************************************************************


. set more off

. streg Korostenskiy ///
>      Narodichevskiy ///
>    Tarascheskiy Zhitomirskiy ///
>    agegrp3  mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>         suchrw1 ///
>          mhlthw2  mhlthw3  ///
>          icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3  ///
>                trgovw1 if gender==1,  dist(weibull) iterate(20) time  vce(cluster id) nolog

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects      =          138                Number of obs   =       138
No. of failures      =          136
Time at risk         =         1871
                                                   Wald chi2(19)   =    536.38
Log pseudolikelihood =   -95.692423                Prob > chi2     =    0.0000

(Std. Err. adjusted for 138 clusters in id)
--------------+----------------------------------------------------------------
              |               Robust
            _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
--------------+----------------------------------------------------------------
 Korostenskiy |     -3.1865    .2200709    -14.48    0.000     -3.617831    -2.755169
Narodichevs~y |   -1.215181    .2674557     -4.54    0.000     -1.739385    -.6909778
 Tarascheskiy |    .8924025    .1388364      6.43    0.000      .6202882     1.164517
 Zhitomirskiy |   -.3621661    .1043159     -3.47    0.001     -.5666215    -.1577107
      agegrp3 |   -.1331507    .0717268     -1.86    0.063     -.2737327     .0074314
       mar5w1 |    .1605982      .13133      1.22    0.221     -.0968039     .4180003
       occ5w3 |    .5882384    .1204949      4.88    0.000      .3520727      .824404
       dvcew2 |   -.6514966    .2174453     -3.00    0.003     -1.077682    -.2253116
       cataw3 |    2.167814    .2845152      7.62    0.000      1.610175     2.725454
      shfamw1 |    .0038563    .0012317      3.13    0.002      .0014422     .0062703
     shrelaw1 |   -.0070767     .001803     -3.93    0.000     -.0106104    -.0035429
      shjobw2 |   -.0031458    .0013177     -2.39    0.017     -.0057284    -.0005632
       shhlw2 |     .005219    .0012746      4.09    0.000      .0027208     .0077173
     shhousw3 |    .0039994      .00173      2.31    0.021      .0006087     .0073901
      suchrw1 |     .006114    .0036727      1.66    0.096     -.0010844     .0133124
      mhlthw2 |    .0124891     .001814      6.89    0.000      .0089338     .0160444
      mhlthw3 |   -.0082174    .0020297     -4.05    0.000     -.0121955    -.0042394
     icdx3nr6 |    2.529444    .2245522     11.26    0.000      2.089329     2.969558
      ncontw1 |    -.274141    .0979438     -2.80    0.005     -.4661074    -.0821747
       MiPTSD |   -.0273033    .0033761     -8.09    0.000     -.0339204    -.0206863
       defnw1 |    .0049113    .0019223      2.55    0.011      .0011437     .0086789
       defnw2 |    .0027869    .0013158      2.12    0.034      .0002079     .0053658
      efradw3 |   -.0070904    .0015213     -4.66    0.000     -.0100721    -.0041087
      trgovw1 |   -.0054833    .0011176     -4.91    0.000     -.0076738    -.0032929
        _cons |    4.170439    .3775207     11.05    0.000      3.430512     4.910366
--------------+----------------------------------------------------------------
        /ln_p |    .9073294    .0746169     12.16    0.000      .7610829     1.053576
--------------+----------------------------------------------------------------
             p |   2.477697    .1848781                    2.140593     2.867888
           1/p |   .4036007    .0301154                    .3486886     .4671603
--------------+----------------------------------------------------------------

.     predict mhaz, hazard
(21622 missing values generated)

.     predict msurv, surv
(21622 missing values generated)

.
.     cap drop mweibxb

.     cap drop mwxbstdp

.     predict mweibxb, xb
(21622 missing values generated)

.     predict mwxbstdp, stdp
(21624 missing values generated)

. cap drop p5-p95

.
.
. ******************* male Weibull model adjusted R square goodness of fit  *********************
. title(AFT male full weibull model with cluster robust standard errors)


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                                male                                 *****
*****                                full                                 *****
*****                              weibull                                *****
*****                               model                                 *****
*****                                with                                 *****
*****                              cluster                                *****
*****                               robust                                *****
*****                              standard                               *****
*****                              errors)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:24  *****
*******************************************************************************
*******************************************************************************


. set more off

. str2ph streg Korostenskiy ///
>      Narodichevskiy ///
>    Tarascheskiy Zhitomirskiy ///
>    age  mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>         suchrw1 ///
>          mhlthw2  mhlthw3  ///
>          icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3  ///
>                trgovw1 if gender==1,  dist(weibull) iterate(20) time  vce(cluster id) nolog adjust

R^2 (explained variation): Weibull regression

   Obs    Events   Adj. R^2    Boot. SE   95% conf. interval
------------------------------------------------------------
  9514      136    0.322527           .          .         .
------------------------------------------------------------

.
. title(AFT male full weibull model with cluster robust standard errors)


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                                male                                 *****
*****                                full                                 *****
*****                              weibull                                *****
*****                               model                                 *****
*****                                with                                 *****
*****                              cluster                                *****
*****                               robust                                *****
*****                              standard                               *****
*****                              errors)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:25  *****
*******************************************************************************
*******************************************************************************


. set more off

. str2ph streg Korostenskiy ///
>      Narodichevskiy ///
>    Tarascheskiy Zhitomirskiy ///
>    age  mar5w1  occ5w3 ///
>       dvcew2   cataw3 ///
>         shfamw1  shrelaw1 ///
>     shjobw2  shhlw2   ///
>        shhousw3  ///
>         suchrw1 ///
>          mhlthw2  mhlthw3  ///
>          icdx3nr6 ///
>          ncontw1  ///
>              MiPTSD ///
>                defnw1 defnw2  efradw3  ///
>                trgovw1 if gender==1,  dist(weibull) iterate(20) time  vce(cluster id) nolog

R^2 (explained variation): Weibull regression

   Obs    Events     R^2       Boot. SE   95% conf. interval
------------------------------------------------------------
  9514      136    0.406629           .          .         .
------------------------------------------------------------

.  *******************************************************************
.  ******  * for females    frailty was not significant
.  *****
. streg Irpenskiy Kyivskiy ///
>       age mar2w1 ///
>        occ5w1  occ4w2 occ5w2  ///
>      deaw1 cataw1 ///
>      phlthw3 ///
>       icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///    //  peripheralvascular1w1-rheumatologic1w1
>                           injothr   ///
>                       contw2   ///
>                        WHPer BSIoc BSIanx HP2work neiw1 toxic  ///
>                         if gender==2, iterate(20) dist(weibull) time nolog vce(cluster id)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =  40245.66
Log pseudolikelihood =   -126.40876                Prob > chi2     =    0.0000

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5764465     .220558      2.61    0.009      .1441608     1.008732
    Kyivskiy |    .2204954    .0742878      2.97    0.003      .0748939     .3660969
         age |   -.0073942    .0029024     -2.55    0.011     -.0130828    -.0017055
      mar2w1 |    -1.06727    .0966097    -11.05    0.000     -1.256621    -.8779184
      occ5w1 |    1.476405    .1802517      8.19    0.000      1.123118     1.829692
      occ4w2 |    .3381476    .1000749      3.38    0.001      .1420044     .5342909
      occ5w2 |   -1.356096    .1166729    -11.62    0.000     -1.584771    -1.127421
       deaw1 |   -.1956933    .0741354     -2.64    0.008     -.3409961    -.0503906
      cataw1 |   -.4832483    .0809348     -5.97    0.000     -.6418776     -.324619
     phlthw3 |    .0010827    .0020213      0.54    0.592     -.0028791     .0050445
    icdx3nr9 |   -1.512943       .2397     -6.31    0.000     -1.982747     -1.04314
    icdx4nr7 |   -2.293817    .1643597    -13.96    0.000     -2.615956    -1.971678
    icdx4nr9 |   -2.431266    .1697702    -14.32    0.000      -2.76401    -2.098523
    icdx5nr2 |   -2.116805    .1833586    -11.54    0.000     -2.476182    -1.757429
   icdx5nr11 |      1.1913    .0895918     13.30    0.000      1.015703     1.366897
     injothr |   -.1677046    .0955485     -1.76    0.079     -.3549762      .019567
      contw2 |   -.2793225    .0741413     -3.77    0.000     -.4246367    -.1340083
       WHPer |    .0061179     .002199      2.78    0.005      .0018079      .010428
       BSIoc |   -.0380758    .0083571     -4.56    0.000     -.0544555    -.0216962
      BSIanx |   -.0404937    .0102162     -3.96    0.000      -.060517    -.0204703
     HP2work |     .192547    .0793038      2.43    0.015      .0371144     .3479796
       neiw1 |   -.0020187    .0010069     -2.00    0.045     -.0039921    -.0000452
       toxic |    .0027951    .0009481      2.95    0.003      .0009369     .0046534
       _cons |    4.045232    .2967195     13.63    0.000      3.463672     4.626792
-------------+----------------------------------------------------------------
       /ln_p |     .916938    .0586524     15.63    0.000      .8019814     1.031895
-------------+----------------------------------------------------------------
            p |   2.501619     .146726                    2.229955     2.806378
          1/p |   .3997412    .0234458                    .3563312     .4484395
-------------+----------------------------------------------------------------

.
. capture confirm variable weibullfsc

. if rc == 0 {
. replace gammafsc = -2*e(ll) + 2*e(rank)
. }

. else if rc != 0 {
. cap gen gammafsc = -2*e(ll) + 2*e(rank)
. }

.
. replace  weibullfsc = weibullfsc
(0 real changes made)

.
.
.
. est clear

.
. //  Weibull model is optimal for females as well
. foreach model in exponential weibull lognormal loglogistic  gamma {
  2. set more off
  3. title(AFT female full `model' model)
  4.
.
. //  peripheralvascular1w1-rheumatologic1w1
. xi:streg Irpenskiy Kyivskiy ///
>       i.agegrp3 mar2w1 ///
>        occ5w1  occ4w2 occ5w2  ///
>      deaw1 cataw1 ///
>       icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///
>                           injothr   ///
>                       contw2   ///
>                        WHPer BSIoc BSIanx HP2work neiw1 toxic  ///
>                         if gender==2, iterate(20) time dist(`model') nolog vce(cluster id)
  5.
.     est store ff`model'
  6.
.
.
. // ffsc refers to full female schwartz criterion
. capture confirm variable `x'ffsc
  7. if _rc !=0 {
  8. cap gen `x'ffsc = -2*e(ll) + ln(e(N))*e(rank)
  9.  }
 10.  scalar `x'ffsc = `x'ffsc
 11.  di "`x'ffsc = ",`x'ffsc
 12.
.  }


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                                full                                 *****
*****                            exponential                              *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:26  *****
*******************************************************************************
*******************************************************************************


i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Exponential regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =         .
Log pseudolikelihood =   -207.37553                Prob > chi2     =         .

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .6063933    .2890887      2.10    0.036      .0397899     1.172997
    Kyivskiy |    .2261044    .0866855      2.61    0.009      .0562039     .3960048
 _Iagegrp3_2 |   -.0999763     .098673     -1.01    0.311     -.2933718     .0934192
 _Iagegrp3_3 |   -.2659525    .1016604     -2.62    0.009     -.4652032    -.0667017
      mar2w1 |   -.9339912    .0853861    -10.94    0.000     -1.101345    -.7666376
      occ5w1 |    1.407226    .2260048      6.23    0.000      .9642647     1.850187
      occ4w2 |    .3356854    .1501699      2.24    0.025      .0413577      .630013
      occ5w2 |   -1.199717     .140262     -8.55    0.000     -1.474626    -.9248088
       deaw1 |   -.2533119    .0852532     -2.97    0.003      -.420405    -.0862188
      cataw1 |   -.4871219    .0983708     -4.95    0.000     -.6799252    -.2943186
    icdx3nr9 |   -1.324693    .2867307     -4.62    0.000     -1.886675    -.7627107
    icdx4nr7 |   -1.986707    .1868391    -10.63    0.000     -2.352905    -1.620509
    icdx4nr9 |   -2.337503    .1888878    -12.38    0.000     -2.707716    -1.967289
    icdx5nr2 |   -2.109162    .2236943     -9.43    0.000     -2.547595    -1.670729
   icdx5nr11 |    1.361711    .1150116     11.84    0.000      1.136293      1.58713
     injothr |   -.1712366    .1260122     -1.36    0.174     -.4182159     .0757428
      contw2 |   -.3128966    .0898554     -3.48    0.000     -.4890098    -.1367833
       WHPer |    .0057728    .0023756      2.43    0.015      .0011167     .0104289
       BSIoc |   -.0415621    .0095705     -4.34    0.000       -.06032    -.0228043
      BSIanx |   -.0383903    .0102829     -3.73    0.000     -.0585444    -.0182363
     HP2work |    .2171589    .0932041      2.33    0.020      .0344822     .3998356
       neiw1 |   -.0032263    .0011281     -2.86    0.004     -.0054374    -.0010153
       toxic |    .0027328    .0010583      2.58    0.010      .0006586      .004807
       _cons |    3.926527    .1893617     20.74    0.000      3.555385     4.297669
-------------+----------------------------------------------------------------
ffsc =  508.81451


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                                full                                 *****
*****                              weibull                                *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:26  *****
*******************************************************************************
*******************************************************************************


i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =  19187.44
Log pseudolikelihood =   -126.42544                Prob > chi2     =    0.0000

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .6078986     .228386      2.66    0.008      .1602703     1.055527
    Kyivskiy |    .2062128    .0735244      2.80    0.005      .0621077     .3503179
 _Iagegrp3_2 |   -.0343436     .078595     -0.44    0.662     -.1883869     .1196998
 _Iagegrp3_3 |   -.1977944    .0815661     -2.42    0.015      -.357661    -.0379279
      mar2w1 |    -1.07211     .093842    -11.42    0.000     -1.256037    -.8881828
      occ5w1 |    1.467279    .2058956      7.13    0.000      1.063731     1.870827
      occ4w2 |    .3109256    .0960509      3.24    0.001      .1226693     .4991818
      occ5w2 |    -1.31055    .1192567    -10.99    0.000     -1.544289    -1.076811
       deaw1 |   -.1884801    .0747031     -2.52    0.012     -.3348955    -.0420647
      cataw1 |   -.4797996     .080769     -5.94    0.000     -.6381039    -.3214953
    icdx3nr9 |   -1.538708    .2510423     -6.13    0.000     -2.030742    -1.046674
    icdx4nr7 |   -2.253275    .1720059    -13.10    0.000     -2.590401     -1.91615
    icdx4nr9 |    -2.50696    .1552899    -16.14    0.000     -2.811323    -2.202598
    icdx5nr2 |    -2.22353    .2072002    -10.73    0.000     -2.629635    -1.817425
   icdx5nr11 |    1.265117    .0986323     12.83    0.000      1.071801     1.458432
     injothr |   -.1892317    .0915993     -2.07    0.039      -.368763    -.0097004
      contw2 |     -.28725    .0731029     -3.93    0.000     -.4305291    -.1439709
       WHPer |    .0062821    .0020938      3.00    0.003      .0021784     .0103858
       BSIoc |   -.0389541    .0083344     -4.67    0.000     -.0552891     -.022619
      BSIanx |   -.0430619    .0097193     -4.43    0.000     -.0621114    -.0240123
     HP2work |    .1927075    .0789501      2.44    0.015      .0379681     .3474468
       neiw1 |   -.0023066     .000904     -2.55    0.011     -.0040784    -.0005347
       toxic |    .0026883    .0009533      2.82    0.005      .0008199     .0045567
       _cons |    3.916176    .1540935     25.41    0.000      3.614158     4.218194
-------------+----------------------------------------------------------------
       /ln_p |    .9190876     .058543     15.70    0.000      .8043454      1.03383
-------------+----------------------------------------------------------------
            p |   2.507002    .1467673                    2.235233     2.811814
          1/p |   .3988828    .0233518                    .3556424     .4473807
-------------+----------------------------------------------------------------
ffsc =  508.81451


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                                full                                 *****
*****                             lognormal                               *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:27  *****
*******************************************************************************
*******************************************************************************


i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Lognormal regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =         .
Log pseudolikelihood =   -141.19651                Prob > chi2     =         .

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5536012    .3010891      1.84    0.066     -.0365225     1.143725
    Kyivskiy |    .1783711    .0787348      2.27    0.023      .0240537     .3326886
 _Iagegrp3_2 |   -.1560915    .1019425     -1.53    0.126     -.3558952     .0437122
 _Iagegrp3_3 |   -.2882694    .1050208     -2.74    0.006     -.4941065    -.0824324
      mar2w1 |   -.7626973    .1061749     -7.18    0.000     -.9707964    -.5545982
      occ5w1 |    1.267914      .21104      6.01    0.000      .8542827     1.681544
      occ4w2 |    .2366796    .3125831      0.76    0.449     -.3759719     .8493311
      occ5w2 |    -1.00427    .1272917     -7.89    0.000     -1.253758    -.7547831
       deaw1 |    -.313911    .0961901     -3.26    0.001     -.5024401     -.125382
      cataw1 |   -.4593394    .1178108     -3.90    0.000     -.6902444    -.2284344
    icdx3nr9 |   -.9764528     .381256     -2.56    0.010     -1.723701    -.2292047
    icdx4nr7 |   -1.785812    .1995274     -8.95    0.000     -2.176879    -1.394746
    icdx4nr9 |   -2.181425    .1953368    -11.17    0.000     -2.564278    -1.798572
    icdx5nr2 |   -1.871335    .2066196     -9.06    0.000     -2.276302    -1.466369
   icdx5nr11 |    1.419867    .1293305     10.98    0.000      1.166383      1.67335
     injothr |   -.1105136    .1417159     -0.78    0.435     -.3882716     .1672444
      contw2 |   -.2857975     .097962     -2.92    0.004     -.4777996    -.0937954
       WHPer |    .0045102    .0026004      1.73    0.083     -.0005866     .0096069
       BSIoc |   -.0398009    .0115807     -3.44    0.001     -.0624986    -.0171032
      BSIanx |   -.0354988    .0108831     -3.26    0.001     -.0568293    -.0141683
     HP2work |    .2208919    .1011177      2.18    0.029      .0227049      .419079
       neiw1 |   -.0033678    .0012334     -2.73    0.006     -.0057851    -.0009504
       toxic |    .0023507    .0012125      1.94    0.053     -.0000256     .0047271
       _cons |    3.783255     .205026     18.45    0.000      3.381412     4.185099
-------------+----------------------------------------------------------------
     /ln_sig |   -.6644189    .0835988     -7.95    0.000     -.8282696    -.5005682
-------------+----------------------------------------------------------------
        sigma |   .5145725    .0430177                    .4368045     .6061861
-------------+----------------------------------------------------------------
ffsc =  508.81451


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                                full                                 *****
*****                            loglogistic                              *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:28  *****
*******************************************************************************
*******************************************************************************


i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Loglogistic regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =         .
Log pseudolikelihood =   -132.99245                Prob > chi2     =         .

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5097465    .5016027      1.02    0.310     -.4733767      1.49287
    Kyivskiy |    .1374739    .0810921      1.70    0.090     -.0214637     .2964116
 _Iagegrp3_2 |   -.1222271    .1014432     -1.20    0.228     -.3210521     .0765979
 _Iagegrp3_3 |   -.2734251    .1095586     -2.50    0.013     -.4881561    -.0586941
      mar2w1 |   -.8102962     .090732     -8.93    0.000     -.9881276    -.6324647
      occ5w1 |    1.220639    .2464103      4.95    0.000       .737684     1.703595
      occ4w2 |     .455672    .1364615      3.34    0.001      .1882124     .7231316
      occ5w2 |    -.995331    .1482487     -6.71    0.000     -1.285893    -.7047688
       deaw1 |   -.2987283    .1066499     -2.80    0.005     -.5077583    -.0896982
      cataw1 |   -.4212704    .1047434     -4.02    0.000     -.6265636    -.2159771
    icdx3nr9 |   -1.218974    .3019264     -4.04    0.000     -1.810739    -.6272091
    icdx4nr7 |   -1.801523    .2162502     -8.33    0.000     -2.225365     -1.37768
    icdx4nr9 |   -2.264035    .1943692    -11.65    0.000     -2.644992    -1.883078
    icdx5nr2 |   -1.863503    .2303234     -8.09    0.000     -2.314928    -1.412077
   icdx5nr11 |    1.403837    .1238369     11.34    0.000      1.161121     1.646552
     injothr |   -.1969976    .1427894     -1.38    0.168     -.4768596     .0828644
      contw2 |   -.2685677    .1061064     -2.53    0.011     -.4765324    -.0606031
       WHPer |    .0057226    .0026906      2.13    0.033      .0004492      .010996
       BSIoc |   -.0381473    .0109079     -3.50    0.000     -.0595264    -.0167682
      BSIanx |   -.0382679    .0110165     -3.47    0.001       -.05986    -.0166759
     HP2work |    .1891417     .095358      1.98    0.047      .0022434       .37604
       neiw1 |    -.003542    .0011644     -3.04    0.002     -.0058242    -.0012597
       toxic |    .0023885    .0010912      2.19    0.029      .0002497     .0045273
       _cons |    3.853298    .2190145     17.59    0.000      3.424038     4.282559
-------------+----------------------------------------------------------------
     /ln_gam |   -1.297235    .0714338    -18.16    0.000     -1.437243    -1.157228
-------------+----------------------------------------------------------------
        gamma |   .2732863    .0195219                    .2375818     .3143565
-------------+----------------------------------------------------------------
ffsc =  508.81451


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                                full                                 *****
*****                               gamma                                 *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:29  *****
*******************************************************************************
*******************************************************************************


i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Gamma regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =         .
Log pseudolikelihood =   -126.34578                Prob > chi2     =         .

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |     .602413    .2194193      2.75    0.006      .1723591     1.032467
    Kyivskiy |    .2108253    .0769882      2.74    0.006      .0599312     .3617194
 _Iagegrp3_2 |   -.0257046     .086986     -0.30    0.768      -.196194     .1447848
 _Iagegrp3_3 |   -.1914504    .0852363     -2.25    0.025     -.3585105    -.0243904
      mar2w1 |   -1.095079    .1402887     -7.81    0.000      -1.37004    -.8201178
      occ5w1 |    1.491081    .2354097      6.33    0.000      1.029686     1.952475
      occ4w2 |    .2978505    .1218316      2.44    0.014      .0590649      .536636
      occ5w2 |   -1.342485    .1924583     -6.98    0.000     -1.719697    -.9652741
       deaw1 |   -.1776974    .0931787     -1.91    0.057     -.3603244     .0049295
      cataw1 |   -.4876404    .0902996     -5.40    0.000     -.6646243    -.3106564
    icdx3nr9 |   -1.576584    .2909792     -5.42    0.000     -2.146893    -1.006275
    icdx4nr7 |   -2.301757    .2993571     -7.69    0.000     -2.888486    -1.715028
    icdx4nr9 |   -2.537909    .2169907    -11.70    0.000     -2.963203    -2.112615
    icdx5nr2 |   -2.262029    .2705668     -8.36    0.000      -2.79233    -1.731728
   icdx5nr11 |    1.249514    .1168434     10.69    0.000      1.020505     1.478523
     injothr |   -.1884412    .0874512     -2.15    0.031     -.3598423      -.01704
      contw2 |   -.2848115    .0719833     -3.96    0.000     -.4258962    -.1437268
       WHPer |    .0063306    .0020475      3.09    0.002      .0023176     .0103436
       BSIoc |   -.0387874    .0082672     -4.69    0.000     -.0549907    -.0225841
      BSIanx |    -.043586    .0101257     -4.30    0.000      -.063432    -.0237399
     HP2work |    .1943255    .0788716      2.46    0.014        .03974     .3489109
       neiw1 |   -.0021868    .0010555     -2.07    0.038     -.0042555     -.000118
       toxic |    .0027033    .0009542      2.83    0.005      .0008332     .0045734
       _cons |    3.920313    .1489452     26.32    0.000      3.628386      4.21224
-------------+----------------------------------------------------------------
     /ln_sig |   -.9498015    .1386829     -6.85    0.000     -1.221615    -.6779881
      /kappa |    1.111717    .4535395      2.45    0.014      .2227961     2.000638
-------------+----------------------------------------------------------------
        sigma |   .3868178     .053645                    .2947538     .5076373
-------------+----------------------------------------------------------------
ffsc =  508.81451

.
. est stats _all

-------------+---------------------------------------------------------------
       Model |    Obs    ll(null)   ll(model)     df          AIC         BIC
-------------+---------------------------------------------------------------
ffexponent~l   |   186  -228.1075   -207.3755     18     450.7511    508.8145
ffweibull    |    186   -195.5575   -126.4254     19     290.8509    352.1401
fflognormal   |   186   -202.8786   -141.1965     19      320.393    381.6822
ffloglogis~c   |   186  -200.5616   -132.9925     19     303.9849    365.2741
ffgamma      |    186   -194.9136   -126.3458     20     292.6916    357.2065
-------------+---------------------------------------------------------------


Note:  N=Obs used in calculating BIC; see [R] BIC note


.
.
.
.  //  peripheralvascular1w1-rheumatologic1w1
.
.
.  foreach model in exponential weibull lognormal loglogistic  gamma {
  2. title(AFT female trimmed `model' model)
  3.
.    set more off
  4. streg Irpenskiy Kyivskiy ///
>       agegrp3 mar2w1 ///
>        occ5w1  occ4w2 occ5w2  ///
>      deaw1 cataw1 ///
>      phlthw3 ///
>       icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///
>                           injothr   ///
>                       contw2   ///
>                WHPer BSIoc BSIanx HP2work neiw1 toxic  ///
>                 if gender==2, iterate(20) dist(`model') nolog vce(cluster id) time
  5.
. est store ft`model'
  6.
.
. // ffsc refers to full female schwartz criterion
. capture confirm variable `x'ftsc
  7. if _rc !=0 {
  8. cap gen `x'ftsc = -2*e(ll) + ln(e(N))*e(rank)
  9.  }
 10.  scalar `x'ftsc = `x'ftsc
 11.  di "`x'ftsc = ",`x'ftsc
 12.
.  }


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                              trimmed                                *****
*****                            exponential                              *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:32  *****
*******************************************************************************
*******************************************************************************


         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Exponential regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =         .
Log pseudolikelihood =   -207.33598                Prob > chi2     =         .

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5832859    .2814413      2.07    0.038      .0316711     1.134901
    Kyivskiy |     .229343    .0861877      2.66    0.008      .0604182     .3982678
     agegrp3 |   -.1353887    .0510609     -2.65    0.008     -.2354663    -.0353112
      mar2w1 |   -.9100993    .0939965     -9.68    0.000     -1.094329    -.7258695
      occ5w1 |    1.442074    .2079539      6.93    0.000      1.034492     1.849656
      occ4w2 |    .3580661    .1524911      2.35    0.019      .0591891     .6569431
      occ5w2 |   -1.248198    .1436739     -8.69    0.000     -1.529793    -.9666021
       deaw1 |   -.2552912    .0848275     -3.01    0.003       -.42155    -.0890324
      cataw1 |   -.4860771    .0985206     -4.93    0.000     -.6791738    -.2929804
     phlthw3 |    .0016924    .0023496      0.72    0.471     -.0029127     .0062975
    icdx3nr9 |    -1.35035    .2862878     -4.72    0.000     -1.911464    -.7892366
    icdx4nr7 |   -2.006098    .1814644    -11.06    0.000     -2.361761    -1.650434
    icdx4nr9 |   -2.325401    .2031371    -11.45    0.000     -2.723543     -1.92726
    icdx5nr2 |   -2.091794    .2159982     -9.68    0.000     -2.515143    -1.668446
   icdx5nr11 |    1.346291    .1173845     11.47    0.000      1.116222     1.576361
     injothr |   -.1597377    .1345927     -1.19    0.235     -.4235346     .1040593
      contw2 |   -.3099806    .0854001     -3.63    0.000     -.4773617    -.1425995
       WHPer |    .0057008    .0024106      2.36    0.018      .0009761     .0104255
       BSIoc |    -.040911    .0092088     -4.44    0.000     -.0589599    -.0228621
      BSIanx |   -.0350864    .0108099     -3.25    0.001     -.0562734    -.0138994
     HP2work |    .2193824    .0918468      2.39    0.017       .039366     .3993989
       neiw1 |   -.0029976    .0012077     -2.48    0.013     -.0053647    -.0006305
       toxic |    .0026445     .001062      2.49    0.013       .000563      .004726
       _cons |    3.905703    .3419464     11.42    0.000      3.235501     4.575906
-------------+----------------------------------------------------------------
ftsc =  508.73538


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                              trimmed                                *****
*****                              weibull                                *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:32  *****
*******************************************************************************
*******************************************************************************


         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =  62570.21
Log pseudolikelihood =   -126.70049                Prob > chi2     =    0.0000

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5729811    .2263521      2.53    0.011      .1293391     1.016623
    Kyivskiy |    .2089498    .0736828      2.84    0.005      .0645341     .3533655
     agegrp3 |   -.1039064    .0415374     -2.50    0.012     -.1853181    -.0224947
      mar2w1 |   -1.049632    .1016999    -10.32    0.000     -1.248961    -.8503043
      occ5w1 |    1.492041    .1876865      7.95    0.000      1.124182       1.8599
      occ4w2 |    .3310965    .0971523      3.41    0.001      .1406815     .5215115
      occ5w2 |   -1.362859    .1189455    -11.46    0.000     -1.595987     -1.12973
       deaw1 |   -.1929352    .0754592     -2.56    0.011     -.3408324    -.0450379
      cataw1 |   -.4840949    .0817057     -5.92    0.000     -.6442353    -.3239546
     phlthw3 |    .0013493    .0020194      0.67    0.504     -.0026087     .0053072
    icdx3nr9 |   -1.539093    .2419448     -6.36    0.000     -2.013296     -1.06489
    icdx4nr7 |   -2.272956    .1665247    -13.65    0.000     -2.599338    -1.946574
    icdx4nr9 |    -2.51101    .1627369    -15.43    0.000     -2.829968    -2.192051
    icdx5nr2 |   -2.183195    .1948359    -11.21    0.000     -2.565067    -1.801324
   icdx5nr11 |    1.242952    .0959207     12.96    0.000      1.054951     1.430954
     injothr |   -.1867559    .0958328     -1.95    0.051     -.3745846     .0010729
      contw2 |   -.2844865    .0734802     -3.87    0.000     -.4285051     -.140468
       WHPer |    .0060213     .002211      2.72    0.006      .0016878     .0103548
       BSIoc |    -.038573    .0083402     -4.62    0.000     -.0549195    -.0222265
      BSIanx |   -.0389161    .0104804     -3.71    0.000     -.0594573    -.0183749
     HP2work |    .1865375    .0786597      2.37    0.018      .0323674     .3407076
       neiw1 |    -.001991    .0010034     -1.98    0.047     -.0039576    -.0000244
       toxic |    .0025757    .0009546      2.70    0.007      .0007046     .0044467
       _cons |    3.908165    .2815976     13.88    0.000      3.356244     4.460086
-------------+----------------------------------------------------------------
       /ln_p |     .914614     .058113     15.74    0.000      .8007146     1.028514
-------------+----------------------------------------------------------------
            p |   2.495812    .1450392                    2.227132     2.796905
          1/p |   .4006712    .0232842                     .357538      .449008
-------------+----------------------------------------------------------------
ftsc =  508.73538


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                              trimmed                                *****
*****                             lognormal                               *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:32  *****
*******************************************************************************
*******************************************************************************


         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Lognormal regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =         .
Log pseudolikelihood =    -140.8154                Prob > chi2     =         .

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5527639    .2881716      1.92    0.055     -.0120421      1.11757
    Kyivskiy |    .1796505    .0788132      2.28    0.023      .0251794     .3341216
     agegrp3 |   -.1439744    .0532833     -2.70    0.007     -.2484077     -.039541
      mar2w1 |   -.7329188    .1093869     -6.70    0.000     -.9473131    -.5185244
      occ5w1 |    1.286033    .1990205      6.46    0.000      .8959602     1.676106
      occ4w2 |    .2574599     .314548      0.82    0.413     -.3590428     .8739626
      occ5w2 |   -1.044503    .1313503     -7.95    0.000     -1.301945    -.7870614
       deaw1 |   -.3145738    .0957852     -3.28    0.001     -.5023093    -.1268384
      cataw1 |   -.4474331    .1133869     -3.95    0.000     -.6696674    -.2251988
     phlthw3 |    .0021891    .0021173      1.03    0.301     -.0019608      .006339
    icdx3nr9 |   -1.023506    .3865674     -2.65    0.008     -1.781164    -.2658481
    icdx4nr7 |   -1.799181    .1996405     -9.01    0.000     -2.190469    -1.407893
    icdx4nr9 |   -2.146324    .2137205    -10.04    0.000     -2.565209     -1.72744
    icdx5nr2 |   -1.852122    .2061189     -8.99    0.000     -2.256108    -1.448137
   icdx5nr11 |    1.410324    .1331171     10.59    0.000       1.14942     1.671229
     injothr |   -.0896041    .1490083     -0.60    0.548      -.381655     .2024469
      contw2 |   -.2748369    .0893021     -3.08    0.002     -.4498657     -.099808
       WHPer |    .0046846    .0026113      1.79    0.073     -.0004334     .0098027
       BSIoc |   -.0378582     .010639     -3.56    0.000     -.0587102    -.0170062
      BSIanx |   -.0334661    .0109118     -3.07    0.002     -.0548529    -.0120793
     HP2work |    .2311068    .0994386      2.32    0.020      .0362107      .426003
       neiw1 |   -.0031977    .0012395     -2.58    0.010     -.0056271    -.0007682
       toxic |    .0022802    .0012147      1.88    0.060     -.0001006     .0046609
       _cons |    3.692119    .3222301     11.46    0.000      3.060559     4.323678
-------------+----------------------------------------------------------------
     /ln_sig |    -.666633    .0837399     -7.96    0.000     -.8307601    -.5025058
-------------+----------------------------------------------------------------
        sigma |   .5134344    .0429949                     .435718     .6050127
-------------+----------------------------------------------------------------
ftsc =  508.73538


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                              trimmed                                *****
*****                            loglogistic                              *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:33  *****
*******************************************************************************
*******************************************************************************


         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Loglogistic regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =         .
Log pseudolikelihood =   -132.74479                Prob > chi2     =         .

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5072655     .493265      1.03    0.304     -.4595162     1.474047
    Kyivskiy |    .1440325     .081249      1.77    0.076     -.0152125     .3032776
     agegrp3 |   -.1358927    .0553974     -2.45    0.014     -.2444697    -.0273156
      mar2w1 |   -.7892855    .0940659     -8.39    0.000     -.9736513    -.6049197
      occ5w1 |    1.260234    .2303259      5.47    0.000      .8088033     1.711664
      occ4w2 |    .4755294    .1354064      3.51    0.000      .2101377      .740921
      occ5w2 |   -1.038693    .1538089     -6.75    0.000     -1.340153    -.7372332
       deaw1 |   -.2968699     .105621     -2.81    0.005     -.5038833    -.0898566
      cataw1 |   -.4166671    .1037667     -4.02    0.000      -.620046    -.2132881
     phlthw3 |    .0016314    .0022524      0.72    0.469     -.0027833      .006046
    icdx3nr9 |    -1.25819     .309944     -4.06    0.000     -1.865669    -.6507105
    icdx4nr7 |   -1.821645    .2143414     -8.50    0.000     -2.241747    -1.401544
    icdx4nr9 |   -2.240592    .2069505    -10.83    0.000     -2.646207    -1.834976
    icdx5nr2 |   -1.861849    .2235019     -8.33    0.000     -2.299904    -1.423793
   icdx5nr11 |       1.391    .1251204     11.12    0.000      1.145768     1.636231
     injothr |   -.1800249    .1488565     -1.21    0.227     -.4717782     .1117284
      contw2 |   -.2686203    .0970747     -2.77    0.006     -.4588832    -.0783574
       WHPer |    .0057668    .0027032      2.13    0.033      .0004685      .011065
       BSIoc |   -.0375091    .0103378     -3.63    0.000     -.0577708    -.0172474
      BSIanx |   -.0356648     .011595     -3.08    0.002     -.0583906    -.0129389
     HP2work |    .1916925    .0915362      2.09    0.036      .0122848     .3711002
       neiw1 |   -.0033625    .0011922     -2.82    0.005     -.0056992    -.0010259
       toxic |     .002309    .0010961      2.11    0.035      .0001607     .0044573
       _cons |    3.829028    .3316047     11.55    0.000      3.179095     4.478961
-------------+----------------------------------------------------------------
     /ln_gam |   -1.297774    .0707992    -18.33    0.000     -1.436537     -1.15901
-------------+----------------------------------------------------------------
        gamma |   .2731392     .019338                    .2377496     .3137968
-------------+----------------------------------------------------------------
ftsc =  508.73538


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                              trimmed                                *****
*****                               gamma                                 *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:34  *****
*******************************************************************************
*******************************************************************************


         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Gamma regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =         .
Log pseudolikelihood =   -126.69693                Prob > chi2     =         .

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5718922    .2256368      2.53    0.011      .1296521     1.014132
    Kyivskiy |    .2098365    .0775423      2.71    0.007      .0578563     .3618167
     agegrp3 |    -.103339    .0436171     -2.37    0.018      -.188827    -.0178511
      mar2w1 |   -1.054287    .1397568     -7.54    0.000     -1.328206    -.7803691
      occ5w1 |    1.495865    .2054461      7.28    0.000      1.093198     1.898532
      occ4w2 |    .3283855    .1207657      2.72    0.007      .0916891     .5650818
      occ5w2 |   -1.369272    .1802037     -7.60    0.000     -1.722465     -1.01608
       deaw1 |   -.1909248    .0902783     -2.11    0.034      -.367867    -.0139825
      cataw1 |   -.4857414    .0902476     -5.38    0.000     -.6626235    -.3088594
     phlthw3 |    .0013352    .0020367      0.66    0.512     -.0026567     .0053271
    icdx3nr9 |   -1.545413    .2631969     -5.87    0.000      -2.06127    -1.029557
    icdx4nr7 |   -2.282414     .269507     -8.47    0.000     -2.810638     -1.75419
    icdx4nr9 |   -2.517634    .2190755    -11.49    0.000     -2.947014    -2.088254
    icdx5nr2 |   -2.189347    .2275572     -9.62    0.000     -2.635351    -1.743343
   icdx5nr11 |    1.239722    .1132052     10.95    0.000      1.017844       1.4616
     injothr |   -.1871711    .0952949     -1.96    0.050     -.3739457    -.0003964
      contw2 |   -.2840288    .0740422     -3.84    0.000     -.4291488    -.1389088
       WHPer |    .0060278    .0022041      2.73    0.006      .0017079     .0103478
       BSIoc |   -.0385312    .0083938     -4.59    0.000     -.0549827    -.0220797
      BSIanx |   -.0390223    .0108085     -3.61    0.000     -.0602066     -.017838
     HP2work |    .1864814    .0783428      2.38    0.017      .0329324     .3400304
       neiw1 |   -.0019638     .001139     -1.72    0.085     -.0041961     .0002686
       toxic |    .0025793    .0009608      2.68    0.007      .0006963     .0044624
       _cons |    3.910182    .2810697     13.91    0.000      3.359296     4.461068
-------------+----------------------------------------------------------------
     /ln_sig |   -.9202315    .1100596     -8.36    0.000     -1.135944    -.7045187
      /kappa |    1.021601    .3739096      2.73    0.006      .2887512      1.75445
-------------+----------------------------------------------------------------
        sigma |   .3984268    .0438507                    .3211187     .4943465
-------------+----------------------------------------------------------------
ftsc =  508.73538

.  est stats _all

-------------+---------------------------------------------------------------
       Model |    Obs    ll(null)   ll(model)     df          AIC         BIC
-------------+---------------------------------------------------------------
ffexponent~l   |   186  -228.1075   -207.3755     18     450.7511    508.8145
ffweibull    |    186   -195.5575   -126.4254     19     290.8509    352.1401
fflognormal   |   186   -202.8786   -141.1965     19      320.393    381.6822
ffloglogis~c   |   186  -200.5616   -132.9925     19     303.9849    365.2741
ffgamma      |    186   -194.9136   -126.3458     20     292.6916    357.2065
ftexponent~l   |   186  -228.1075    -207.336     18      450.672    508.7354
ftweibull    |    186   -195.5575   -126.7005     19      291.401    352.6902
ftlognormal   |   186   -202.8786   -140.8154     19     319.6308      380.92
ftloglogis~c   |   186  -200.5616   -132.7448     19     303.4896    364.7788
ftgamma      |    186   -194.9136   -126.6969     20     293.3939    357.9088
-------------+---------------------------------------------------------------


Note:  N=Obs used in calculating BIC; see [R] BIC note


.
.
. // Whether for the full female model or the trimmed female model  the Weibull model is optimal acc. to the BIC
.
. **********************  Estimating a Female Weibull baseline hazard model*****************'
.    set more off

. xi:streg i.agegrp3 if gender==2, nohr iterate(20) dist(weibull) nolog vce(cluster id) time
i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(2)    =      7.16
Log pseudolikelihood =    -191.8277                Prob > chi2     =    0.0279

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
 _Iagegrp3_2 |   -.1480891    .1037151     -1.43    0.153     -.3513669     .0551888
 _Iagegrp3_3 |   -.3031553    .1133303     -2.67    0.007     -.5252787     -.081032
       _cons |    2.828092    .0792769     35.67    0.000      2.672712     2.983472
-------------+----------------------------------------------------------------
       /ln_p |     .544165    .0472318     11.52    0.000      .4515924     .6367376
-------------+----------------------------------------------------------------
            p |   1.723169    .0813883                    1.570812     1.890304
          1/p |   .5803262    .0274098                    .5290155     .6366136
-------------+----------------------------------------------------------------

. predict fBL_lnmedtime, lntime
(option log median time assumed; predicted median log time)
(21557 missing values generated)

.
. gen fbh = (1.723169* _t^(.723169))*exp(2.828092)
(21557 missing values generated)

.
. label var fbh "female baseline weibull hazard function"

. line fbh _t, c(l) sort ytitle(baseline hazard) title(Female Weibull baseline hazard function)

. graph save fbh.gph, replace
(file fbh.gph saved)

. graph export fbh.eps, replace
(file fbh.eps written in EPS format)

.
.
.
.  //  we opt for the female Weibull model because the SC is more reliable than the AIC
.  //  Therefore, we will use the weibull regression for both genders
.
.   //  peripheralvascular1w1-rheumatologic1w1
.
.    foreach model in exponential gamma lognormal loglogistic weibull {
  2. title(AFT female trimmed `model' model)
  3.
.     set more off
  4.     streg Irpenskiy Kyivskiy ///
>       agegrp3 mar2w1 ///
>        occ5w1  occ4w2 occ5w2  ///
>           deaw1 cataw1 ///
>            phlthw3 ///
>              icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///
>                 injothr   ///
>                    contw2   ///
>                      WHPer BSIoc BSIanx HP2work neiw1 toxic  ///
>                         if gender==2, iterate(20) dist(`model') nolog vce(cluster id) time
  5.  }


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                              trimmed                                *****
*****                            exponential                              *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:38  *****
*******************************************************************************
*******************************************************************************


         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Exponential regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =         .
Log pseudolikelihood =   -207.33598                Prob > chi2     =         .

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5832859    .2814413      2.07    0.038      .0316711     1.134901
    Kyivskiy |     .229343    .0861877      2.66    0.008      .0604182     .3982678
     agegrp3 |   -.1353887    .0510609     -2.65    0.008     -.2354663    -.0353112
      mar2w1 |   -.9100993    .0939965     -9.68    0.000     -1.094329    -.7258695
      occ5w1 |    1.442074    .2079539      6.93    0.000      1.034492     1.849656
      occ4w2 |    .3580661    .1524911      2.35    0.019      .0591891     .6569431
      occ5w2 |   -1.248198    .1436739     -8.69    0.000     -1.529793    -.9666021
       deaw1 |   -.2552912    .0848275     -3.01    0.003       -.42155    -.0890324
      cataw1 |   -.4860771    .0985206     -4.93    0.000     -.6791738    -.2929804
     phlthw3 |    .0016924    .0023496      0.72    0.471     -.0029127     .0062975
    icdx3nr9 |    -1.35035    .2862878     -4.72    0.000     -1.911464    -.7892366
    icdx4nr7 |   -2.006098    .1814644    -11.06    0.000     -2.361761    -1.650434
    icdx4nr9 |   -2.325401    .2031371    -11.45    0.000     -2.723543     -1.92726
    icdx5nr2 |   -2.091794    .2159982     -9.68    0.000     -2.515143    -1.668446
   icdx5nr11 |    1.346291    .1173845     11.47    0.000      1.116222     1.576361
     injothr |   -.1597377    .1345927     -1.19    0.235     -.4235346     .1040593
      contw2 |   -.3099806    .0854001     -3.63    0.000     -.4773617    -.1425995
       WHPer |    .0057008    .0024106      2.36    0.018      .0009761     .0104255
       BSIoc |    -.040911    .0092088     -4.44    0.000     -.0589599    -.0228621
      BSIanx |   -.0350864    .0108099     -3.25    0.001     -.0562734    -.0138994
     HP2work |    .2193824    .0918468      2.39    0.017       .039366     .3993989
       neiw1 |   -.0029976    .0012077     -2.48    0.013     -.0053647    -.0006305
       toxic |    .0026445     .001062      2.49    0.013       .000563      .004726
       _cons |    3.905703    .3419464     11.42    0.000      3.235501     4.575906
-------------+----------------------------------------------------------------


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                              trimmed                                *****
*****                               gamma                                 *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:38  *****
*******************************************************************************
*******************************************************************************


         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Gamma regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =         .
Log pseudolikelihood =   -126.69693                Prob > chi2     =         .

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5718922    .2256368      2.53    0.011      .1296521     1.014132
    Kyivskiy |    .2098365    .0775423      2.71    0.007      .0578563     .3618167
     agegrp3 |    -.103339    .0436171     -2.37    0.018      -.188827    -.0178511
      mar2w1 |   -1.054287    .1397568     -7.54    0.000     -1.328206    -.7803691
      occ5w1 |    1.495865    .2054461      7.28    0.000      1.093198     1.898532
      occ4w2 |    .3283855    .1207657      2.72    0.007      .0916891     .5650818
      occ5w2 |   -1.369272    .1802037     -7.60    0.000     -1.722465     -1.01608
       deaw1 |   -.1909248    .0902783     -2.11    0.034      -.367867    -.0139825
      cataw1 |   -.4857414    .0902476     -5.38    0.000     -.6626235    -.3088594
     phlthw3 |    .0013352    .0020367      0.66    0.512     -.0026567     .0053271
    icdx3nr9 |   -1.545413    .2631969     -5.87    0.000      -2.06127    -1.029557
    icdx4nr7 |   -2.282414     .269507     -8.47    0.000     -2.810638     -1.75419
    icdx4nr9 |   -2.517634    .2190755    -11.49    0.000     -2.947014    -2.088254
    icdx5nr2 |   -2.189347    .2275572     -9.62    0.000     -2.635351    -1.743343
   icdx5nr11 |    1.239722    .1132052     10.95    0.000      1.017844       1.4616
     injothr |   -.1871711    .0952949     -1.96    0.050     -.3739457    -.0003964
      contw2 |   -.2840288    .0740422     -3.84    0.000     -.4291488    -.1389088
       WHPer |    .0060278    .0022041      2.73    0.006      .0017079     .0103478
       BSIoc |   -.0385312    .0083938     -4.59    0.000     -.0549827    -.0220797
      BSIanx |   -.0390223    .0108085     -3.61    0.000     -.0602066     -.017838
     HP2work |    .1864814    .0783428      2.38    0.017      .0329324     .3400304
       neiw1 |   -.0019638     .001139     -1.72    0.085     -.0041961     .0002686
       toxic |    .0025793    .0009608      2.68    0.007      .0006963     .0044624
       _cons |    3.910182    .2810697     13.91    0.000      3.359296     4.461068
-------------+----------------------------------------------------------------
     /ln_sig |   -.9202315    .1100596     -8.36    0.000     -1.135944    -.7045187
      /kappa |    1.021601    .3739096      2.73    0.006      .2887512      1.75445
-------------+----------------------------------------------------------------
        sigma |   .3984268    .0438507                    .3211187     .4943465
-------------+----------------------------------------------------------------


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                              trimmed                                *****
*****                             lognormal                               *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:40  *****
*******************************************************************************
*******************************************************************************


         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Lognormal regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =         .
Log pseudolikelihood =    -140.8154                Prob > chi2     =         .

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5527639    .2881716      1.92    0.055     -.0120421      1.11757
    Kyivskiy |    .1796505    .0788132      2.28    0.023      .0251794     .3341216
     agegrp3 |   -.1439744    .0532833     -2.70    0.007     -.2484077     -.039541
      mar2w1 |   -.7329188    .1093869     -6.70    0.000     -.9473131    -.5185244
      occ5w1 |    1.286033    .1990205      6.46    0.000      .8959602     1.676106
      occ4w2 |    .2574599     .314548      0.82    0.413     -.3590428     .8739626
      occ5w2 |   -1.044503    .1313503     -7.95    0.000     -1.301945    -.7870614
       deaw1 |   -.3145738    .0957852     -3.28    0.001     -.5023093    -.1268384
      cataw1 |   -.4474331    .1133869     -3.95    0.000     -.6696674    -.2251988
     phlthw3 |    .0021891    .0021173      1.03    0.301     -.0019608      .006339
    icdx3nr9 |   -1.023506    .3865674     -2.65    0.008     -1.781164    -.2658481
    icdx4nr7 |   -1.799181    .1996405     -9.01    0.000     -2.190469    -1.407893
    icdx4nr9 |   -2.146324    .2137205    -10.04    0.000     -2.565209     -1.72744
    icdx5nr2 |   -1.852122    .2061189     -8.99    0.000     -2.256108    -1.448137
   icdx5nr11 |    1.410324    .1331171     10.59    0.000       1.14942     1.671229
     injothr |   -.0896041    .1490083     -0.60    0.548      -.381655     .2024469
      contw2 |   -.2748369    .0893021     -3.08    0.002     -.4498657     -.099808
       WHPer |    .0046846    .0026113      1.79    0.073     -.0004334     .0098027
       BSIoc |   -.0378582     .010639     -3.56    0.000     -.0587102    -.0170062
      BSIanx |   -.0334661    .0109118     -3.07    0.002     -.0548529    -.0120793
     HP2work |    .2311068    .0994386      2.32    0.020      .0362107      .426003
       neiw1 |   -.0031977    .0012395     -2.58    0.010     -.0056271    -.0007682
       toxic |    .0022802    .0012147      1.88    0.060     -.0001006     .0046609
       _cons |    3.692119    .3222301     11.46    0.000      3.060559     4.323678
-------------+----------------------------------------------------------------
     /ln_sig |    -.666633    .0837399     -7.96    0.000     -.8307601    -.5025058
-------------+----------------------------------------------------------------
        sigma |   .5134344    .0429949                     .435718     .6050127
-------------+----------------------------------------------------------------


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                              trimmed                                *****
*****                            loglogistic                              *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:41  *****
*******************************************************************************
*******************************************************************************


         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Loglogistic regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =         .
Log pseudolikelihood =   -132.74479                Prob > chi2     =         .

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5072655     .493265      1.03    0.304     -.4595162     1.474047
    Kyivskiy |    .1440325     .081249      1.77    0.076     -.0152125     .3032776
     agegrp3 |   -.1358927    .0553974     -2.45    0.014     -.2444697    -.0273156
      mar2w1 |   -.7892855    .0940659     -8.39    0.000     -.9736513    -.6049197
      occ5w1 |    1.260234    .2303259      5.47    0.000      .8088033     1.711664
      occ4w2 |    .4755294    .1354064      3.51    0.000      .2101377      .740921
      occ5w2 |   -1.038693    .1538089     -6.75    0.000     -1.340153    -.7372332
       deaw1 |   -.2968699     .105621     -2.81    0.005     -.5038833    -.0898566
      cataw1 |   -.4166671    .1037667     -4.02    0.000      -.620046    -.2132881
     phlthw3 |    .0016314    .0022524      0.72    0.469     -.0027833      .006046
    icdx3nr9 |    -1.25819     .309944     -4.06    0.000     -1.865669    -.6507105
    icdx4nr7 |   -1.821645    .2143414     -8.50    0.000     -2.241747    -1.401544
    icdx4nr9 |   -2.240592    .2069505    -10.83    0.000     -2.646207    -1.834976
    icdx5nr2 |   -1.861849    .2235019     -8.33    0.000     -2.299904    -1.423793
   icdx5nr11 |       1.391    .1251204     11.12    0.000      1.145768     1.636231
     injothr |   -.1800249    .1488565     -1.21    0.227     -.4717782     .1117284
      contw2 |   -.2686203    .0970747     -2.77    0.006     -.4588832    -.0783574
       WHPer |    .0057668    .0027032      2.13    0.033      .0004685      .011065
       BSIoc |   -.0375091    .0103378     -3.63    0.000     -.0577708    -.0172474
      BSIanx |   -.0356648     .011595     -3.08    0.002     -.0583906    -.0129389
     HP2work |    .1916925    .0915362      2.09    0.036      .0122848     .3711002
       neiw1 |   -.0033625    .0011922     -2.82    0.005     -.0056992    -.0010259
       toxic |     .002309    .0010961      2.11    0.035      .0001607     .0044573
       _cons |    3.829028    .3316047     11.55    0.000      3.179095     4.478961
-------------+----------------------------------------------------------------
     /ln_gam |   -1.297774    .0707992    -18.33    0.000     -1.436537     -1.15901
-------------+----------------------------------------------------------------
        gamma |   .2731392     .019338                    .2377496     .3137968
-------------+----------------------------------------------------------------


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                              trimmed                                *****
*****                              weibull                                *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:42  *****
*******************************************************************************
*******************************************************************************


         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(17)   =  62570.21
Log pseudolikelihood =   -126.70049                Prob > chi2     =    0.0000

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5729811    .2263521      2.53    0.011      .1293391     1.016623
    Kyivskiy |    .2089498    .0736828      2.84    0.005      .0645341     .3533655
     agegrp3 |   -.1039064    .0415374     -2.50    0.012     -.1853181    -.0224947
      mar2w1 |   -1.049632    .1016999    -10.32    0.000     -1.248961    -.8503043
      occ5w1 |    1.492041    .1876865      7.95    0.000      1.124182       1.8599
      occ4w2 |    .3310965    .0971523      3.41    0.001      .1406815     .5215115
      occ5w2 |   -1.362859    .1189455    -11.46    0.000     -1.595987     -1.12973
       deaw1 |   -.1929352    .0754592     -2.56    0.011     -.3408324    -.0450379
      cataw1 |   -.4840949    .0817057     -5.92    0.000     -.6442353    -.3239546
     phlthw3 |    .0013493    .0020194      0.67    0.504     -.0026087     .0053072
    icdx3nr9 |   -1.539093    .2419448     -6.36    0.000     -2.013296     -1.06489
    icdx4nr7 |   -2.272956    .1665247    -13.65    0.000     -2.599338    -1.946574
    icdx4nr9 |    -2.51101    .1627369    -15.43    0.000     -2.829968    -2.192051
    icdx5nr2 |   -2.183195    .1948359    -11.21    0.000     -2.565067    -1.801324
   icdx5nr11 |    1.242952    .0959207     12.96    0.000      1.054951     1.430954
     injothr |   -.1867559    .0958328     -1.95    0.051     -.3745846     .0010729
      contw2 |   -.2844865    .0734802     -3.87    0.000     -.4285051     -.140468
       WHPer |    .0060213     .002211      2.72    0.006      .0016878     .0103548
       BSIoc |    -.038573    .0083402     -4.62    0.000     -.0549195    -.0222265
      BSIanx |   -.0389161    .0104804     -3.71    0.000     -.0594573    -.0183749
     HP2work |    .1865375    .0786597      2.37    0.018      .0323674     .3407076
       neiw1 |    -.001991    .0010034     -1.98    0.047     -.0039576    -.0000244
       toxic |    .0025757    .0009546      2.70    0.007      .0007046     .0044467
       _cons |    3.908165    .2815976     13.88    0.000      3.356244     4.460086
-------------+----------------------------------------------------------------
       /ln_p |     .914614     .058113     15.74    0.000      .8007146     1.028514
-------------+----------------------------------------------------------------
            p |   2.495812    .1450392                    2.227132     2.796905
          1/p |   .4006712    .0232842                     .357538      .449008
-------------+----------------------------------------------------------------

.
. predict fhaz2, hazard
(21557 missing values generated)

. predict fsurv2, surv
(21557 missing values generated)

. predict fcsurv2, csurv
(21711 missing values generated)

. predict medtime2, median time
(21557 missing values generated)

. predict meantime2, mean time
(21557 missing values generated)

. graph twoway scatter fsurv2 _t || lowess fsurv2 _t || lowess fcsurv2 _t, sort c(l) title(Conditional and uncondition Survival Functions) ///
>      subtitle(Female Weibull regression model with covariates)  ytitle(Survival probability)

. graph save fcsurfsurv.gph, replace
(file fcsurfsurv.gph saved)

. graph export fcsurvfsurv.eps, replace
(file fcsurvfsurv.eps written in EPS format)

. *****  We compare baseline hazard with covariate accelerated hazard
. line fhaz _t, sort c(l) || lowess fhaz _t, sort c(l) || lowess fbh _t, sort c(l) ///
>    title(Comparison of female Weibull baseline hazard rate) ///
>   subtitle(with female Weibull covariate accelerated hazard rate)  ytitle(hazard rate) ///
>    ylabel(0(100)300)

.  gr save fhazfbh.gph, replace
(file fhazfbh.gph saved)

.  gr export fhazfbh.eps, replace
(file fhazfbh.eps written in EPS format)

.
.
. est store ft`model'

.
.
. // ffsc refers to full female schwartz criterion
. capture confirm variable `x'ftsc

. if _rc !=0 {
. cap gen `x'ftsc = -2*e(ll) + ln(e(N))*e(rank)
.  }

.  scalar `x'ftsc = `x'ftsc

.  di "`x'ftsc = ",`x'ftsc
ftsc =  508.73538

.
.
.
. est stats _all

-------------+---------------------------------------------------------------
       Model |    Obs    ll(null)   ll(model)     df          AIC         BIC
-------------+---------------------------------------------------------------
ffexponent~l   |   186  -228.1075   -207.3755     18     450.7511    508.8145
ffweibull    |    186   -195.5575   -126.4254     19     290.8509    352.1401
fflognormal   |   186   -202.8786   -141.1965     19      320.393    381.6822
ffloglogis~c   |   186  -200.5616   -132.9925     19     303.9849    365.2741
ffgamma      |    186   -194.9136   -126.3458     20     292.6916    357.2065
ftexponent~l   |   186  -228.1075    -207.336     18      450.672    508.7354
ftweibull    |    186   -195.5575   -126.7005     19      291.401    352.6902
ftlognormal   |   186   -202.8786   -140.8154     19     319.6308      380.92
ftloglogis~c   |   186  -200.5616   -132.7448     19     303.4896    364.7788
ftgamma      |    186   -194.9136   -126.6969     20     293.3939    357.9088
ft           |    186   -195.5575   -126.7005     19      291.401    352.6902
-------------+---------------------------------------------------------------


Note:  N=Obs used in calculating BIC; see [R] BIC note


.
.   stcurve, hazard at1(agegrp3 = 1) at2(agegrp3 =2) at3(agegrp3 =3) subtitle(different hazard rates by age group for women)  ///
>      caption(agegrp 1 = youngest and agegrp3 = oldest)

.   gr save fweibregxagegp.gph, replace
(file fweibregxagegp.gph saved)

.   gr export fwiebRegXagrp.eps, replace
(file fwiebRegXagrp.eps written in EPS format)

.
. stcurve, cumhaz at1(agegrp3 = 1) at2(agegrp3 =2) at3(agegrp3 =3) subtitle(different cumulative hazard rates by age group for women)  ///
>      caption(agegrp 1 = youngest and agegrp3 = oldest)

.   gr save fchweibregxagegp.gph, replace
(file fchweibregxagegp.gph saved)

.   gr export fchweibRegXagrp.eps, replace
(file fchweibRegXagrp.eps written in EPS format)

.
. sts graph if gender==2, hazard by(agegrp3) subtitle(for time till level 25 depression for females by age group) ytitle(smoothed hazard rate)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

.    gr save shazfemAgegrp.gph, replace
(file shazfemAgegrp.gph saved)

.    gr export fshzXagrp.eps, replace
(file fshzXagrp.eps written in EPS format)

.    // sharp rise in hazard at time of collapse of USSR and independence of Ukraine
.
. graph combine cumhazXagegp3.gph fchweibregxagegp.gph, col(1)

.
.
.
.
.  //  peripheralvascular1w1-rheumatologic1w1
. title(AFT female full Weibull model)


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                                (AFT                                 *****
*****                               female                                *****
*****                                full                                 *****
*****                              Weibull                                *****
*****                               model)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:44:59  *****
*******************************************************************************
*******************************************************************************


.
.    set more off

. xi:streg Irpenskiy Kyivskiy ///
>       i.agegrp3 mar2w1 ///
>        occ5w1  occ4w2 occ5w2  ///
>      deaw1 cataw1 ///
>      phlthw3 ///
>       icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///
>                           injothr   ///
>                       contw2   ///
>                WHPer BSIoc BSIanx HP2work neiw1 toxic  ///
>                 if gender==2, iterate(20) dist(weibull) nolog vce(cluster id) time
i.agegrp3         _Iagegrp3_1-3       (naturally coded; _Iagegrp3_1 omitted)

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id

Weibull regression -- accelerated failure-time form

No. of subjects      =          186                Number of obs   =       186
No. of failures      =          182
Time at risk         =         2360
                                                   Wald chi2(18)   =  66512.21
Log pseudolikelihood =   -126.19436                Prob > chi2     =    0.0000

(Std. Err. adjusted for 186 clusters in id)
-------------+----------------------------------------------------------------
             |               Robust
           _t |      Coef.    Std. Err.       z    P>|z|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
   Irpenskiy |    .5833975    .2230778      2.62    0.009       .146173     1.020622
    Kyivskiy |    .2035143    .0727423      2.80    0.005      .0609421     .3460866
 _Iagegrp3_2 |   -.0337577    .0785768     -0.43    0.667     -.1877654     .1202501
 _Iagegrp3_3 |   -.2001909    .0813837     -2.46    0.014     -.3597001    -.0406817
      mar2w1 |   -1.053826    .0939155    -11.22    0.000     -1.237897    -.8697548
      occ5w1 |    1.468141    .1993835      7.36    0.000      1.077357     1.858926
      occ4w2 |    .3266465    .1002593      3.26    0.001      .1301419     .5231511
      occ5w2 |   -1.333018    .1213112    -10.99    0.000     -1.570784    -1.095252
       deaw1 |   -.1907277    .0752972     -2.53    0.011     -.3383075    -.0431479
      cataw1 |   -.4791425    .0797214     -6.01    0.000     -.6353936    -.3228914
     phlthw3 |    .0014405    .0019803      0.73    0.467     -.0024407     .0053218
    icdx3nr9 |   -1.553722    .2470302     -6.29    0.000     -2.037892    -1.069551
    icdx4nr7 |   -2.265153    .1699094    -13.33    0.000     -2.598169    -1.932137
    icdx4nr9 |   -2.495561    .1593276    -15.66    0.000     -2.807837    -2.183284
    icdx5nr2 |    -2.19544    .2055207    -10.68    0.000     -2.598253    -1.792627
   icdx5nr11 |    1.262625    .0984325     12.83    0.000      1.069701      1.45555
     injothr |   -.1805663    .0940894     -1.92    0.055     -.3649783     .0038456
      contw2 |   -.2772753    .0745885     -3.72    0.000     -.4234659    -.1310846
       WHPer |    .0061779    .0021282      2.90    0.004      .0020066     .0103492
       BSIoc |   -.0377422    .0083931     -4.50    0.000     -.0541924    -.0212921
      BSIanx |   -.0407523    .0107815     -3.78    0.000     -.0618836     -.019621
     HP2work |    .1987319     .078451      2.53    0.011      .0449709      .352493
       neiw1 |   -.0020802    .0009857     -2.11    0.035     -.0040121    -.0001483
       toxic |    .0025759     .000946      2.72    0.006      .0007218       .00443
       _cons |    3.762048    .2784678     13.51    0.000      3.216261     4.307835
-------------+----------------------------------------------------------------
       /ln_p |    .9199819    .0584583     15.74    0.000      .8054057     1.034558
-------------+----------------------------------------------------------------
            p |   2.509245    .1466863                    2.237604     2.813863
          1/p |   .3985262    .0232972                    .3553834     .4469066
-------------+----------------------------------------------------------------

.
.      est store f`x'model

.      predict fthaz, hazard
(21557 missing values generated)

.      predict ftsurv, surv
(21557 missing values generated)

.      predict fFM_lnmedtime, lntime
(option log median time assumed; predicted median log time)
(21557 missing values generated)

.  est stats _all

-------------+---------------------------------------------------------------
       Model |    Obs    ll(null)   ll(model)     df          AIC         BIC
-------------+---------------------------------------------------------------
ffexponent~l   |   186  -228.1075   -207.3755     18     450.7511    508.8145
ffweibull    |    186   -195.5575   -126.4254     19     290.8509    352.1401
fflognormal   |   186   -202.8786   -141.1965     19      320.393    381.6822
ffloglogis~c   |   186  -200.5616   -132.9925     19     303.9849    365.2741
ffgamma      |    186   -194.9136   -126.3458     20     292.6916    357.2065
ftexponent~l   |   186  -228.1075    -207.336     18      450.672    508.7354
ftweibull    |    186   -195.5575   -126.7005     19      291.401    352.6902
ftlognormal   |   186   -202.8786   -140.8154     19     319.6308      380.92
ftloglogis~c   |   186  -200.5616   -132.7448     19     303.4896    364.7788
ftgamma      |    186   -194.9136   -126.6969     20     293.3939    357.9088
ft           |    186   -195.5575   -126.7005     19      291.401    352.6902
fmodel       |    186   -195.5575   -126.1944     20     292.3887    356.9037
-------------+---------------------------------------------------------------


Note:  N=Obs used in calculating BIC; see [R] BIC note


.
.
.
.   //  peripheralvascular1w1-rheumatologic1w1
. cap gen fbh = (1.723169* _t^(.723169))*exp(2.828092)

. cap  gen lnfbh = ln(fbh)

. label var lnfbh "Ln of female baseline hazard"

.   sts test fBL_lnmedtime  fFM_lnmedtime, wilcoxon

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id


Wilcoxon (Breslow) test for equality of survivor functions


                    |   Events         Events        Sum of
fBL_ln~e, fFM_ln~e  |  observed       expected        ranks
--------------------+--------------------------------------
2.312239, -.6487507 |         1           0.04          320
2.312239, -.146065  |         2           0.04          666
2.312239, .2907836  |         1           0.07          301
2.312239, .7135081  |         1           0.04          320
2.312239, .7197824  |         1           0.02          333
2.312239, 1.056297  |         1           0.91          -77
2.312239, 1.577816  |         1           0.36          193
2.312239, 1.584005  |         1           0.44           96
2.312239, 1.62986   |         1           0.36          193
2.312239, 1.65612   |         1           0.04          320
2.312239, 1.657239  |         1           0.10          284
2.312239, 1.696125  |         1           0.51           65
2.312239, 1.715113  |         1           0.36          193
2.312239, 1.724959  |         1           0.36          193
2.312239, 1.741399  |         1           0.36          193
2.312239, 1.74176   |         1           0.36          193
2.312239, 1.746184  |         1           0.36          193
2.312239, 1.751267  |         1           0.07          301
2.312239, 1.789463  |         1           0.36          193
2.312239, 1.815059  |         1           0.36          193
2.312239, 1.822942  |         1           0.57           37
2.312239, 1.830406  |         1           0.36          193
2.312239, 1.867536  |         1           0.07          301
2.312239, 1.892986  |         1           0.07          301
2.312239, 1.911008  |         1           0.36          193
2.312239, 1.932757  |         1           0.44           96
2.312239, 1.951656  |         1           0.86          -60
2.312239, 1.967028  |         1           0.36          193
2.312239, 2.004882  |         1           2.94         -303
2.312239, 2.04572   |         1           1.17         -137
2.312239, 2.050128  |         1           0.44           96
2.312239, 2.056775  |         1           0.36          193
2.312239, 2.060553  |         1           0.51           65
2.312239, 2.085739  |         1           0.44           96
2.312239, 2.092655  |         1           0.36          193
2.312239, 2.092812  |         1           0.67            7
2.312239, 2.099833  |         1           0.36          193
2.312239, 2.101048  |         1           0.36          193
2.312239, 2.119055  |         1           0.51           65
2.312239, 2.168807  |         1           1.66         -217
2.312239, 2.169492  |         1           0.36          193
2.312239, 2.177094  |         1           0.36          193
2.312239, 2.18557   |         1           0.36          193
2.312239, 2.185733  |         1           0.91          -77
2.312239, 2.190597  |         1           0.51           65
2.312239, 2.191634  |         1           0.36          193
2.312239, 2.200034  |         1           0.51           65
2.312239, 2.208091  |         1           1.01          -97
2.312239, 2.208486  |         1           0.67            7
2.312239, 2.222483  |         1           0.02          333
2.312239, 2.22315   |         1           0.36          193
2.312239, 2.229816  |         1           1.10         -120
2.312239, 2.251602  |         1           0.67            7
2.312239, 2.255025  |         1           0.36          193
2.312239, 2.258591  |         1           0.07          301
2.312239, 2.285786  |         1           0.10          284
2.312239, 2.286766  |         1           1.01          -97
2.312239, 2.290424  |         1           0.36          193
2.312239, 2.290533  |         1           0.36          193
2.312239, 2.295933  |         1           1.73         -228
2.312239, 2.297715  |         1           0.05          311
2.312239, 2.301575  |         1           0.36          193
2.312239, 2.308336  |         1           2.24         -271
2.312239, 2.314597  |         1           0.10          284
2.312239, 2.319186  |         1           0.57           37
2.312239, 2.32014   |         1           0.91          -77
2.312239, 2.323917  |         1           0.36          193
2.312239, 2.32655   |         1           0.91          -77
2.312239, 2.329548  |         1           0.36          193
2.312239, 2.361027  |         1           0.05          311
2.312239, 2.361626  |         1           0.44           96
2.312239, 2.362347  |         1           0.36          193
2.312239, 2.365839  |         1           1.33         -160
2.312239, 2.399332  |         1           1.33         -160
2.312239, 2.406475  |         1           1.73         -228
2.312239, 2.470422  |         1           0.36          193
2.312239, 2.471734  |         1           1.84         -238
2.312239, 2.473027  |         1           1.01          -97
2.312239, 2.495664  |         1           0.07          301
2.312239, 2.54068   |         1           0.02          333
2.312239, 2.557234  |         1           2.24         -271
2.312239, 2.56261   |         1           1.55         -201
2.312239, 2.570974  |         1           1.66         -217
2.312239, 2.596093  |         1           1.66         -217
2.312239, 2.614712  |         1           1.33         -160
2.312239, 2.625171  |         1           1.10         -120
2.312239, 2.635644  |         1           0.79          -38
2.312239, 2.638159  |         1           2.94         -303
2.312239, 2.65733   |         1           0.36          193
2.312239, 2.682661  |         1           0.36          193
2.312239, 2.711393  |         1           2.06         -258
2.312239, 2.71791   |         1           0.36          193
2.312239, 2.71817   |         1           0.57           37
2.312239, 2.726723  |         1           2.06         -258
2.312239, 2.728836  |         1           0.36          193
2.312239, 2.735828  |         1           2.44         -285
2.312239, 2.75642   |         1           1.43         -184
2.312239, 2.759114  |         1           2.06         -258
2.312239, 2.783098  |         1           0.57           37
2.312239, 2.822371  |         1           0.36          193
2.312239, 2.873368  |         1           1.66         -217
2.312239, 2.898584  |         1           1.84         -238
2.312239, 2.932198  |         1           0.51           65
2.312239, 2.940116  |         1           1.01          -97
2.312239, 2.993919  |         1           0.67            7
2.312239, 3.055022  |         1           1.17         -137
2.312239, 3.063938  |         1           0.36          193
2.312239, 3.12426   |         1           2.94         -303
2.312239, 3.131862  |         1           3.44         -321
2.312239, 3.18614   |         1           2.94         -303
2.312239, 3.209463  |         1           2.44         -285
2.312239, 3.295678  |         1           3.44         -321
2.312239, 3.873165  |         1           0.57           37
2.467306, .845048   |         1           1.84         -238
2.467306, .9632335  |         1           0.10          284
2.467306, 1.311778  |         1           0.67            7
2.467306, 1.540876  |         1           0.36          193
2.467306, 1.587571  |         1           0.44           96
2.467306, 1.622623  |         1           0.10          284
2.467306, 1.645694  |         1           0.36          193
2.467306, 1.689032  |         1           0.72          -18
2.467306, 1.779353  |         1           0.36          193
2.467306, 1.799845  |         1           0.44           96
2.467306, 1.812263  |         1           0.36          193
2.467306, 1.851061  |         1           1.55         -201
2.467306, 1.889725  |         1           0.79          -38
2.467306, 1.930196  |         1           0.36          193
2.467306, 1.953517  |         1           0.10          284
2.467306, 1.960679  |         1           0.36          193
2.467306, 1.993403  |         1           0.36          193
2.467306, 2.026918  |         1           0.79          -38
2.467306, 2.052866  |         1           0.72          -18
2.467306, 2.056452  |         1           2.24         -271
2.467306, 2.059821  |         1           1.33         -160
2.467306, 2.06354   |         1           0.67            7
2.467306, 2.068283  |         1           3.44         -321
2.467306, 2.071418  |         1           0.36          193
2.467306, 2.079914  |         1           0.02          333
2.467306, 2.110771  |         1           0.44           96
2.467306, 2.14187   |         1           0.72          -18
2.467306, 2.158518  |         1           0.36          193
2.467306, 2.177334  |         1           0.36          193
2.467306, 2.200152  |         1           0.36          193
2.467306, 2.206085  |         1           0.36          193
2.467306, 2.219096  |         1           0.36          193
2.467306, 2.221876  |         1           0.86          -60
2.467306, 2.224418  |         1           0.36          193
2.467306, 2.228116  |         1           0.79          -38
2.467306, 2.236025  |         1           0.67            7
2.467306, 2.253782  |         1           0.02          333
2.467306, 2.265134  |         1           0.36          193
2.467306, 2.288773  |         1           0.86          -60
2.467306, 2.306169  |         1           0.36          193
2.467306, 2.308764  |         1           1.33         -160
2.467306, 2.311912  |         1           1.55         -201
2.467306, 2.321836  |         1           0.79          -38
2.467306, 2.341543  |         1           0.44           96
2.467306, 2.34797   |         1           0.05          311
2.467306, 2.350373  |         1           0.36          193
2.467306, 2.362273  |         1           1.66         -217
2.467306, 2.381797  |         1           1.33         -160
2.467306, 2.394824  |         1           1.01          -97
2.467306, 2.403367  |         1           0.04          320
2.467306, 2.404906  |         1           1.84         -238
2.467306, 2.430104  |         1           0.36          193
2.467306, 2.436719  |         1           0.79          -38
2.467306, 2.452219  |         1           1.66         -217
2.467306, 2.453761  |         1           0.10          284
2.467306, 2.480766  |         1           0.07          301
2.467306, 2.496545  |         1           0.51           65
2.467306, 2.498226  |         1           1.43         -184
2.467306, 2.498325  |         1           0.04          320
2.467306, 2.49882   |         1           1.01          -97
2.467306, 2.502102  |         1           0.72          -18
2.467306, 2.522519  |         1           0.44           96
2.467306, 2.529124  |         1           0.36          193
2.467306, 2.533859  |         1           0.57           37
2.467306, 2.535896  |         1           0.36          193
2.467306, 2.536523  |         1           1.92         -248
2.467306, 2.553621  |         1           0.67            7
2.467306, 2.558295  |         1           0.86          -60
2.467306, 2.56143   |         1           0.36          193
2.467306, 2.562983  |         1           0.51           65
2.467306, 2.574849  |         1           0.67            7
2.467306, 2.575203  |         1           0.10          284
2.467306, 2.596246  |         1           0.57           37
2.467306, 2.60168   |         1           0.57           37
2.467306, 2.602715  |         1           0.79          -38
2.467306, 2.615681  |         1           1.33         -160
2.467306, 2.629269  |         1           0.67            7
2.467306, 2.631215  |         1           1.10         -120
2.467306, 2.637663  |         1           0.36          193
2.467306, 2.63787   |         1           0.67            7
2.467306, 2.641967  |         1           0.36          193
2.467306, 2.655947  |         1           2.06         -258
2.467306, 2.664525  |         1           1.01          -97
2.467306, 2.681339  |         1           0.36          193
2.467306, 2.690048  |         1           1.33         -160
2.467306, 2.699235  |         1           0.67            7
2.467306, 2.717476  |         1           0.36          193
2.467306, 2.721288  |         1           0.67            7
2.467306, 2.745506  |         0           3.44         -333
2.467306, 2.749536  |         1           1.55         -201
2.467306, 2.769698  |         1           0.86          -60
2.467306, 2.775292  |         1           0.36          193
2.467306, 2.777339  |         1           0.67            7
2.467306, 2.780808  |         1           1.01          -97
2.467306, 2.786054  |         1           2.24         -271
2.467306, 2.7929    |         1           3.44         -321
2.467306, 2.793272  |         1           1.73         -228
2.467306, 2.800056  |         1           0.36          193
2.467306, 2.812855  |         1           0.36          193
2.467306, 2.823777  |         1           2.24         -271
2.467306, 2.82398   |         1           1.17         -137
2.467306, 2.840661  |         1           0.36          193
2.467306, 2.850147  |         1           0.44           96
2.467306, 2.851338  |         1           0.36          193
2.467306, 2.852389  |         1           1.55         -201
2.467306, 2.871579  |         1           0.51           65
2.467306, 2.879391  |         1           1.33         -160
2.467306, 2.896122  |         1           0.04          320
2.467306, 2.897594  |         1           0.57           37
2.467306, 2.900336  |         1           0.51           65
2.467306, 2.934399  |         1           2.94         -303
2.467306, 2.935492  |         1           1.43         -184
2.467306, 2.942674  |         1           1.10         -120
2.467306, 2.966584  |         1           0.79          -38
2.467306, 2.992805  |         1           0.79          -38
2.467306, 2.993239  |         1           0.36          193
2.467306, 2.995296  |         1           1.92         -248
2.467306, 3.001292  |         1           0.79          -38
2.467306, 3.00276   |         1           1.10         -120
2.467306, 3.019838  |         0           2.24         -309
2.467306, 3.044956  |         1           2.06         -258
2.467306, 3.074822  |         1           1.55         -201
2.467306, 3.078009  |         1           0.57           37
2.467306, 3.14661   |         1           2.94         -303
2.467306, 3.177184  |         0           3.44         -333
2.467306, 3.180999  |         1           1.10         -120
2.467306, 3.183877  |         1           2.24         -271
2.467306, 3.185036  |         1           2.94         -303
2.467306, 3.378626  |         1           0.79          -38
2.467306, 3.603701  |         1           0.86          -60
2.615395, .717581   |         1           0.51           65
2.615395, .9518409  |         1           0.36          193
2.615395, 1.015791  |         1           1.10         -120
2.615395, 1.088366  |         1           1.17         -137
2.615395, 1.202524  |         1           2.44         -285
2.615395, 1.397274  |         1           0.44           96
2.615395, 1.463373  |         1           0.10          284
2.615395, 1.618185  |         1           2.24         -271
2.615395, 1.757112  |         1           0.91          -77
2.615395, 2.008787  |         1           0.36          193
2.615395, 2.087629  |         1           0.36          193
2.615395, 2.087739  |         1           0.91          -77
2.615395, 2.095903  |         1           1.01          -97
2.615395, 2.101604  |         1           0.44           96
2.615395, 2.139578  |         1           0.72          -18
2.615395, 2.159512  |         1           0.67            7
2.615395, 2.17201   |         1           0.51           65
2.615395, 2.197958  |         1           0.36          193
2.615395, 2.23169   |         1           0.36          193
2.615395, 2.250336  |         1           1.33         -160
2.615395, 2.283869  |         1           0.72          -18
2.615395, 2.311141  |         1           1.55         -201
2.615395, 2.323052  |         1           1.01          -97
2.615395, 2.330915  |         1           0.44           96
2.615395, 2.382522  |         1           0.44           96
2.615395, 2.387113  |         1           1.55         -201
2.615395, 2.467097  |         1           3.94         -332
2.615395, 2.490558  |         1           0.36          193
2.615395, 2.491941  |         1           1.43         -184
2.615395, 2.510615  |         1           0.36          193
2.615395, 2.528871  |         1           0.91          -77
2.615395, 2.528927  |         1           1.33         -160
2.615395, 2.530457  |         1           0.36          193
2.615395, 2.536876  |         1           1.43         -184
2.615395, 2.540007  |         1           0.36          193
2.615395, 2.549971  |         1           0.36          193
2.615395, 2.554893  |         1           1.43         -184
2.615395, 2.580355  |         1           1.10         -120
2.615395, 2.582424  |         1           0.36          193
2.615395, 2.590365  |         1           1.73         -228
2.615395, 2.59088   |         1           0.51           65
2.615395, 2.592843  |         1           0.86          -60
2.615395, 2.593851  |         1           0.72          -18
2.615395, 2.598941  |         1           0.57           37
2.615395, 2.604076  |         2           1.54          -24
2.615395, 2.614428  |         1           1.01          -97
2.615395, 2.626533  |         1           1.17         -137
2.615395, 2.628308  |         1           1.17         -137
2.615395, 2.631045  |         1           0.36          193
2.615395, 2.657254  |         1           1.01          -97
2.615395, 2.659126  |         1           1.17         -137
2.615395, 2.66637   |         1           1.33         -160
2.615395, 2.682164  |         1           0.57           37
2.615395, 2.684939  |         1           1.33         -160
2.615395, 2.685686  |         1           1.01          -97
2.615395, 2.688699  |         1           1.55         -201
2.615395, 2.701019  |         1           1.33         -160
2.615395, 2.749445  |         1           0.10          284
2.615395, 2.749538  |         1           2.44         -285
2.615395, 2.771516  |         1           1.92         -248
2.615395, 2.780242  |         1           0.86          -60
2.615395, 2.780775  |         1           0.36          193
2.615395, 2.785432  |         1           1.43         -184
2.615395, 2.789459  |         1           0.86          -60
2.615395, 2.79343   |         1           1.33         -160
2.615395, 2.806674  |         1           0.72          -18
2.615395, 2.853316  |         1           0.67            7
2.615395, 2.874986  |         1           1.84         -238
2.615395, 2.898694  |         1           0.36          193
2.615395, 2.903088  |         1           0.67            7
2.615395, 2.903374  |         1           0.51           65
2.615395, 2.922246  |         1           2.06         -258
2.615395, 2.929546  |         1           1.33         -160
2.615395, 2.934033  |         1           3.44         -321
2.615395, 2.93661   |         1           2.94         -303
2.615395, 2.939783  |         1           1.84         -238
2.615395, 2.966548  |         1           0.36          193
2.615395, 3.000586  |         1           1.43         -184
2.615395, 3.010534  |         1           2.44         -285
2.615395, 3.023006  |         1           0.57           37
2.615395, 3.029842  |         1           3.44         -321
2.615395, 3.091012  |         0           3.44         -333
2.615395, 3.093969  |         1           2.94         -303
2.615395, 3.097596  |         1           2.44         -285
2.615395, 3.102804  |         1           1.66         -217
2.615395, 3.108545  |         1           2.94         -303
2.615395, 3.11323   |         1           2.94         -303
2.615395, 3.115846  |         0           3.94         -334
2.615395, 3.189693  |         1           0.79          -38
2.615395, 3.196986  |         0           3.44         -333
2.615395, 3.247791  |         1           1.92         -248
2.615395, 3.287424  |         1           1.10         -120
2.615395, 3.306286  |         1           0.86          -60
2.615395, 3.30682   |         1           0.51           65
2.615395, 3.308536  |         1           2.94         -303
--------------------+--------------------------------------
Total               |       334         334.00            0

                         chi2(337) =    1029.87
                          Pr>chi2 =     0.0000

.   tabstat fbh fBL_lnmedtime fFM_lnmedtime, stat(median mean)

   stats |       fbh  fBL_ln~e  fFM_ln~e
---------+------------------------------
p50   |  154.0713  2.467306  2.506359
mean   |  176.7754  2.457126  2.413408
---------+------------------------------

.   sts test fBL_lnmedtime fFM_lnmedtime

         failure _d:  desdep25
   analysis time _t:  tf
  exit on or before:  time .
                 id:  id


Log-rank test for equality of survivor functions


                    |   Events         Events
fBL_ln~e, fFM_ln~e  |  observed       expected
--------------------+-------------------------
2.312239, -.6487507 |         1           0.04
2.312239, -.146065  |         2           0.04
2.312239, .2907836  |         1           0.07
2.312239, .7135081  |         1           0.04
2.312239, .7197824  |         1           0.02
2.312239, 1.056297  |         1           0.91
2.312239, 1.577816  |         1           0.36
2.312239, 1.584005  |         1           0.44
2.312239, 1.62986   |         1           0.36
2.312239, 1.65612   |         1           0.04
2.312239, 1.657239  |         1           0.10
2.312239, 1.696125  |         1           0.51
2.312239, 1.715113  |         1           0.36
2.312239, 1.724959  |         1           0.36
2.312239, 1.741399  |         1           0.36
2.312239, 1.74176   |         1           0.36
2.312239, 1.746184  |         1           0.36
2.312239, 1.751267  |         1           0.07
2.312239, 1.789463  |         1           0.36
2.312239, 1.815059  |         1           0.36
2.312239, 1.822942  |         1           0.57
2.312239, 1.830406  |         1           0.36
2.312239, 1.867536  |         1           0.07
2.312239, 1.892986  |         1           0.07
2.312239, 1.911008  |         1           0.36
2.312239, 1.932757  |         1           0.44
2.312239, 1.951656  |         1           0.86
2.312239, 1.967028  |         1           0.36
2.312239, 2.004882  |         1           2.94
2.312239, 2.04572   |         1           1.17
2.312239, 2.050128  |         1           0.44
2.312239, 2.056775  |         1           0.36
2.312239, 2.060553  |         1           0.51
2.312239, 2.085739  |         1           0.44
2.312239, 2.092655  |         1           0.36
2.312239, 2.092812  |         1           0.67
2.312239, 2.099833  |         1           0.36
2.312239, 2.101048  |         1           0.36
2.312239, 2.119055  |         1           0.51
2.312239, 2.168807  |         1           1.66
2.312239, 2.169492  |         1           0.36
2.312239, 2.177094  |         1           0.36
2.312239, 2.18557   |         1           0.36
2.312239, 2.185733  |         1           0.91
2.312239, 2.190597  |         1           0.51
2.312239, 2.191634  |         1           0.36
2.312239, 2.200034  |         1           0.51
2.312239, 2.208091  |         1           1.01
2.312239, 2.208486  |         1           0.67
2.312239, 2.222483  |         1           0.02
2.312239, 2.22315   |         1           0.36
2.312239, 2.229816  |         1           1.10
2.312239, 2.251602  |         1           0.67
2.312239, 2.255025  |         1           0.36
2.312239, 2.258591  |         1           0.07
2.312239, 2.285786  |         1           0.10
2.312239, 2.286766  |         1           1.01
2.312239, 2.290424  |         1           0.36
2.312239, 2.290533  |         1           0.36
2.312239, 2.295933  |         1           1.73
2.312239, 2.297715  |         1           0.05
2.312239, 2.301575  |         1           0.36
2.312239, 2.308336  |         1           2.24
2.312239, 2.314597  |         1           0.10
2.312239, 2.319186  |         1           0.57
2.312239, 2.32014   |         1           0.91
2.312239, 2.323917  |         1           0.36
2.312239, 2.32655   |         1           0.91
2.312239, 2.329548  |         1           0.36
2.312239, 2.361027  |         1           0.05
2.312239, 2.361626  |         1           0.44
2.312239, 2.362347  |         1           0.36
2.312239, 2.365839  |         1           1.33
2.312239, 2.399332  |         1           1.33
2.312239, 2.406475  |         1           1.73
2.312239, 2.470422  |         1           0.36
2.312239, 2.471734  |         1           1.84
2.312239, 2.473027  |         1           1.01
2.312239, 2.495664  |         1           0.07
2.312239, 2.54068   |         1           0.02
2.312239, 2.557234  |         1           2.24
2.312239, 2.56261   |         1           1.55
2.312239, 2.570974  |         1           1.66
2.312239, 2.596093  |         1           1.66
2.312239, 2.614712  |         1           1.33
2.312239, 2.625171  |         1           1.10
2.312239, 2.635644  |         1           0.79
2.312239, 2.638159  |         1           2.94
2.312239, 2.65733   |         1           0.36
2.312239, 2.682661  |         1           0.36
2.312239, 2.711393  |         1           2.06
2.312239, 2.71791   |         1           0.36
2.312239, 2.71817   |         1           0.57
2.312239, 2.726723  |         1           2.06
2.312239, 2.728836  |         1           0.36
2.312239, 2.735828  |         1           2.44
2.312239, 2.75642   |         1           1.43
2.312239, 2.759114  |         1           2.06
2.312239, 2.783098  |         1           0.57
2.312239, 2.822371  |         1           0.36
2.312239, 2.873368  |         1           1.66
2.312239, 2.898584  |         1           1.84
2.312239, 2.932198  |         1           0.51
2.312239, 2.940116  |         1           1.01
2.312239, 2.993919  |         1           0.67
2.312239, 3.055022  |         1           1.17
2.312239, 3.063938  |         1           0.36
2.312239, 3.12426   |         1           2.94
2.312239, 3.131862  |         1           3.44
2.312239, 3.18614   |         1           2.94
2.312239, 3.209463  |         1           2.44
2.312239, 3.295678  |         1           3.44
2.312239, 3.873165  |         1           0.57
2.467306, .845048   |         1           1.84
2.467306, .9632335  |         1           0.10
2.467306, 1.311778  |         1           0.67
2.467306, 1.540876  |         1           0.36
2.467306, 1.587571  |         1           0.44
2.467306, 1.622623  |         1           0.10
2.467306, 1.645694  |         1           0.36
2.467306, 1.689032  |         1           0.72
2.467306, 1.779353  |         1           0.36
2.467306, 1.799845  |         1           0.44
2.467306, 1.812263  |         1           0.36
2.467306, 1.851061  |         1           1.55
2.467306, 1.889725  |         1           0.79
2.467306, 1.930196  |         1           0.36
2.467306, 1.953517  |         1           0.10
2.467306, 1.960679  |         1           0.36
2.467306, 1.993403  |         1           0.36
2.467306, 2.026918  |         1           0.79
2.467306, 2.052866  |         1           0.72
2.467306, 2.056452  |         1           2.24
2.467306, 2.059821  |         1           1.33
2.467306, 2.06354   |         1           0.67
2.467306, 2.068283  |         1           3.44
2.467306, 2.071418  |         1           0.36
2.467306, 2.079914  |         1           0.02
2.467306, 2.110771  |         1           0.44
2.467306, 2.14187   |         1           0.72
2.467306, 2.158518  |         1           0.36
2.467306, 2.177334  |         1           0.36
2.467306, 2.200152  |         1           0.36
2.467306, 2.206085  |         1           0.36
2.467306, 2.219096  |         1           0.36
2.467306, 2.221876  |         1           0.86
2.467306, 2.224418  |         1           0.36
2.467306, 2.228116  |         1           0.79
2.467306, 2.236025  |         1           0.67
2.467306, 2.253782  |         1           0.02
2.467306, 2.265134  |         1           0.36
2.467306, 2.288773  |         1           0.86
2.467306, 2.306169  |         1           0.36
2.467306, 2.308764  |         1           1.33
2.467306, 2.311912  |         1           1.55
2.467306, 2.321836  |         1           0.79
2.467306, 2.341543  |         1           0.44
2.467306, 2.34797   |         1           0.05
2.467306, 2.350373  |         1           0.36
2.467306, 2.362273  |         1           1.66
2.467306, 2.381797  |         1           1.33
2.467306, 2.394824  |         1           1.01
2.467306, 2.403367  |         1           0.04
2.467306, 2.404906  |         1           1.84
2.467306, 2.430104  |         1           0.36
2.467306, 2.436719  |         1           0.79
2.467306, 2.452219  |         1           1.66
2.467306, 2.453761  |         1           0.10
2.467306, 2.480766  |         1           0.07
2.467306, 2.496545  |         1           0.51
2.467306, 2.498226  |         1           1.43
2.467306, 2.498325  |         1           0.04
2.467306, 2.49882   |         1           1.01
2.467306, 2.502102  |         1           0.72
2.467306, 2.522519  |         1           0.44
2.467306, 2.529124  |         1           0.36
2.467306, 2.533859  |         1           0.57
2.467306, 2.535896  |         1           0.36
2.467306, 2.536523  |         1           1.92
2.467306, 2.553621  |         1           0.67
2.467306, 2.558295  |         1           0.86
2.467306, 2.56143   |         1           0.36
2.467306, 2.562983  |         1           0.51
2.467306, 2.574849  |         1           0.67
2.467306, 2.575203  |         1           0.10
2.467306, 2.596246  |         1           0.57
2.467306, 2.60168   |         1           0.57
2.467306, 2.602715  |         1           0.79
2.467306, 2.615681  |         1           1.33
2.467306, 2.629269  |         1           0.67
2.467306, 2.631215  |         1           1.10
2.467306, 2.637663  |         1           0.36
2.467306, 2.63787   |         1           0.67
2.467306, 2.641967  |         1           0.36
2.467306, 2.655947  |         1           2.06
2.467306, 2.664525  |         1           1.01
2.467306, 2.681339  |         1           0.36
2.467306, 2.690048  |         1           1.33
2.467306, 2.699235  |         1           0.67
2.467306, 2.717476  |         1           0.36
2.467306, 2.721288  |         1           0.67
2.467306, 2.745506  |         0           3.44
2.467306, 2.749536  |         1           1.55
2.467306, 2.769698  |         1           0.86
2.467306, 2.775292  |         1           0.36
2.467306, 2.777339  |         1           0.67
2.467306, 2.780808  |         1           1.01
2.467306, 2.786054  |         1           2.24
2.467306, 2.7929    |         1           3.44
2.467306, 2.793272  |         1           1.73
2.467306, 2.800056  |         1           0.36
2.467306, 2.812855  |         1           0.36
2.467306, 2.823777  |         1           2.24
2.467306, 2.82398   |         1           1.17
2.467306, 2.840661  |         1           0.36
2.467306, 2.850147  |         1           0.44
2.467306, 2.851338  |         1           0.36
2.467306, 2.852389  |         1           1.55
2.467306, 2.871579  |         1           0.51
2.467306, 2.879391  |         1           1.33
2.467306, 2.896122  |         1           0.04
2.467306, 2.897594  |         1           0.57
2.467306, 2.900336  |         1           0.51
2.467306, 2.934399  |         1           2.94
2.467306, 2.935492  |         1           1.43
2.467306, 2.942674  |         1           1.10
2.467306, 2.966584  |         1           0.79
2.467306, 2.992805  |         1           0.79
2.467306, 2.993239  |         1           0.36
2.467306, 2.995296  |         1           1.92
2.467306, 3.001292  |         1           0.79
2.467306, 3.00276   |         1           1.10
2.467306, 3.019838  |         0           2.24
2.467306, 3.044956  |         1           2.06
2.467306, 3.074822  |         1           1.55
2.467306, 3.078009  |         1           0.57
2.467306, 3.14661   |         1           2.94
2.467306, 3.177184  |         0           3.44
2.467306, 3.180999  |         1           1.10
2.467306, 3.183877  |         1           2.24
2.467306, 3.185036  |         1           2.94
2.467306, 3.378626  |         1           0.79
2.467306, 3.603701  |         1           0.86
2.615395, .717581   |         1           0.51
2.615395, .9518409  |         1           0.36
2.615395, 1.015791  |         1           1.10
2.615395, 1.088366  |         1           1.17
2.615395, 1.202524  |         1           2.44
2.615395, 1.397274  |         1           0.44
2.615395, 1.463373  |         1           0.10
2.615395, 1.618185  |         1           2.24
2.615395, 1.757112  |         1           0.91
2.615395, 2.008787  |         1           0.36
2.615395, 2.087629  |         1           0.36
2.615395, 2.087739  |         1           0.91
2.615395, 2.095903  |         1           1.01
2.615395, 2.101604  |         1           0.44
2.615395, 2.139578  |         1           0.72
2.615395, 2.159512  |         1           0.67
2.615395, 2.17201   |         1           0.51
2.615395, 2.197958  |         1           0.36
2.615395, 2.23169   |         1           0.36
2.615395, 2.250336  |         1           1.33
2.615395, 2.283869  |         1           0.72
2.615395, 2.311141  |         1           1.55
2.615395, 2.323052  |         1           1.01
2.615395, 2.330915  |         1           0.44
2.615395, 2.382522  |         1           0.44
2.615395, 2.387113  |         1           1.55
2.615395, 2.467097  |         1           3.94
2.615395, 2.490558  |         1           0.36
2.615395, 2.491941  |         1           1.43
2.615395, 2.510615  |         1           0.36
2.615395, 2.528871  |         1           0.91
2.615395, 2.528927  |         1           1.33
2.615395, 2.530457  |         1           0.36
2.615395, 2.536876  |         1           1.43
2.615395, 2.540007  |         1           0.36
2.615395, 2.549971  |         1           0.36
2.615395, 2.554893  |         1           1.43
2.615395, 2.580355  |         1           1.10
2.615395, 2.582424  |         1           0.36
2.615395, 2.590365  |         1           1.73
2.615395, 2.59088   |         1           0.51
2.615395, 2.592843  |         1           0.86
2.615395, 2.593851  |         1           0.72
2.615395, 2.598941  |         1           0.57
2.615395, 2.604076  |         2           1.54
2.615395, 2.614428  |         1           1.01
2.615395, 2.626533  |         1           1.17
2.615395, 2.628308  |         1           1.17
2.615395, 2.631045  |         1           0.36
2.615395, 2.657254  |         1           1.01
2.615395, 2.659126  |         1           1.17
2.615395, 2.66637   |         1           1.33
2.615395, 2.682164  |         1           0.57
2.615395, 2.684939  |         1           1.33
2.615395, 2.685686  |         1           1.01
2.615395, 2.688699  |         1           1.55
2.615395, 2.701019  |         1           1.33
2.615395, 2.749445  |         1           0.10
2.615395, 2.749538  |         1           2.44
2.615395, 2.771516  |         1           1.92
2.615395, 2.780242  |         1           0.86
2.615395, 2.780775  |         1           0.36
2.615395, 2.785432  |         1           1.43
2.615395, 2.789459  |         1           0.86
2.615395, 2.79343   |         1           1.33
2.615395, 2.806674  |         1           0.72
2.615395, 2.853316  |         1           0.67
2.615395, 2.874986  |         1           1.84
2.615395, 2.898694  |         1           0.36
2.615395, 2.903088  |         1           0.67
2.615395, 2.903374  |         1           0.51
2.615395, 2.922246  |         1           2.06
2.615395, 2.929546  |         1           1.33
2.615395, 2.934033  |         1           3.44
2.615395, 2.93661   |         1           2.94
2.615395, 2.939783  |         1           1.84
2.615395, 2.966548  |         1           0.36
2.615395, 3.000586  |         1           1.43
2.615395, 3.010534  |         1           2.44
2.615395, 3.023006  |         1           0.57
2.615395, 3.029842  |         1           3.44
2.615395, 3.091012  |         0           3.44
2.615395, 3.093969  |         1           2.94
2.615395, 3.097596  |         1           2.44
2.615395, 3.102804  |         1           1.66
2.615395, 3.108545  |         1           2.94
2.615395, 3.11323   |         1           2.94
2.615395, 3.115846  |         0           3.94
2.615395, 3.189693  |         1           0.79
2.615395, 3.196986  |         0           3.44
2.615395, 3.247791  |         1           1.92
2.615395, 3.287424  |         1           1.10
2.615395, 3.306286  |         1           0.86
2.615395, 3.30682   |         1           0.51
2.615395, 3.308536  |         1           2.94
--------------------+-------------------------
Total               |       334         334.00

                         chi2(337) =    1205.98
                          Pr>chi2 =     0.0000

.   label var fBL_lnmedtime "Baseline Ln of median survival time "

.   label var fFM_lnmedtime "Full model Ln of median survival time"

. set more off

. set seed 10101

. str2d streg Irpenskiy Kyivskiy ///
>       agegrp mar2w1 ///
>        occ5w1  occ4w2 occ5w2  ///
>      deaw1 cataw1 ///
>      phlthw3 ///
>       icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///
>                           injothr   ///
>                       contw2   ///
>                WHPer BSIoc BSIanx HP2work neiw1 toxic  ///
>                 if gender==2, dist(weibull)

R^2 (explained variation - D method): Weibull regression

   Obs    Events     R^2       Std. err.  95% conf. interval    D     SE
--------------------------------------------------------------------------
 11328      182    0.409748    0.046800   0.313129  0.495570  1.705  0.165
--------------------------------------------------------------------------

.
.   *****   graph of the female baseline v female full model ln median survival times **********************
.  scatter fBL_lnmedtime _t || lowess fBL_lnmedtime _t || lowess fFM_lnmedtime _t, sort c(l) , legend(rows(3))  ///
>    title(Weibull Female baseline and Female full model) subtitle( natural log of median survival times among females)  ///
>    ytitle(Ln of median survival time) xtitle(Study time in years)

.    gr save fBLFMcf.gph, replace
(file fBLFMcf.gph saved)

.    gr export fBLFMcf.eps, replace
(file fBLFMcf.eps written in EPS format)

.
.  scalar exponentialfsc = exponentialfsc

.  scalar weibullfsc = weibullfsc

.  scalar lognormalfsc = lognormalfsc

.  scalar loglogisticfsc = loglogisticfsc

.  scalar gammafsc = gammafsc

.
.
.  ********* Female Weibull model R^2 and adj R^2 ***********************
.  title(Female Weibull model adjusted R square goodness of fit)


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                              (Female                                *****
*****                              Weibull                                *****
*****                               model                                 *****
*****                              adjusted                               *****
*****                                 R                                   *****
*****                               square                                *****
*****                              goodness                               *****
*****                                 of                                  *****
*****                                fit)                                 *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:45:29  *****
*******************************************************************************
*******************************************************************************


.
.
.  str2ph streg Irpenskiy Kyivskiy ///
>       age mar2w1 ///
>        occ5w1  occ4w2 occ5w2  ///
>      deaw1 cataw1 ///
>      phlthw3 ///
>       icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///
>                           injothr   ///
>                       contw2   ///
>                WHPer BSIoc BSIanx HP2work neiw1 toxic  ///
>                 if gender==2, adjust  dist(weibull) vce(cluster id)

R^2 (explained variation): Weibull regression

   Obs    Events   Adj. R^2    Boot. SE   95% conf. interval
------------------------------------------------------------
 11328      182    0.349605           .          .         .
------------------------------------------------------------

.
.  title(Female Weibull model adjusted R square)


*******************************************************************************
*******************************************************************************
*****                                                                     *****
*****                                                                     *****
*****                              (Female                                *****
*****                              Weibull                                *****
*****                               model                                 *****
*****                              adjusted                               *****
*****                                 R                                   *****
*****                              square)                                *****
*****                                                                     *****
*****                                                                     *****
*****                                             6 Mar 2012    05:45:30  *****
*******************************************************************************
*******************************************************************************


.
.
.  str2ph streg Irpenskiy Kyivskiy ///
>       age mar2w1 ///
>        occ5w1  occ4w2 occ5w2  ///
>      deaw1 cataw1 ///
>      phlthw3 ///
>       icdx3nr9 icdx4nr7 icdx4nr9 icdx5nr2 icdx5nr11 ///
>                           injothr   ///
>                       contw2   ///
>                WHPer BSIoc BSIanx HP2work neiw1 toxic  ///
>                 if gender==2,  dist(weibull) vce(cluster id)

R^2 (explained variation): Weibull regression

   Obs    Events     R^2       Boot. SE   95% conf. interval
------------------------------------------------------------
 11328      182    0.408923           .          .         .
------------------------------------------------------------

.
.
.
.
.
.
.
. matrix define SCmodCF2 = (exponentialfsc \ weibullfsc \ lognormalfsc \ loglogisticfsc \ gammafsc )

.  matrix rownames SCmodCF2 = expential weibull lognormal loglogistic  gamma

.  matrix colnames SCmodCF2 = sc

.  di "  "


.  di "Comparison by Schwartz Criterion"
Comparison by Schwartz Criterion

.  di "Female models:"
Female models:

.
. matlist SCmodCF

   | sc
-------------+-----------
exponential   |  445.6403
weibull   |  329.8542
lognormal   |  350.2855
loglogistic   |  334.5996

. matlist SCmodCF2

   | sc
-------------+-----------
expential   |  508.7954
weibull   |  352.1067
lognormal   |  382.0904
loglogistic   |  364.7076
gamma   |  292.8028

.
.
.
. // for males the weibull model is optimal
. // for females the weibull model is optimal
.
. save chsurviv1tran6mar2012, replace
file chsurviv1tran6mar2012.dta saved

.
.
. // list of 10 categories
. // 1 demosociogeo
. // 2 major neg life events
. // 3 stresses and hassles
. // 4 buffers and support
. // 5 slf perceived ills
. // 6 med diag
. // 7 hlth behaviors
. // 8 hlth scales
. // 9 riskawareness
. // 10 radChornooby matters
.
. scalar m1r2pf = m1r2pf

. scalar m2r2pf = m2r2pf

. scalar f7r2pf = f7r2pf

. forvalues i=1/10 {
  2. scalar f`i'r2pt = f`i'r2pt
  3. scalar m`i'r2pt = m`i'r2pt
  4. }

.
.
. forvalues i=1/9 {
  2. local j = `i' + 1
  3. scalar f`i'r2dt = f`i'r2dt
  4. scalar f`j'`i'r2dcha = f`j'`i'r2dcha
  5. }

.
. matrix define Mstgr2p = J(10,2,.)

. matrix define Fstgr2p = J(10,2,.)

.
.
.
.
. di c(current_date)
 6 Mar 2012

. di c(current_time)
05:45:31

. pwd
/Users/robertyaffee/Documents/data/research/chwk/phase3/survwk/docs/tex/stcox

. di c(filename)
chsurviv1tran6mar2012.dta

. di c(os)
MacOSX

. di c(osdtl)
10.6.8

. save chsurviv1trans6mar2012, replace
file chsurviv1trans6mar2012.dta saved

. translate StCoxReg1epi5mar2012.smcl StCoxReg1epi5mar2012.pdf, replace