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]

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


From   Yuval Arbel <yuval.arbel@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Command "margin" after Cox Regression
Date   Wed, 26 Oct 2011 01:46:05 +0200

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 <n.j.cox@durham.ac.uk> 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
> n.j.cox@durham.ac.uk
>
> 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: 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/


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