Announcement

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

  • How to conveniently add a lot of interaction effects to a regression

    I need to perform a regression and add interaction effect between at least a dozen variables.
    I have to regress earnings on ethnicity, family status, gender, level of education and month dummies. All of these variables are categorical. Ethnicity is not a single variable but multiple 0/1 variables which I combined in a global for a previous regression, same for family status. I need to interact all of these variables together in a single regression.
    This seems incredibly tedious to do one-by-one and I run the risk of forgetting one. Is there a convenient way to do it?

  • #2
    I don't understand exactly what you want, but the following may help:
    Code:
    help fvvarlist##parens

    Comment


    • #3
      That is what factor variable notation is for. To use that effectively you first need to fix your 0/1 variables: they need to be combined into a single categorical variable, e.g. a variable called marst with values 1 for never married, 2 for married, 3 for divorced, and 4 for widowed. After that you can add an interaction with a list of other variables: reg y i.marst##(i.race i.sex i.educ c.age) i.month For more see help fvvarlist
      ---------------------------------
      Maarten L. Buis
      University of Konstanz
      Department of history and sociology
      box 40
      78457 Konstanz
      Germany
      http://www.maartenbuis.nl
      ---------------------------------

      Comment

      Working...
      X