Announcement

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

  • Omitted interaction when running an interaction between a dummy and ordinal variable?

    I am trying to run an interaction between a dummy variable and an ordinal variable. My model is a logit model using imputed data. My outcome is whether an individual is vaccinated and I am attempting to interact gender with my categories of children's education (HS, some coll, college). When doing this, I am getting an omitted message between college and male. Am I approaching this correctly? How should I interpret? I will post code and output below.


    Code:
    
    . mi estimate, or: logit vaccinated ib1.marstat ib0.cenreg work fathereduc mothereduc proxy insurance masks_toomuch wealthquint1 incquint1 numchild h14hhres age ib0.race_rc male native ib0.reducc
    > at ib0.keducat i.keducat#i.male
    
    Multiple-imputation estimates                   Imputations       =         20
    Logistic regression                             Number of obs     =      5,046
                                                    Average RVI       =     0.0712
                                                    Largest FMI       =     0.1881
    DF adjustment:   Large sample                   DF:     min       =     554.12
                                                            avg       =  71,761.12
                                                            max       = 560,975.20
    Model F test:       Equal FMI                   F(  28,111711.1)  =      14.89
    Within VCE type:          OIM                   Prob > F          =     0.0000
    
    --------------------------------------------------------------------------------
        vaccinated | Odds ratio   Std. err.      t    P>|t|     [95% conf. interval]
    ---------------+----------------------------------------------------------------
           marstat |
      Sep/Divorce  |   .7314097   .1008673    -2.27   0.024     .5579604    .9587781
          Widowed  |   .5315095   .0732813    -4.58   0.000     .4055375    .6966121
    Never-married  |   .9119755   .2498579    -0.34   0.737     .5327306    1.561201
                   |
            cenreg |
               MW  |   .6561701   .1166578    -2.37   0.018      .462966    .9300019
            South  |   .4806131   .0776807    -4.53   0.000     .3500744    .6598283
             West  |   .5382269   .0963002    -3.46   0.001     .3789676    .7644143
                   |
              work |   .9366151   .1058961    -0.58   0.563     .7503633    1.169097
        fathereduc |   1.071622   .1244409     0.60   0.552     .8530614    1.346179
        mothereduc |   .8654069   .0991871    -1.26   0.207     .6911336    1.083624
             proxy |   .2891461   .0821624    -4.37   0.000     .1656366    .5047523
         insurance |   1.398812   .2958103     1.59   0.113     .9238674    2.117916
     masks_toomuch |   .2834234   .0273408   -13.07   0.000     .2345952    .3424148
      wealthquint1 |   1.139352   .0491243     3.03   0.003     1.046985    1.239869
         incquint1 |   1.145747   .0540985     2.88   0.004     1.044367    1.256969
          numchild |   .9371028   .0241185    -2.52   0.012     .8909529    .9856432
          h14hhres |   .9064267   .0343786    -2.59   0.010     .8414116    .9764654
               age |   1.038912   .0065344     6.07   0.000     1.026182      1.0518
                   |
           race_rc |
         NH-Black  |   1.667032   .2220494     3.84   0.000      1.28398     2.16436
         NH-Other  |   .7652104   .1793093    -1.14   0.253      .483416    1.211269
         Hispanic  |   2.259254   .4262379     4.32   0.000     1.560886    3.270086
                   |
              male |   1.295837   .1798121     1.87   0.062     .9872696    1.700847
            native |   .5900628   .1096254    -2.84   0.005     .4099735      .84926
                   |
          reduccat |
         Some Col  |    1.00394   .1081249     0.04   0.971       .81289    1.239893
             Col+  |   1.361508   .1833292     2.29   0.022     1.045684     1.77272
                   |
           keducat |
         Some Col  |   1.164764   .1783095     1.00   0.319     .8628384    1.572339
             Col+  |   1.610022   .2376787     3.23   0.001      1.20551    2.150269
                   |
      keducat#male |
             HS#1  |   1.030919   .2481174     0.13   0.899     .6432211    1.652299
       Some Col#1  |   .6345009   .1335919    -2.16   0.031     .4199657    .9586292
           Col+#1  |          1  (omitted)
                   |
             _cons |   .5801448   .3355199    -0.94   0.347     .1867077    1.802647
    --------------------------------------------------------------------------------
    Note: _cons estimates baseline odds.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte(vaccinated marstat cenreg work fathereduc mothereduc proxy insurance masks_toomuch wealthquint1 incquint1 numchild h14hhres) float(age race_rc) byte male double(native reduccat) byte keducat
    1 2 0 0 0 0 0 1 0 5 5 2 2 75 0 0 1 0 2
    1 2 0 0 0 1 0 1 0 5 1 1 1 74 0 0 1 1 2
    1 1 0 0 1 1 0 1 0 5 3 2 2 85 0 1 1 2 2
    1 1 0 0 1 0 0 1 0 5 3 2 2 78 0 0 1 2 2
    1 1 0 0 1 1 0 1 0 5 5 3 2 86 0 0 1 2 2
    1 4 0 0 . . 0 1 0 1 1 2 1 86 1 0 1 0 1
    0 3 0 0 1 1 0 1 0 4 2 3 5 82 0 0 0 0 1
    1 1 3 0 1 0 0 1 1 4 4 3 2 83 2 0 0 2 2
    1 1 3 0 0 0 0 1 0 4 4 3 2 81 2 1 0 2 2
    1 1 3 0 0 0 0 1 0 4 4 1 2 81 0 1 1 2 2
    1 1 3 0 1 1 0 1 0 4 4 1 2 81 0 0 1 2 2
    1 3 0 0 0 0 0 1 0 3 2 4 1 81 1 0 0 0 2
    1 3 2 1 . 0 0 1 0 1 2 5 4 74 1 0 1 0 1
    1 1 3 0 0 1 0 1 0 4 1 . 2 83 3 1 1 1 1
    1 1 3 0 1 1 0 1 0 4 1 . 2 72 0 0 1 1 1
    1 1 3 0 0 1 0 1 1 4 5 4 6 85 0 1 1 0 2
    1 1 3 1 1 1 0 1 0 4 5 4 6 80 0 0 1 2 2
    1 1 3 0 1 1 0 1 1 5 5 5 2 89 0 1 0 2 2
    0 4 3 1 0 0 0 1 0 1 1 1 1 82 1 0 1 0 0
    1 3 2 0 0 1 0 1 0 3 2 3 2 82 0 0 1 0 1
    1 2 1 0 0 0 0 1 0 3 1 2 1 81 0 0 0 0 2
    1 3 1 0 0 1 0 1 0 5 1 4 1 87 0 0 1 0 2
    0 . . . 1 0 . . 0 . . . . 84 0 0 1 0 1
    1 3 1 1 1 1 0 1 0 5 4 5 2 81 0 1 1 2 2
    0 3 1 0 0 0 1 1 0 4 4 3 5 91 0 0 1 2 2
    1 3 1 0 0 0 0 1 0 3 2 4 2 90 0 0 1 1 1
    1 1 3 1 0 0 0 1 0 3 5 4 2 87 1 1 1 1 2
    1 1 . . . 0 . . 0 . . . . 65 1 0 1 1 2
    1 1 2 0 1 1 0 1 0 2 3 3 2 84 0 1 1 0 2
    1 3 2 0 . . 0 1 0 1 2 5 1 80 0 0 1 0 1
    1 1 1 0 1 0 0 1 0 4 4 4 2 89 0 0 1 2 2
    1 3 1 0 0 1 0 1 0 1 2 8 1 85 1 0 1 1 2
    1 1 1 0 0 0 0 1 0 2 4 1 3 82 1 0 0 0 0
    1 1 1 1 1 1 0 . 0 2 4 1 3 85 2 1 1 0 0
    1 1 1 0 . 1 0 1 1 2 3 5 2 80 0 0 1 0 2
    1 1 1 0 . 0 0 1 0 3 2 2 2 84 0 1 1 0 2
    1 1 1 0 0 0 0 1 0 3 2 2 2 78 0 0 1 0 2
    1 3 1 0 . 0 0 1 0 3 1 4 3 89 0 0 1 0 1
    1 2 1 0 0 0 0 1 1 3 4 1 1 80 0 0 1 0 2
    1 3 1 1 1 1 0 1 0 3 3 2 1 90 1 0 1 1 2
    1 3 1 0 1 1 0 1 0 1 3 3 1 76 1 0 1 1 2
    1 3 1 0 0 0 0 1 0 1 4 4 1 85 1 0 1 1 1
    1 3 1 0 1 1 0 1 0 1 2 2 1 83 1 0 1 1 1
    1 3 3 0 1 1 0 1 0 5 2 1 1 68 0 0 1 1 2
    1 1 3 0 0 1 0 . . 4 4 2 2 84 0 1 1 0 2
    1 1 3 0 1 0 0 1 0 4 4 2 2 78 0 0 1 0 2
    0 3 3 0 0 0 0 1 1 5 3 7 2 84 0 0 1 1 1
    1 1 3 0 1 1 0 1 0 2 3 2 2 90 0 0 1 2 2
    1 1 3 0 1 1 0 1 0 2 3 2 2 90 0 1 1 2 2
    0 3 3 0 1 1 0 1 0 1 1 . 1 66 1 0 1 0 1
    1 1 3 0 1 1 0 1 0 4 2 4 2 81 1 1 1 2 1
    1 1 3 0 1 1 0 1 0 4 2 4 2 71 1 0 1 2 1
    1 2 2 1 . . 0 1 0 1 5 2 1 65 1 0 1 1 1
    1 2 2 0 . . 0 0 0 3 3 3 2 86 1 0 1 0 2
    1 3 2 0 0 0 0 1 0 3 2 3 1 86 0 0 1 0 2
    1 2 2 1 1 1 0 1 0 3 2 3 2 80 1 0 1 2 2
    1 1 2 0 0 0 0 1 0 3 1 2 2 90 0 0 1 0 1
    1 2 2 0 0 0 0 1 0 4 5 2 1 82 1 1 1 1 1
    1 3 2 0 1 0 0 1 0 3 2 3 3 83 0 0 1 1 2
    0 2 2 0 1 1 0 1 1 5 4 2 3 74 0 0 1 2 2
    1 1 2 0 1 1 0 1 1 3 2 3 2 87 0 1 1 2 2
    1 1 2 0 1 1 0 1 0 3 2 3 2 75 0 0 1 2 2
    1 3 2 0 . . 0 1 0 2 1 1 1 80 1 1 1 0 1
    1 3 2 0 0 0 0 1 0 2 1 2 2 72 1 0 1 0 2
    1 . . . . . . . 1 . . . . 80 0 0 1 0 1
    1 3 2 0 0 0 0 1 0 3 3 3 1 79 1 0 1 0 2
    1 1 0 0 1 1 0 1 0 5 5 2 2 77 0 0 1 0 2
    1 2 0 0 1 1 0 1 0 5 2 2 1 80 0 0 1 0 2
    0 3 0 0 0 0 0 1 0 4 2 3 1 95 0 0 1 1 2
    1 3 0 0 1 1 0 1 0 1 2 5 1 75 3 0 0 0 2
    1 3 0 1 1 1 0 1 0 4 3 1 1 84 0 0 1 0 2
    1 1 2 0 0 0 0 1 0 3 3 1 2 82 3 1 0 2 2
    1 1 2 0 0 0 0 1 0 3 3 1 2 84 3 0 0 0 2
    1 3 3 0 . . 0 1 0 4 1 4 6 90 0 1 1 0 1
    1 3 1 0 1 0 0 1 0 5 5 7 1 86 0 0 1 0 2
    1 . . . 1 1 . . 0 . . . . 78 0 0 1 1 2
    1 3 1 0 1 1 0 1 0 5 3 4 2 77 0 0 1 2 2
    0 1 1 0 0 0 0 1 0 2 3 3 2 87 0 1 1 2 1
    0 1 1 0 0 1 0 1 0 2 3 3 2 87 0 0 1 2 1
    1 1 0 0 1 1 0 1 0 4 3 2 2 82 0 1 1 2 2
    1 1 0 0 1 1 0 1 . 4 3 2 2 80 0 0 1 2 2
    1 1 0 0 1 1 0 1 0 4 3 3 2 87 0 1 1 0 2
    1 1 0 0 0 0 0 1 0 4 3 3 2 86 0 0 1 0 2
    1 1 0 1 0 0 0 1 0 4 3 2 2 80 0 1 1 1 2
    1 1 0 0 0 1 0 1 0 4 3 2 2 77 0 0 1 0 2
    1 2 2 0 1 0 0 1 0 2 2 3 1 92 0 1 1 2 2
    1 3 0 0 . 1 0 1 0 3 3 2 2 87 0 0 1 0 1
    1 3 0 0 . . 0 1 0 2 2 4 1 82 0 0 1 0 0
    1 1 0 0 0 0 0 1 0 4 3 4 2 80 0 1 1 0 2
    1 1 0 0 0 1 0 1 1 4 3 4 2 79 0 0 1 2 2
    1 1 2 0 0 0 0 1 0 5 5 2 2 82 0 1 1 1 2
    1 1 2 1 1 0 0 1 0 5 5 2 2 77 0 0 1 2 2
    1 . . . 1 1 . . 1 . . . . 93 1 0 1 1 0
    1 3 2 0 0 0 0 1 0 2 4 6 4 82 1 0 1 0 0
    1 3 2 0 0 0 0 1 0 2 3 3 1 84 0 1 1 0 2
    1 3 0 0 . . 0 1 0 5 4 3 2 76 0 0 1 2 2
    1 2 2 0 0 0 0 1 0 2 2 2 3 80 0 0 1 1 2
    1 . . . 0 0 . . 1 . . . . 90 1 1 1 0 1
    1 1 1 0 1 1 0 1 0 5 5 3 2 83 0 1 1 0 2
    1 1 1 0 0 0 0 1 0 5 5 3 2 82 0 0 1 0 2
    end
    label values marstat mar
    label def mar 1 "Married", modify
    label def mar 2 "Sep/Divorce", modify
    label def mar 3 "Widowed", modify
    label def mar 4 "Never-married", modify
    label values cenreg cen
    label def cen 0 "NE", modify
    label def cen 1 "MW", modify
    label def cen 2 "South", modify
    label def cen 3 "West", modify
    label values race_rc race
    label def race 0 "NH-White", modify
    label def race 1 "NH-Black", modify
    label def race 2 "NH-Other", modify
    label def race 3 "Hispanic", modify
    label values reduccat reduc
    label def reduc 0 "HS", modify
    label def reduc 1 "Some Col", modify
    label def reduc 2 "Col+", modify
    label values keducat keduc1
    label def keduc1 0 "HS", modify
    label def keduc1 1 "Some Col", modify
    label def keduc1 2 "Col+", modify

  • #2
    Interaction terms involving discrete variables have reference categories just like categorical variables themselves do. Stata is simply telling you that for the interaction it has chosen to use Col+#1 as the reference category for the interaction. Now, this is awkward, because you have elsewhere told Stata that you want 0 ("HS") to be the reference category for the variable keduc. Now, this doesn't make the results you are getting wrong, but it does make them pretty hard to work with. You can overcome this by using the ## interaction operator instead of the single #, and removing the solo term ib0.keduc from your command. You also need to remove the solo male term from the model (which was mis-specified without an i.--which would eventually cause problems due to conflict between continuous male in isolation and discrete male in the interaction term).
    Code:
    mi estimate, or: logit vaccinated ib1.marstat ib0.cenreg work fathereduc mothereduc proxy insurance masks_toomuch wealthquint1 incquint1 numchild h14hhres age ///
         ib0.race_rc native ib0.reduccat ib0.keducat##i.male
    This will give you 0 ("HS") as the reference category for both keducat itself and the keducat#male interaction term.

    It is nearly always better to use the ## operator than the # operator to specify interaction terms in regression commands. While there are special situations where the # operator is preferable, they are relatively uncommon. I would say that your default coding practice for interactions should be to use ##, and to resort to # only when you have a clear, specific reason to do so.

    Comment


    • #3
      Thank you! This did indeed work.

      Comment

      Working...
      X