How to include a linear and quadratic term when also including interaction with those variables? When adding a numeric predictor with categorical predictors and their interactions, it is usually considered necessary to center the variables at 0 beforehand. The reasoning is that the main effects are otherwise hard to interpret as they are evaluated with the numeric predictor at 0.
My question now is how to center if one not only includes the original numeric variable (as a linear term) but also the quadratic term of this variable? Here, two different approaches are necessary:


*

*Centering both variables at their individual mean. This has the unfortunate downside that the 0 now is at a different position for both variables considering the original variable.

*Centering both variables at the mean of the original variable (i.e., subtracting the mean from the original variable for the linear term and subtracting the square of the mean of the original variable from the quadratic term). With this approach the 0 would represent the same value of the original variable, but the quadratic variable would not be centered at 0 (i.e., the mean of the variable wouldn't be 0).


I think that approach 2 seems reasonable given the reason for centering after all.  However, I cannot find anything about it (also not in the related questions: a and b).
Or is it generally a bad idea to include linear and quadratic terms and their interactions with other variables in a model?
 A: I don't feel that centering is worth the trouble, and centering makes the interpretation of parameter estimates more complex.  If you use modern matrix algebra software, algebraic collinearity is not a problem.  Your original motivation of centering to be able to interpret main effects in the presence of interaction is not a strong one.  Main effects when estimated at any automatically chosen value of a continuous interacting factor are somewhat arbitrary, and it's best to think of this as a simple estimation problem by comparing predicted values.  In the R rms package contrast.rms function, for example, you can obtain any contrast of interest independent of variable codings.  Here is an example of a categorical variable x1 with levels "a" "b" "c" and a continuous variable x2, fitted using a restricted cubic spline with 4 default knots.  Different relationships between x2 and y are allowed for different x1.  Two of the levels of x1 are compared at x2=10.
require(rms)
dd <- datadist(x1, x2); options(datadist='dd')
f <- ols(y ~ x1 * rcs(x2,4))
contrast(f, list(x1='b', x2=10), list(x1='c', x2=10))
# Now get all comparisons with c:
contrast(f, list(x1=c('a','b'), x2=10), list(x1='c', x2=10))
# add type ='joint' to get a 2 d.f. test, or conf.type='simultaneous'
# to get simultaneous individual confidence intervals

With this approach you can also easily estimate contrasts at several values of the interacting factor(s), e.g.
contrast(f, list(x1='b', x2=10:20), list(x1='c', x2=10:20))

