Announcement

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

  • Log-binomial mixed effect regression model

    Hi all,

    I am trying to create a Log binomial mixed effect regression model to calculate prevalence ratio instead of odds ratio.
    However the meglm does not work with the family(binomial) and link (log) function (https://bookdown.org/rwnahhas/RMPH/b...-binomial.html)
    Here is the code: meglm result ib3.quintile i.Sex age || district :, family(binary) link (log) eform and this is the message I get: link log is not allowed with family bernoulli r(198);
    When using the exact same glm command without a random effect everything works perfectly (https://stats.oarc.ucla.edu/stata/fa...ohort-studies/).
    The same topic is discussed here: https://www.statalist.org/forums/for...binomial-model
    Any help really appreciated!

    Thanks!

  • #2
    Your direct question is already answered in the last link posted (comment #2) -- -meglm- does not allow this family and link combination. In theory, it could, but it doesn't and that's a question for StataCorp.

    Two alternatives:

    1) use the package -gllamm- on SSC (-search describe gllamm-). I am not very familiar with this command, but it does allow the log-binomial mixed model to be fit. The command is older though and doesn't support factor variable notation, so this is one of those cases where the -xi: - prefix may be useful to you.

    Code:
    gllamm depvar indepvars , i(clustervar) fam(binomial) link(log)  // example syntax
    2) You can estimate the risk ratio using a log-poisson model directly with -mepoisson- (or -meglm-) using cluster-robust standard errors.

    Comment


    • #3
      Thank you for your prompt answer Leonardo,

      This command -> xi: gllamm result i.quintile, link(log) fam(binom) i(dist) eform works but I want to set as reference the quintile==3 (i.3.quintile), and it does not work with this option.
      I can't find any solution here -> https://www.stata.com/manuals/rxi.pdf
      Do you know maybe how can I do that?

      Thanks


      Comment


      • #4
        The factor variable notation syntax is incorrect (see -help fvvarlist-). It should be - ib3.quintile -.

        Comment


        • #5
          No, unfortunately ib3. does not work as well -> factor-variable and time-series operators not allowed r(101);

          Comment


          • #6
            Are you still using the -xi:- prefix? Because that error suggests you have not.

            Edit: on second check, -xi- doesn't support anything beyond -i.- notation. In that case, you'll need to make the factor variables yourself and omit the one that you wish to be the baseline level. Here's one way to do that using the built-in auto dataset as a toy dataset to demonstrate a technique.

            Code:
            sysuse auto, clear
            tab rep78, gen(irep)
            list rep78 irep? in 1/5
            Result

            [/code]
            +-----------------------------------------------+
            | rep78 irep1 irep2 irep3 irep4 irep5 |
            |-----------------------------------------------|
            1. | 3 0 0 1 0 0 |
            2. | 3 0 0 1 0 0 |
            3. | . . . . . . |
            4. | 3 0 0 1 0 0 |
            5. | 4 0 0 0 1 0 |
            +-----------------------------------------------+
            [/code]

            Then when you estimate the model, include all but the base level, which would be irep3 in this case.
            Last edited by Leonardo Guizzetti; 17 Mar 2023, 12:20.

            Comment


            • #7
              That was really helpful Leonardo.
              So the code:
              xi: gllamm result i.quin1 i.quin2 i.quin4 i.quin5, link(log) fam(binom) i(dist) eform
              has as reference the one exlcuded (i.quin3)?
              Thank you for your time

              Comment


              • #8
                Correct.

                Comment

                Working...
                X