Page 1 of 1

obtaining predicted probabilities for level 2 groups from multilevel logistic model

Posted: Mon Nov 18, 2019 1:43 pm
by becciaa1992
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!!

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

Posted: Wed Nov 20, 2019 3:30 pm
by ChrisCharlton
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.

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

Posted: Tue Dec 03, 2019 2:01 am
by becciaa1992
thank you so much!! :)