Search code examples
statainteraction

Creating interaction terms with continuous variables in stata


I have "trading" as a variable. I want to see how trading by the rich and the poor affect their total asset returns by interacting this continuous variable "trading" with a dummy rich, poor and compare the effect vis a vis the middle. I am using stata.

Is it correct to specify?

reg returns c.trading##top c.trading##bottom .. and some other variables

Solution

  • You can specify an interaction between a continuous variable and a categorical variable as such:

    sysuse auto
    reg price c.weight#i.rep78
    

    I'd recommend using factor-notation (i.) to make it explicit that the categorical variable is a categorical variable.