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

st: Re: Re: Predicted probabilities after xt commands


From   "Sophia Rabe-Hesketh" <[email protected]>
To   <[email protected]>
Subject   st: Re: Re: Predicted probabilities after xt commands
Date   Mon, 29 Sep 2003 08:28:13 +0100

> > 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.
>
(full thread below)

Scott's suggestion to use -predict- after
-xtlogit- with the 'pu0' option will give
you conditional predicted probabilities,
given that the random effect u = 0
(as the name of the 'pu0' option implies).
If the clusters in your data
are people as in longitudinal data,
these probabilities can be interpreted as the
probabilities of an 'average' person
(since 0 is the mean of the random effects
distribution) with given covariate values.

Unfortunately, this is not the
same as the average probability for
people with the same covariate values
as provided by -xtgee-. So if
you use -xtlogit- and and -xtgee-
for the same data and model (apart
from random part), you could get
quite different predicted probabilities.

In -gllapred- (prediction command for
-gllamm-) you can get the
average probability for given covariate
values, that is the probability
pr(y=1|u) integrated over the random effects
distribution, using the 'mu'
and 'marginal' options. (Here 'marginal' stands for
'population averaged' and should not
be confused with what -mfx- produces for logit models).
You can also get predicted probabilities
for different values of the random
intercept using the 'mu' and 'us(varname)'
options.

The paper
http://www.gllamm.org/epi5.pdf
(To be published in the Norwegian Journal
of Epidemiology) gives graphs of these different
types of predicted probabilities for
an example.

In -gllapred- you can also get the posterior mean
probability, where pr(y=1|u) is integrated
over the posterior distribution of u
given the observed responses for the person,
using the 'mu' option. Note that this is
better than substituting the predicted
value (posterior mean) of u into the
conditional probability (since this probability
is not linear in u).

Sophia

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