Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: margins command after stcox to predict adjusted survival function


From   "Weichle, Thomas" <Thomas.Weichle@va.gov>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: margins command after stcox to predict adjusted survival function
Date   Wed, 22 Jun 2011 10:18:10 -0500

Hi Statalisters,
I'd like to use the -margins- command for predicting the adjusted
survival function.  Using -margins- as post estimation to -stcox- will
produce the relative hazard as the default (predict(hr)).  However,
after running -stcox- and predicting the baseline survival function, it
appears as if I can use -margins- with the expression() option to
produce the adjusted survival since S(t) = [S0(t)]^exp(xb).  I would
like to know if this conceptually makes sense.

stcox c_dx_age black i.married i.chrlson_grp_6mp_dx surgery_tvc
i.va_outpt_dist_tertile ///
	  outpt_event_q4 i.dual2_cc_claims_2 hs_edu10 ib4.region
i.grade2 if stage_ajcc5 == "I", nolog

predict double S0, basesurv

margins i.dual2_cc_claims_2, expression(S0^exp(predict(xb))) post

------------------------------------------------------------------------
------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------
------
dual2_cc_c~2 |
          0  |   .8873086    .032696    27.14   0.000     .8232256
.9513915
          1  |   .8370149   .0467662    17.90   0.000     .7453547
.928675
------------------------------------------------------------------------
------

These predicted margins for the 2 levels of dual2 appear to be the
adjusted average survival probabilities.

On a side note, suppose I run the same -stcox- model and then run
-stcurve, survival- for each level of dual2.  If I take the average of
the survival probabilities for each of 2 levels of dual2 produced from
-stcurve-, this is identical to what -margins- would have produced if I
used the atmeans options.  

stcurve, survival at1(dual2_cc_claims_2=0) at2(dual2_cc_claims_2=1)

margins i.dual2_cc_claims_2, expression(S0^exp(predict(xb))) atmeans
post

This makes sense because the -stcurve- command evaluates the function by
setting each covariate to its mean value.  And this is exactly what is
being done when I specify the atmeans option for the -margins- command.

Tom Weichle
Math Statistician
Center for Management of Complex Chronic Care (CMC3)
Hines VA Hospital, Bldg 1, C202
708-202-8387 ext. 24261
Thomas.Weichle@va.gov 

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index