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

# Re: st: Predicted GLLAMM probs don't check out

 From Stas Kolenikov To statalist@hsphsun2.harvard.edu Subject Re: st: Predicted GLLAMM probs don't check out Date Thu, 17 May 2012 23:08:52 -0400

```I think what you see is the effect of Jensen's inequality. The
probabilities that you generate by hand are f( E[x] ), and the
probabilities that -gllamm- gives you are E[ f(x) ], x being the
unobserved random effect.

On Thu, May 17, 2012 at 8:17 PM, David Crow <david.crow@cide.edu> wrote:
> Dear All-
>
> I'm having a slight problem with predicted probabilities in GLLAMM:  the
> probabilities predicted after estimation with the "mu" option don't equal
> the probabilities obtained by suitable transformations of the score function
> obtained with the "linpred" option.
>
> First, I estimate the following multi-level logit model:
>
> gllamm amlo pri pan prd news wave, i(folio) family(binomial) link(logit)
> trace
>
> Then, I obtain the linear predictor (with random effects) and predicted
> probabilities with:
>
> gllapred pr1, mu
> gllapred lp1, linpred
>
> As a check, I estimate probabilities by the inverse logit transformation of
> the score function (linear predictor including random effects):
>
> gen p1 = exp(lp1) / (1+exp(lp1))
>
> The problem is that the probabilities obtained with the inverse logit (p1)
> don't match the probabilities predicted directly by gllapred (pr1).
>
> list amlo pr1 p1
>
> pr1 p1 1 .278 .204
> 2 .006 .001
> 3 .003 .001
> 4 .240 .157
>
> &c.
>
> To check that the score functions are OK, I recovered the linear predictor
> without random effects (using the "xb" option) and the random effects (using
> the "u" option) and added the two:
>
> gllapred xb1, xb
> gllapred re1, u
> gen linpred1 = xb1+re1m1
>
> This does check out (i.e., linpred1 = lp1).
>
> The same problem obtains with predicted probabilities for probit models
> using gllamm.  First, I estimate the same model as above with the probit
>
> gllamm amlo pri pan prd news wave, i(folio) family(binomial) link(probit)
> trace
>
> Also as above, I use the "mu" and "linpred" options to recover the predicted
> probabilities and score function (linear predictor including random
> effects).
>
> gllapred pr2, mu
> gllapred lp2, linpred
>
> Then, I carry out the inverse probit transformation on the linear predictor
> to check these probabilities against those predicted with "mu".
>
> gen p2 = normal(lp2)
>
> Again, though, the probabilities don't match up:
>
> list amlo pr2 p2 in 1/10
>
> pr2 p2
> 1 .289 .226
> 2 .005 .000
> 3 .002 .000
> 4 .247 .175
>
> Any idea why the probabilities differ from each other?  Which of the two
> probabilities should I believe, or should I believe neither?
>
> Many thanks,
> David
>
>
>
>
>
> --
> Web site for México, las Américas y el Mundo:
> http://mexicoyelmundo.cide.edu/
>
> ====================================
> David Crow, Ph.D.
> División de Estudios Internacionales
> Carretera México-Toluca 3655
> Col. Lomas de Santa Fe 01210  México, D.F.
> Tel.:  5727-9800, ext. 2152
> Fax:  5727-9872
> ====================================
>
>
> *
> *   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/

--
---- Stas Kolenikov
-- http://stas.kolenikov.name
---- Senior Survey Statistician, Abt SRBI
-- Opinions stated in this email are mine only, and do not reflect the
position of my employer

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