Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Predicted probabilities after xt commands


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: Re: Predicted probabilities after xt commands
Date   Sun, 28 Sep 2003 18:52:42 -0500

----- Original Message ----- 
From: "Daniel, Gregory" <[email protected]>
To: <[email protected]>
Sent: Thursday, September 25, 2003 9:09 AM
Subject: st: Predicted probabilities after xt commands


> Dear Statalist:
>
> Does anyone know how to obtain predicted probabilities, while holding
> covariates constant at their means (or specified values), after -xtlogit- or
> -xtgee-?  I am aware that -prvalue- and -adjust- work for glm and logistic
> commands, but these do not work for xt commands.
>
> Thanks,
>
> Greg Daniel

You could change the value of the covariates to their means and then use
predict.

Example:

. use http://www.stata-press.com/data/r8/union.dta
(NLS Women 14-24 in 1968)

. xtlogit union age, i(id) nolog

Random-effects logistic regression              Number of obs      =     26200
Group variable (i): idcode                      Number of groups   =      4434

Random effects u_i ~ Gaussian                   Obs per group: min =         1
                                                               avg =       5.9
                                                               max =        12

                                                Wald chi2(1)       =     26.09
Log likelihood  = -10659.783                    Prob > chi2        =    0.0000

------------------------------------------------------------------------------
       union |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .0183831   .0035993     5.11   0.000     .0113286    .0254377
       _cons |   -2.91907   .1216329   -24.00   0.000    -3.157466   -2.680674
-------------+----------------------------------------------------------------
    /lnsig2u |   1.725365   .0423218                      1.642415    1.808314
-------------+----------------------------------------------------------------
     sigma_u |   2.369508   .0501409                      2.273244    2.469849
         rho |    .630536   .0098593                       .611012    .6496421
------------------------------------------------------------------------------
Likelihood-ratio test of rho=0: chibar2(01) =  6382.86 Prob >= chibar2 = 0.000

. preserve

. egen mean = mean(age)

. replace age = mean
age was byte now float
(26200 real changes made)

. predict prob, pu0

. tab prob

 Pr(union=1 |
   assuming |
     u_i=0) |      Freq.     Percent        Cum.
------------+-----------------------------------
   .0863033 |     26,200      100.00      100.00
------------+-----------------------------------
      Total |     26,200      100.00

. restore


Hope this helps,
Scott


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index