Announcement

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

  • Interaction terms in regression

    Hi All,

    I have a very simple question concerning interaction terms. I found some confusing answers online, which is why I am still not sure and asking it here. Are interaction terms only possible using factor (or categorial) variables?

    More explanation on what I want to do:
    I want to run a regression with an interaction term that tests the effect of past fund performance and manager replacements on fund flows. Since manager replacements is already a dummy variable, I'd have to make fund performance categorical if this is the case. So is it true that a normal variable indicating an alpha of a fund in my case, cannot be used as part of an interaction term in a regression?

    Thank you in advance,
    Tom

  • #2
    Factor variable notation certainly includes the scope to deal with continuous by continuous interaction terms, and also categorical by continuous interactions. Perhaps the name is confusing because you might not think of the first as falling under factor variables, but the documentation at e.g.

    Code:
    help fvvarlist
    covers what is possible.

    Comment


    • #3
      Hi Tom,
      Specifically, all you have to do is use the letters i and c when specifying the interaction. If you say i.variable, you're saying that the variable is categorical (binary, ordinal, multinomial), but if you say c.variable, you're saying that the variable is continuous.

      For example, if I wanted to know the effect of gender and income on life satisfaction, and I wanted to interact gender and income, I could type:

      Code:
      regress satisfaction i.gender##c.income
      This is the same as:

      Code:
      regress satisfaction i.gender#c.income i.gender c.income
      In other words, the ## indicates that you want an interaction term AND you want to include each of the variables separately (which you should almost always do).

      By the way, if your categorical variable has more than 2 categories, you might want to choose which one should serve as the base category. For example, if you have three geographic areas (1. rural 2. urban 3. suburban), you could set "urban" as the base category by typing ib2.geography instead of just i.geography.
      Last edited by Max Coleman; 18 Nov 2020, 17:03.

      Comment

      Working...
      X