## obtaining predicted probabilities for level 2 groups from multilevel logistic model

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
becciaa1992
Posts: 14
Joined: Thu Oct 17, 2019 12:21 am

### obtaining predicted probabilities for level 2 groups from multilevel logistic model

Hello!

I am running a model in which I am looking at differences in odds of binge drinking (1=yes, 0=no) across 47 groups. I would like to obtain the predicted probabilities for these groups (not individual level probabilities). Here is my model:

Code: Select all

``````runmlwin binge cons, ///
level2(group: cons) ///
level1(idcode:) ///
discrete(distribution(binomial) link(logit) denominator(denominator) pql2) ///
rigls maxiterations(100) ///
nopause

runmlwin binge cons, ///
level2(group: cons, residuals(u, savechains("binge_null_u.dta", replace))) ///
level1(idcode:) ///
discrete(distribution(binomial) link(logit) denominator(denominator)) ///
mcmc(burnin(5000) chain(50000) thinning(50)) initsprevious ///
nopause
``````
I'm not sure exactly how to go about doing this, as most of the examples I find are predicting probabilities for level 1. Any help appreciated! Thanks!!

ChrisCharlton
Posts: 1182
Joined: Mon Oct 19, 2009 10:34 am

### Re: obtaining predicted probabilities for level 2 groups from multilevel logistic model

To do this you need to request the fixed-part prediction, add the group residuals and then apply the invlogit function, for example:

Code: Select all

``````predict predxb
generate predprob = invlogit(predxb + u0)
``````
You can find examples of this in the LEMMA chapter 7 replication materials on http://www.bristol.ac.uk/cmm/software/r ... /examples/. See the chapter in the LEMMA course (https://www.cmm.bris.ac.uk/lemma/) for the associated explanations.

becciaa1992
Posts: 14
Joined: Thu Oct 17, 2019 12:21 am

### Re: obtaining predicted probabilities for level 2 groups from multilevel logistic model

thank you so much!!