# Re: st: OLS three-way interaction

 From Maarten buis To statalist@hsphsun2.harvard.edu Subject Re: st: OLS three-way interaction Date Wed, 4 Nov 2009 08:09:40 -0800 (PST)

```--- On Wed, 4/11/09, Antonio Silva wrote:
> I am interested in estimated an OLS regression model with three
> independent variables of interest, and some controls. Let us
> call the three variables w, x, and z. W is a continuous variable,
> x is a dummy, and z is categorical with 3 levels. I wish to
> estimate a model with a three-way interaction between w, x, and z.
<snip>
> what do you think the best way to do this is in stata? The
> estimation of the model seems straightforward, but interpreting
> the results seems much less so to me.

Interpreting models with higher order interactions will always be
hard. One thing you could do is graph the results, like in the
example below:

*---------------- begin example ------------------
sysuse auto, clear
recode rep78 1/2=3

// gen dummies
tab rep78, gen(drep)

// drep1 is reference category
drop drep1

// create interactions
gen forXdrep2 = foreign * drep2
gen forXdrep3 = foreign * drep3

gen forXweight = foreign * weight

gen drep2Xweight = drep2 * weight
gen drep3Xweight = drep3 * weight

gen forXdrep2Xweight = foreign * drep2 * weight
gen forXdrep3Xweight = foreign * drep3 * weight

reg price weight for* drep* mpg

preserve
qui adjust mpg, by(foreign rep78 weight) replace
twoway line xb weight if rep78 == 3 || ///
line xb weight if rep78 == 4 || ///
line xb weight if rep78 == 5,   ///
by(foreign, note(""))           ///
ytitle(predicted price)         ///
legend(order(1 "Average"        ///
2 "Good"           ///
3 "Excellent"))
restore
*---------------- end example ---------------------

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```