Announcement

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

  • Comparing two regressions with a likelihood ratio test

    Dear all,

    I want to test the hypothesis that all coefficients are the same across two equations of two subsamples using a likelihood ratio test.
    So it's not a default test to choose the "best" model between two nested models.
    Do you have any ideas how to run this test?

    Thanks for your support.
    Max

  • #2
    Max:
    welcome to this forum .
    You may want to take a look at -help suest- and/or -help sureg-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      You can also set this up using interaction effects. See

      https://www3.nd.edu/~rwilliam/stats2/l51.pdf

      When you think about "all" coefficients think about whether that includes the constants too. It is more common to let them differ across groups.
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      StataNow Version: 19.5 MP (2 processor)

      EMAIL: [email protected]
      WWW: https://www3.nd.edu/~rwilliam

      Comment


      • #4
        Thanks for your help!
        Unfortunately I must use the likelihood ratio test. But I don't know how to run it with my specification as stated above...

        Comment


        • #5
          You can use an LR test when using the interactions approach:

          Code:
          webuse nhanes2f, clear
          regress health i.female c.weight c.height
          est store m1
          regress health i.female##(c.weight c.height)
          est store m2
          lrtest m1 m2, stats
          Last part of output:

          Code:
          . lrtest m1 m2, stats
          
          Likelihood-ratio test                                 LR chi2(2)  =     42.18
          (Assumption: m1 nested in m2)                         Prob > chi2 =    0.0000
          
          Akaike's information criterion and Bayesian information criterion
          
          -----------------------------------------------------------------------------
                 Model |        Obs  ll(null)  ll(model)      df         AIC        BIC
          -------------+---------------------------------------------------------------
                    m1 |     10,335 -16601.75  -16355.54       4    32719.07   32748.05
                    m2 |     10,335 -16601.75  -16334.45       6    32680.89   32724.35
          -----------------------------------------------------------------------------
                         Note: N=Obs used in calculating BIC; see [R] BIC note.
          Note that I allowed females and males to have different constant terms. If you want to run a baseline model where the constants for the two groups are equal too, then just drop i.female from the first regression.

          I used regress here, but you could use logit or probit or several other commands where a lrtest is appropriate.

          As Carlo notes, there are other approaches. I like using interactions because I can adopt an intermediate position, e.g. allow for interactions with some variables but not others.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 19.5 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://www3.nd.edu/~rwilliam

          Comment


          • #6
            Hello, i am trying to compare two multivariate regression models, the difference therefore from the above model is that there are more than one y variable, and i use the mvreg command to estimate the models, unfortunately, when i run the lrtest after storing the regression results, it keeps returning the error "xxxx does not contain scalar e(ll)". Does that mean that the mvreg command does not store log likelihood? but how is it that the regress command works with lrtest and the mvreg does not.. is there a multivariate regression version of the lrtest command? i will appreciate any advice

            Comment


            • #7
              Hi Ghazal. It is usually better to start a new thread rather than revive a very old one.

              If you type

              help mvreg

              you see that it does not return e(ll).

              What exactly is it you want to do? Showing code and output could add clarity to your question.

              You might see if sureg will do what you want. It does return e(ll).
              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              StataNow Version: 19.5 MP (2 processor)

              EMAIL: [email protected]
              WWW: https://www3.nd.edu/~rwilliam

              Comment


              • #8
                Originally posted by Richard Williams View Post
                You can use an LR test when using the interactions approach:

                Code:
                webuse nhanes2f, clear
                regress health i.female c.weight c.height
                est store m1
                regress health i.female##(c.weight c.height)
                est store m2
                lrtest m1 m2, stats
                Last part of output:

                Code:
                . lrtest m1 m2, stats
                
                Likelihood-ratio test LR chi2(2) = 42.18
                (Assumption: m1 nested in m2) Prob > chi2 = 0.0000
                
                Akaike's information criterion and Bayesian information criterion
                
                -----------------------------------------------------------------------------
                Model | Obs ll(null) ll(model) df AIC BIC
                -------------+---------------------------------------------------------------
                m1 | 10,335 -16601.75 -16355.54 4 32719.07 32748.05
                m2 | 10,335 -16601.75 -16334.45 6 32680.89 32724.35
                -----------------------------------------------------------------------------
                Note: N=Obs used in calculating BIC; see [R] BIC note.
                Note that I allowed females and males to have different constant terms. If you want to run a baseline model where the constants for the two groups are equal too, then just drop i.female from the first regression.

                I used regress here, but you could use logit or probit or several other commands where a lrtest is appropriate.

                As Carlo notes, there are other approaches. I like using interactions because I can adopt an intermediate position, e.g. allow for interactions with some variables but not others.
                Where is the value of chi2(2) = 42.18 from? Can you explain?
                Thank you!

                Comment


                • #9
                  Code:
                  . // LR chi2(2) = change in -2LL
                  . display -2*(-16355.54 - (-16334.45))
                  42.18
                  --
                  Bruce Weaver
                  Email: [email protected]
                  Version: Stata/MP 18.5 (Windows)

                  Comment

                  Working...
                  X