Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: RE: Command "margin" after Cox Regression


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: RE: Command "margin" after Cox Regression
Date   Wed, 26 Oct 2011 00:54:26 +0100

OK. Like my friend Kit Baum, I know to leave detailed advice on Cox models to others with expertise on the matter, but you have I guess now asked a question that can be answered. 

Nick 
[email protected] 


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Yuval Arbel
Sent: 26 October 2011 00:46
To: [email protected]
Subject: Re: st: RE: Command "margin" after Cox Regression

Here is the full output. As you can see below the "margins" command
works fine with predict(nohr)

. stcox max_red reductcurrent_max_reduct rent_net8 diff_stdmadadarea
permanentincomeestimate82 diff_mortgage apprec
> iation

         failure _d:  fail == 1
   analysis time _t:  time_index
                 id:  appt

Iteration 0:   log likelihood = -78368.249
Iteration 1:   log likelihood = -74893.557
Iteration 2:   log likelihood = -74745.467
Iteration 3:   log likelihood = -74741.532
Iteration 4:   log likelihood = -74741.525
Refining estimates:
Iteration 0:   log likelihood = -74741.525

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)      =   7253.45
Log likelihood  =   -74741.525                     Prob > chi2     =    0.0000

------------------------------------------------------------------------------
          _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     max_red |   1.212381   .0246749     9.46   0.000     1.164971    1.261721
red~x_reduct |   1.029251   .0004289    69.19   0.000     1.028411    1.030092
   rent_net8 |   1.002803   .0001637    17.15   0.000     1.002482    1.003124
diff_stdma~a |   .6171445   .0268682   -11.09   0.000     .5666681    .6721172
permanent~82 |   .9996092   .0000691    -5.65   0.000     .9994737    .9997446
diff_mortg~e |   .0015872   .0013976    -7.32   0.000     .0002825    .0089162
appreciation |   226.9143   728.9081     1.69   0.091      .418388    123067.8
------------------------------------------------------------------------------

. predict a1,basesurv
(8405 missing values generated)

. margins, at(max_red=10) atmeans predict(nohr)

Adjusted predictions                              Number of obs   =     499393
Model VCE    : OIM

Expression   : Relative hazard, predict(nohr)
at           : max_red         =          10
               red~x_reduct    =   -50.80334 (mean)
               rent_net8       =    60.38503 (mean)
               diff_stdma~a    =    .0350331 (mean)
               permanent~82    =    1107.979 (mean)
               diff_mortg~e    =   -.0005053 (mean)
               appreciation    =    .0015262 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _cons |   1.211275   .2644337     4.58   0.000     .6929946    1.729556
------------------------------------------------------------------------------

. margins, at(max_red=20) atmeans predict(basesurv)
prediction is a function of possibly stochastic quantities other than e(b)
r(498);


On Wed, Oct 26, 2011 at 1:38 AM, Nick Cox <[email protected]> wrote:
> The problem with -margins- is likely to be that you are asking a question that it cannot answer.
>
> So, people who know about this kind of thing will want to see what you typed before as your -stcox- command.
>
> Nick
> [email protected]
>
> Yuval Arbel
>
> I'm trying to run the following command after the Cox Regression:
>
> . margins, at(max_red=20) atmeans predict(basesurv)
>
> I'm getting the following error note:
>
> prediction is a function of possibly stochastic quantities other than e(b)
> r(498);
>
> On the other hand, when I'm running:
>
>  predict a1,basesurv
> (8405 missing values generated)
>
> The command works fine.
>
> My question is what is the problem with the command "margins"?
>
> *
> *   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, Israel
e-mail: [email protected]

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index