Announcement

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

  • mlogit + margins + test

    Using Stata 15.1, I was wondering how I test for equality of the coefficients for the marginal effects.

    Example below.


    use http://www.stata-press.com/data/r13/sysdsn1
    mlogit insure age i.male i.nonwhite i.site
    test [Indemnity]age = [Prepaid]age

    margins, dydx(*) predict(outcome(Indemnity))
    margins, dydx(*) predict(outcome(Prepaid))
    How do I perform the equivalent test test [Indemnity]age = [Prepaid]age?

  • #2
    Hello,

    I would check out this paper:

    Mize, T.D., 2019. Best Practices for Estimating, Interpreting, and Presenting Nonlinear Interaction Effects. Sociological Science, 6, pp.81-117.

    Gives you a step by step guide and the author provides replication files to replicate his results in Stata.

    - Hale

    Comment


    • #3
      Maybe I am missing something, but the article only examines binary dependent variables. The problem arises here because the multionomial model estimates multiple regressions, while the margins command only estimates marginal effects one equation at the time.

      Comment


      • #4
        You can have calculate marginal effects for two outcomes simultaneously. In fact, you will need to. Also, you will need to have margins post the estimates (else you can't test). Last, the coefl option shows the coefficient legends in place of p-values and the like - you will probably need that option if you don't know the names of the coefficients (but who knows, you may know this stuff by heart).

        Code:
        margins, dydx(*) predict(outcome(Indemnity)) predict(outcome(Prepaid)) post coefl
        test _b[age:1bn._predict] =  _b[age:2._predict]
         ( 1)  [age]1bn._predict - [age]2._predict = 0
        
                   chi2(  1) =    3.69
                 Prob > chi2 =    0.0548
        Last, you'll get a slightly different output from testing the effect of age in the original model:

        Code:
        mlogit insure age i.male i.nonwhite i.site
        test [Indemnity]age = [Prepaid]age
         ( 1)  [Indemnity]o.age - [Prepaid]age = 0
        
                   chi2(  1) =    3.59
                 Prob > chi2 =    0.0580
        I believe that's because after the original multinomial logit model, we're testing that age has the same effect on the log odds scale. After margins, we're testing that age has the same effect on the probability scale. As usual, I could be wrong.
        Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

        When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

        Comment


        • #5
          Thanks so much, that solves it. ( I did not realize that one could calculate marginal effects for two outcomes simultaneously. )

          Comment


          • #6
            In addition, I would also look at the pwcomapre option under margins command
            Code:
            margins, dydx(age) pwcompare(effects)

            Comment


            • #7
              Thanks Oded.

              Comment

              Working...
              X