UCLA Academic Technology Services HomeServicesClassesContactJobs
Help the Stat Consulting Group by giving a gift             
Loading

Stata Textbook Examples
Applied Survival Analysis by Hosmer and Lemeshow
Chapter 8: Parametric Regression Models

The data files used for the examples in this text can be downloaded in a zip file from the Wiley FTP website or the Stata Web site.  You can then use a program such as WinZip to unzip the data files.  If you need assistance getting data into Stata, please see our Stata Class Notes, especially the unit on Entering Data.  (NOTE:  The *.dat files are the data files, and the *.txt files contain the codebook information.)
use hmohiv, clear

stset time, failure(censor)
Table 8.1, page 278.
streg drug, dist(exp) time

Exponential regression -- accelerated failure-time form 

No. of subjects =          100                     Number of obs   =       100
No. of failures =           80
Time at risk    =         1136
                                                   LR chi2(1)      =     20.93
Log likelihood  =   -146.79209                     Prob > chi2     =    0.0000

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        drug |  -1.055687   .2238868    -4.72   0.000    -1.494497   -.6168771
       _cons |   3.023903   .1543033    19.60   0.000     2.721474    3.326332
------------------------------------------------------------------------------
Table 8.2, page 280.
streg age drug, dist(exp) time

Exponential regression -- accelerated failure-time form 

No. of subjects =          100                     Number of obs   =       100
No. of failures =           80
Time at risk    =         1136
                                                   LR chi2(2)      =     53.72
Log likelihood  =   -130.39708                     Prob > chi2     =    0.0000

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |  -.0920916   .0161799    -5.69   0.000    -.1238037   -.0603795
        drug |  -1.009856   .2239834    -4.51   0.000    -1.448855   -.5708561
       _cons |   6.151631   .6061974    10.15   0.000     4.963506    7.339756
------------------------------------------------------------------------------
Figure 8.1, page 282.
predict mgale, mgale
mat V = e(V)
generate l1 = -age*mgale
generate l2 = -drug*mgale
generate l3 = -1*mgale
mkmat l1 l2 l3, mat(L)
matrix DB = L*V
svmat DB, name(db)

graph twoway scatter db1 age
Figure 8.2, page 284.
graph box db2, over(drug)
Figure 8.3, page 285.
generate ld = l1*db1+l2*dbs+l3*db3
generate label = censor
graph twoway scatter ld mgale , mlabel(label) msymbol(i)
Table 8.4, page 293.
streg age drug, dist(weib) time

Weibull regression -- accelerated failure-time form 

No. of subjects =          100                     Number of obs   =       100
No. of failures =           80
Time at risk    =         1136
                                                   LR chi2(2)      =     52.05
Log likelihood  =   -128.50229                     Prob > chi2     =    0.0000

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |  -.0907665    .013616    -6.67   0.000    -.1174534   -.0640796
        drug |  -1.049168   .1889778    -5.55   0.000    -1.419558   -.6787786
       _cons |    6.14794   .5107206    12.04   0.000     5.146946    7.148934
-------------+----------------------------------------------------------------
       /ln_p |   .1750802   .0860646     2.03   0.042     .0063967    .3437637
-------------+----------------------------------------------------------------
           p |   1.191342   .1025323                      1.006417    1.410245
         1/p |   .8393897   .0722417                      .7090965    .9936237
------------------------------------------------------------------------------
Figure 8.5a, page 296.
drop mgale-ld
predict mgale, mgale
mat V = e(V)
generate l1 = -age*mgale
generate l2 = -drug*mgale
generate l3 = -1*mgale
generate l4 = -1*mgale
mkmat l1 l2 l3 l4, mat(L)
matrix DB = L*V
svmat DB, name(db)

graph twoway scatter db1 age
Figure 8.5b, page 296.
graph box db2, over(drug)
Table 8.5, page 302.
streg age drug, dist(llog) time

Log-logistic regression -- accelerated failure-time form 

No. of subjects =          100                     Number of obs   =       100
No. of failures =           80
Time at risk    =         1136
                                                   LR chi2(2)      =     39.07
Log likelihood  =   -129.10606                     Prob > chi2     =    0.0000

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |  -.0873809   .0154681    -5.65   0.000    -.1176979    -.057064
        drug |  -.8914631   .2135028    -4.18   0.000    -1.309921   -.4730054
       _cons |   5.539507   .5750993     9.63   0.000     4.412333    6.666681
-------------+----------------------------------------------------------------
     /ln_gam |  -.5305458   .0921406    -5.76   0.000     -.711138   -.3499535
-------------+----------------------------------------------------------------
       gamma |   .5882838   .0542048                       .491085    .7047208
------------------------------------------------------------------------------

How to cite this page

Report an error on this page or leave a comment

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.