Announcement

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

  • Accidentally creating collinearity with interaction of dummy variables

    I am trying to figure out how to correctly establish interactions between dummy variables. I need to show the differences between gender and whether athlete/nonathlete.
    I feel like my code is correct. Somehow, it is omitting both the male variables for collinearity and I cannot figure out why! I must be accidentally creating duplicate somehow? I'm new to STATA so any help is MUCH appreciated



    generate fem_ath=1 if female==1 & athlete==1
    replace fem_ath=0 if female==1 & athlete==0
    generate fem_nonath=1 if female==1 & athlete==0
    replace fem_nonath=0 if fem_nonath==.
    generate male_ath=1 if female==0 & athlete==1
    replace male_ath=0 if male_ath==.
    generate male_nonath=1 if female==0 & athlete==0
    replace male_nonath=0 if male_nonath==.
    reg colgpa hsize hsizesq hsperc sat fem_ath fem_nonath male_ath male_nonath

  • #2
    Presuming your female and athlete variables are coded correctly (0/1), all you need is:
    Code:
    generate fem_ath = female * athlete
    regress colgpa hsize hsizesq hsperc sat female athlete fem_ath
    A standard StataList suggestion here would be tell you to just let Stata do this for you using its built-in "factor variable" feature (see -help fvvarlist-) to create the dummy variables and interaction terms, which has many advantages. However, I think your do-it-yourself approach is a good idea for you at this point, as it forces you to learn and understand how dummy variables and related interaction terms work. There are lots of good presentations of how to form and use dummy variables for regression, so if you don't find the one you're currently working from sufficiently clear, a search engine might hit one you'd like better. Try, e.g., searching on /dummy variables interaction regression/
    Note that there's nothing very Stata specific about your difficulties, at least not with the DIY approach.

    Comment

    Working...
    X