Announcement

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

  • Ambiguous Abbreviation (r111 error), Trying to Run a Margins Command After An Interaction (Continuous Variable * A Categorical Variable)

    Hi, I have STATA IC 15. I am trying to run a margins command, but it keeps giving me errors. I have already ran an interaction regression and will paste my code below. Can someone please help?

    xi: regress chldidel_r race sex marital2 c.educ_cat##race
    note: 3.race omitted because of collinearity

    Source | SS df MS Number of obs = 3,140
    -------------+---------------------------------- F(7, 3132) = 7.84
    Model | 184.833439 7 26.404777 Prob > F = 0.0000
    Residual | 10551.9105 3,132 3.36906466 R-squared = 0.0172
    -------------+---------------------------------- Adj R-squared = 0.0150
    Total | 10736.7439 3,139 3.42043452 Root MSE = 1.8355

    ---------------------------------------------------------------------------------
    chldidel_r | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    ----------------+----------------------------------------------------------------
    race | .7570165 .2342019 3.23 0.001 .2978117 1.216221
    sex | .3262137 .0660248 4.94 0.000 .1967574 .4556699
    marital2 | -.1016858 .034758 -2.93 0.003 -.1698366 -.0335351
    educ_cat | .0078517 .0124389 0.63 0.528 -.0165375 .0322409
    |
    race |
    black | .5613127 .4953705 1.13 0.257 -.4099709 1.532596
    other | 0 (omitted)
    |
    race#c.educ_cat |
    black | -.0790855 .0346998 -2.28 0.023 -.1471222 -.0110489
    other | -.1094243 .0345663 -3.17 0.002 -.1771992 -.0416494
    |
    _cons | 1.842544 .3639438 5.06 0.000 1.128951 2.556136
    ---------------------------------------------------------------------------------

    . margins, dydx(educ_cat) at(race = (1 2 3)) vsquish
    race ambiguous abbreviation
    r(111);

  • #2
    Hi Roman,
    the command margins needs factor variables, so you have to specify race as i.race and avoid the xi: prefix.

    Try:

    Code:
    regress chldidel_r i.race sex marital2 c.educ_cat##race
    margins, dydx(educ_cat) at(race = (1 2 3)) vsquis
    Raffaele

    Comment


    • #3
      Thanks, Raffaele!

      Comment

      Working...
      X