Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Yuval Arbel <yuval.arbel@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: stcox in case the ph-assumption is rejected |
Date | Sat, 7 Jan 2012 05:58:36 +0200 |
Thanks very much Alex, By scaling to hazard, it worked fine. I'm very satisfied with the results, which are robust to -stcox- and I incorporated an additional footnote in the paper draft. I'm generally familiar with the cubic-spline method, which allows time variations, but also permits well-defined derivatives at the knots. Here is the outputs: . doedit . do "D:\kingston\public_housing\robustness_PH_assumption.do" . clear . clear matrix . set memory 500m (512000k) . set matsize 800 . use "g:\public housing\test_sample_May_07_Bought.dta", clear . . . stpm2 mean_reduct reductcurrent_mean_reduct rent_net8 diff_stdmadadarea diff_mortgage permanentincomeestimate82 a > ppreciation,df(4) scale(hazard) note: delayed entry models are being fitted Iteration 0: log likelihood = -1512.9266 Iteration 1: log likelihood = -1378.564 Iteration 2: log likelihood = -1375.8226 Iteration 3: log likelihood = -1375.8201 Iteration 4: log likelihood = -1375.8201 Log likelihood = -1375.8201 Number of obs = 499393 ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- xb | mean_reduct | .0380149 .0005223 72.79 0.000 .0369912 .0390385 reductcurr.. | .0209263 .0004782 43.76 0.000 .019989 .0218637 rent_net8 | .0027275 .0001649 16.54 0.000 .0024043 .0030508 diff_stdma~a | -.2068624 .0283549 -7.30 0.000 -.262437 -.1512879 diff_mortg~e | -9.819042 .5364728 -18.30 0.000 -10.87051 -8.767574 permanent~82 | -.0005591 .0000685 -8.16 0.000 -.0006933 -.0004248 appreciation | 23.16299 2.165592 10.70 0.000 18.91851 27.40747 _rcs1 | 5.573527 .1047814 53.19 0.000 5.368159 5.778895 _rcs2 | 1.805992 .0491048 36.78 0.000 1.709749 1.902236 _rcs3 | -.34599 .0112847 -30.66 0.000 -.3681077 -.3238723 _rcs4 | -.076871 .0026999 -28.47 0.000 -.0821628 -.0715792 _cons | -5.34359 .1040326 -51.36 0.000 -5.54749 -5.13969 ------------------------------------------------------------------------------ . test mean_reduct==reductcurrent_mean_reduct ( 1) [xb]mean_reduct - [xb]reductcurrent_mean_reduct = 0 chi2( 1) = 947.55 Prob > chi2 = 0.0000 . stcox mean_reduct reductcurrent_mean_reduct rent_net8 diff_stdmadadarea permanentincomeestimate82 diff_mortgage a > ppreciation,nohr failure _d: fail == 1 analysis time _t: time_index id: appt Iteration 0: log likelihood = -78368.249 Iteration 1: log likelihood = -74721.874 Iteration 2: log likelihood = -74566.501 Iteration 3: log likelihood = -74561.567 Iteration 4: log likelihood = -74561.555 Refining estimates: Iteration 0: log likelihood = -74561.555 Cox regression -- Breslow method for ties No. of subjects = 9547 Number of obs = 499393 No. of failures = 9547 Time at risk = 547035 LR chi2(7) = 7613.39 Log likelihood = -74561.555 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ _t | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- mean_reduct | .0353358 .0005278 66.94 0.000 .0343012 .0363703 reductcurr.. | .0221957 .0005134 43.23 0.000 .0211894 .0232019 rent_net8 | .0025506 .0001655 15.41 0.000 .0022263 .0028749 diff_stdma~a | -.4642809 .0446886 -10.39 0.000 -.5518688 -.3766929 permanent~82 | -.0004675 .0000689 -6.79 0.000 -.0006025 -.0003325 diff_mortg~e | -6.430141 .8913818 -7.21 0.000 -8.177217 -4.683064 appreciation | 9.629971 3.161657 3.05 0.002 3.433237 15.8267 ------------------------------------------------------------------------------ . test mean_reduct==reductcurrent_mean_reduct ( 1) mean_reduct - reductcurrent_mean_reduct = 0 chi2( 1) = 450.86 Prob > chi2 = 0.0000 . estat phtest,detail Test of proportional-hazards assumption Time: Time ---------------------------------------------------------------- | rho chi2 df Prob>chi2 ------------+--------------------------------------------------- mean_reduct | -0.18814 220.31 1 0.0000 reductcurr..| -0.21984 436.16 1 0.0000 rent_net8 | -0.03327 10.10 1 0.0015 diff_stdma~a| 0.03801 0.38 1 0.5357 permanent~82| -0.01174 1.35 1 0.2459 diff_mortg~e| 0.21517 10.31 1 0.0013 appreciation| -0.05323 11.87 1 0.0006 ------------+--------------------------------------------------- global test | 543.71 7 0.0000 ---------------------------------------------------------------- On Fri, Jan 6, 2012 at 11:46 PM, Alex Gamma <alex.gamma@uzh.ch> wrote: > Yuval, > > provided that you -stset- your data correctly (i.e. as containing delyed entries), stpm2 obviously requires you to specifiy the scale option in order to estimate such models. Apart from the command's help-file, there is also a paper from The Stata Journal that explains the use of stpm2 in detail. > > Paul C. Lambert & Patrick Royston > Further development of flexible parametric models for survival analysis > The Stata Journal (2009) 9, Number 2, pp. 265–290 > > Alex > > > >> Thanks, that sounds great. >> >> I tried this and got the following error command: >> >> . stpm2 mean_reduct reductcurrent_mean_reduct rent_net8 >> diff_stdmadadarea diff_mortgage permanentincomeestimate82 a >>> ppreciation,df(4) >> note: delayed entry models are being fitted >> The scale must be specified >> >> Note that in my sample - tenants start to exercise at t=13. Is this >> fact has something to do with this error message? >> >> On Fri, Jan 6, 2012 at 5:14 PM, Alex Gamma <alex.gamma@uzh.ch> wrote: >>> Hi Yuval, >>> >>> I prefer the user-written command STPM2 for these kinds of situation. It makes it easy to model variables that violate the PH-assumption as time-dependent effects using cubic splines. >>> >>> - ssc describe stpm2 - >>> - ssc install stpm2 - >>> >>> Alex >>> >>> >>> Am 06.01.2012 um 09:06 schrieb Yuval Arbel: >>> >>>> Dear Statalist Participants, >>>> >>>> I'm working with stata 11.2. Having read carefully stata's manual >>>> under the title "stcox PH-assumption tests" I have two questions >>>> (which seems to be relevant to Marteen's answer in another thread): >>>> >>>> The manual shows very nicely the following situation related to >>>> medical experiments: if we take two groups of cancer patients, where >>>> one group is exposed to a standard treatment and the other to a >>>> special treatment - and we would like to show that the experimental >>>> treatment is more efficient, we anticipate a paralel upward shift of >>>> the projected survival rates compared to the actual ones. If this is >>>> the case - the PH-assumption, namely the assumption that the hazard to >>>> survival is constant over the sample period, is supported >>>> statistically. >>>> >>>> My first question is whether this discussion is relevant if I am >>>> applying the Cox model to describe the exercise of call (real) options >>>> to purchase appartments. >>>> >>>> My second question is the following: suppose that the PH-assumption >>>> does not hold in the sample and the above discussion is relevant. The >>>> stata manual says the following: "If the assumption fails, alternative >>>> modeling choices would be more appropriate (e.g. , a stratified Cox >>>> model, time-varying covariates)." >>>> >>>> The question is: is there any command to incorporate the -stcox- with >>>> varying hazard level across time? I'm aware of the -strata()- option, >>>> but I wonder whether I can somehow account for time-varying covariates >>>> and incorporate it with -stcox- >>>> >>>> -- >>>> Dr. Yuval Arbel >>>> School of Business >>>> Carmel Academic Center >>>> 4 Shaar Palmer Street, >>>> Haifa 33031, Israel >>>> e-mail1: yuval.arbel@carmel.ac.il >>>> e-mail2: yuval.arbel@gmail.com >>>> * >>>> * 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/ >>> >>> >>> * >>> * 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/ >> >> >> >> -- >> Dr. Yuval Arbel >> School of Business >> Carmel Academic Center >> 4 Shaar Palmer Street, >> Haifa 33031, Israel >> e-mail1: yuval.arbel@carmel.ac.il >> e-mail2: yuval.arbel@gmail.com >> >> * >> * 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/ > > > * > * 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/ -- Dr. Yuval Arbel School of Business Carmel Academic Center 4 Shaar Palmer Street, Haifa 33031, Israel e-mail1: yuval.arbel@carmel.ac.il e-mail2: yuval.arbel@gmail.com * * 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/