Announcement

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

  • Attributable percentage variability/ Proportion variance explained in a multilevel, random intercept logistic regression model

    Hi, I am trying to find the attributable percentage variability or the proportion of the variance explained by the multilevel logistic regression model. My outcome is in-hospital mortality, and I have both patient and hospital level predictor variables.

    I should probably start by saying I am just a plain MD and not that stat-savvy. I also understand this is not as easy as it is in a multilevel linear regression model with R2.

    The following article: https://onlinelibrary.wiley.com/doi/...m7336-bib-0001 (Section 4.8), as well as the measure by Snijders and Bosker (2012) seems to be on-track with what I am looking for.

    My current model is as follows:

    melogit mortality age i.sex i.race i.elixsum i.cancer_type i.year hospitalvolume teachinghospital cancerprogram FTE_bed SVI i.insurance totaltime || hospital id:


    The method in section 4.8 requires me to calculate the following:

    A - sample variance of the fixed effects linear predictor

    B - variance of the random intercept from the fitted multilevel logistic regression model

    and also know that the level-one residual variance is fixed at π2/3

    Then it says the R2 binary = A / A+B+π2/3.

    I would highly appreciate if anyone knows what would be the code to calculate this.

    Right now, I am assuming that B is the var(_cons) from the model under the random effects portion, and that to calculate A, I need to first do predict x, xb and then sum x, detail and manually look at the variance from there. Finally, I should then manually calculate using the formula.

    Is this the correct way to do this?

    Alternartively,

    https://web.pdx.edu/~newsomj/mlrclass/ho_r2.pdf

    This article by Newson states the best method citing same folks: Snijders and Bosker (1999) is to

    use σ2 as the within-group variance and τ2 as the between group (or intercept) variance.

    And then divide the sum of both for the full model from the null model, followed by subtracting answer from 1 to get the R2 for the predictor variables at level one. For level 2 variance, the σ2 in both full and null models needs to first be divided by B which is the average cluster size in the notation used by Roberts and colleagues. Then its same steps.

    I am intensely confused on how to calculate any of this, and what the correct Stata code would be.

    The end-goal is to get the various contributions of different groups of predictors for in-hospital mortality similar to this study: https://pubmed.ncbi.nlm.nih.gov/36994756/.

    Thank you!
    Last edited by Musaab Munir; 07 Aug 2023, 22:03.

  • #2
    Cross-posted at https://www.reddit.com/r/stata/comme...or_proportion/

    Comment


    • #3
      Yes, I posted there too. Is that against forum rules?

      Comment


      • #4
        no, it is not against forum rules; however, the FAQ asks that you tell us you did that so that people can check whether there is already an answer rather than wasting their time duplicating what someone else already did; so, please read the FAQ

        Comment


        • #5
          Ah, I understand now. Thanks so much!

          Still having trouble figuring this out. And will of course update post as soon as I get a reply on either forum.

          Comment


          • #6
            Hi everyone, just following up on this. If anyone has any idea what the best method to calculate this would be. Thanks!

            Comment

            Working...
            X