Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Prediction for second level after melogit

    Dear all,
    imagine this scenario: we have multilevel data where students are nested within schools. The outcome is a binary one, that indicates whether a student has failed the test or not. I would like to measure whether schools differ in their average success rates. However, I would like to adjust for factors, such as student composition or student IQ so the comparison of schools is "fair". My basic model looks like this:
    Code:
    melogit fail $controls || schoolid:
    Now I would like to compute the average and adjusted failure rate by school. One way is potentially like this:
    Code:
    predict adrate, reffects
    However, the resulting BLUP is a normally distributed score with mean 0. Is there a way to transform this into a share between 0 and 1? Or is there a better way to do this?

    EDIT:
    As an alternative, what about
    Code:
    predict pred, mu
    collapse pred, by(schoolid)
    Last edited by Felix Bittmann; 01 Mar 2025, 06:27.
    Best wishes

    (Stata 16.1 MP)

  • #2
    I would use the code with -predict, mu- and -collapse- that you show. These predicted scores fully account for the covariates, and are calculated as if the joint covariate distribution of the entire estimation sample prevailed in each school.

    The BLUPs of the random effects are estimates of the school-specific effects after removing the effects of the modeled covariates. These can also be of interest in their own right, but I don't know of any clear way to put them into a probability metric. I suppose one could first calculate the overall pass probability for the estimation sample, and convert that to log-odds, add that log-odds to each of the BLUPs, and then apply -invlogit()- to that. Those would be numbers on a zero to one scale that might be plausibly construed as some kind of adjusted estimate of the school-specific pass probability, but if push came to shove, I would have difficulty interpreting them concretely. And I've never seen anybody actually do that. The typical application of the random effect BLUPS that I have seen is making caterpillar plots to show the relative ranking of the school-specific effects with modeled covariate effects removed.

    Comment


    • #3
      Originally posted by Felix Bittmann View Post
      Code:
      predict pred, mu
      collapse pred, by(schoolid)
      You can obtain these averages more easily using margins.

      Code:
      margins, predict(mu conditional) over(schoolid) nose

      Comment

      Working...
      X