# Model Formulae. correct model?

I'm trying to build the following model in R, however I'm quite confused about the model formulae to use to include an interaction (x1 and x2)

$Y_{}=a+b*x_1+cx_2+d(x_1*x_2)$

this intuitive formula seems to be wrong model:

y~x1+x2+(x1*x2)


is this the appropriate formula?:

y~x1*x2 ?


Basically, yes.* That formula will enter both main effects and the product term as predictors in your model. So will your first version BTW: compare lm(y~x1*x2);lm(y~x1+x2+x1*x2). For example, using set.seed(8);x1=rnorm(99);x2=rnorm(99);y=rnorm(99), either way the equation is: $$\hat Y=-.16-.02x_1-.08x_2+.09(x_1\times x_2)$$
If for some (probably improper) reason you wanted only the interaction term, you'd use x1:x2 – note this is how the interaction term is labeled in the output, not as x1*x2.
* You might want to scale your predictors to remove nonessential multicollinearity if you're interested in the standard errors of your regression coefficents or other associated statistics (including $t$s and $p$s for your predictors). This is unnecessary for the interaction term though; it only changes standard errors for the main effects. If you use y~scale(x1,T,F)*scale(x2,T,F), this will mean-center x1 and x2 but not divide by the standard deviation, thus preserving your units of measurement. If you use y~scale(x1)*scale(x2), this will standardize x1 and x2 to the scale of $Z$. Either works for controlling nonessential multicollinearity, but neither removes essential multicollinearity. For more on that, see the following reference:
• Centering doesn't influence the interaction. Standardizing (mean-centering and dividing by the SD) will change the scale of the interaction's regression coefficient (not the size, mind you; it just removes the units of measurement and places the coefficient on the scale of $\rho$), but won't change its SE or NHST statistics. Jul 23, 2014 at 10:51