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

# st: Predicted GLLAMM probs don't check out

 From David Crow To statalist@hsphsun2.harvard.edu Subject st: Predicted GLLAMM probs don't check out Date Thu, 17 May 2012 19:17:40 -0500

```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
====================================