Interaction term and automatic centering in rstanarm

Hi, I have questions about the implications of an interaction term and automatic centering in rstanarm for interpretation and prior specification.

I understand that rstanarm does automatic mean-centering of predictors during the estimation process (so that the mean of zero for prior_intercept makes sense) and then returns the estimates based on the original scale of these predictors (i.e., all regression coefficients and the constant are those for non-centered predictors).

I am not sure what rstanarm does when there is an interaction term. To my knowledge, the standard practice is first center the predictors to be interacted and then compute the product between them. For example, if there are two predictors X and Z, their centered version X_c and Z_c are used to create the interaction term X_cZ_c. X_cZ_c generally does not have a mean of zero, so it is generally different from the centered version of the interaction term between the non-centered predictors, XZ_c.

I understand using either XZ_c or X_cZ_c does not change the computation of predicted outcomes. But it generally produces different values for the coefficients for the interacted terms (X and Z) and the constant and, therefore, requires different prior specifications.

Given this general point, my questions specifically with respect to rstanarm are:

  1. Does rstanarm center XZ during the estimation process, if I include the interaction term as an independent variable: y ~ x + z + xz, so that the mean of a prior for the constant captures the situation where all X, Z, and XZ are taking their mean values? What if I specify the model as: y ~ x*z? Will it internally centers X and Z but not the interaction term XZ during the estimation process, so that the mean of a prior for the constant captures the situation where only X and Z but not XZ are taking their mean values? Or will it be the same as when the model is y ~ x + z + xz?

  2. Regardless of an answer to Q1, can I interpret rstamarm’s estimated (posterior samples of) coefficients of the interacted terms (X and Z) and the constant, as if they were computed without centering? Or does “y ~ x + z + xz” vs. “y ~ x*z” affect this interpretation?

  3. Regardless of an answer to Q1, can I specify priors for the interacted terms (X and Z) as if they would be for non-centered versions? Or does “y ~ x + z + xz” vs. “y ~ x*z” affect this?

I would appreciate your help.

Akisato

Yes, but the raw X is multiplied by the raw Z and then XZ is centered (as is X and Z), so it is a bit different from the practice you describe where XZ is formed by multiplying the centered X and Z. So, the interpretation of the intercept is the expectation of the linear predictor when X, Z, and XZ are marginally “average”.

Yes, the centering (that rstanarm does internally) does not affect the posterior distribution of the coefficients. However, the posterior distribution of the intercept corresponds to uncentered predictors, irrespective of whether there are interaction terms.

Yes, because the centering (that rstanarm does internally) does not affect the posterior distribution of the coefficients.

@bgoodri I was curious about this statement:

However, the posterior distribution of the intercept corresponds to uncentered predictors, irrespective of whether there are interaction terms.

If rstanarm centers the predictors, how could this be? Is there a step taken to restate the intercept after fitting?

Yes, my shifting the original intercept by the vector of predictor means multiplied by the coefficients in the generated quantities block. See, for example,

1 Like

Thank you very much for your clarification, Ben!

Akisato