The estimates of the regression with centered predictors are and (we denote estimates from regressions with centered predictors with an asterisk). The parameter estimates of the regression with uncentered predictors are and. To do so, we first fit the linear regression with only main effects with uncentered predictors lm(y ~ x1 + x2)Īnd then with mean centered predictors x1_c <- x1 - mean(x1) # center predictors We first verify that centering variables indeed does not affect the main effects.
#INTERACTION TERM STATA 12 CODE#
This code samples observations from this model: n <- 10000 We define the predictors as Gaussians with means and. Where we set, and is Gaussian distribution with mean zero and variance. The simplest possible example to illustrate the issue is a regression model in which variable is a linear function of variables, , and their product means) that are substracted from predictor variables
Then, you run the margins command to get the confidence intervals of the difference between woman and man. reg lnearn age age2 i.woman#c.educ married manager That is why you got two omitted variables on your output.
You should first re-write your regression syntax, because once you include the interaction this way woman#c.educ you don't need to include the constitutive terms alone. One way of finding this is by using the margins command in Stata. But they do not tell you if the effect of education is different between woman and man. The p-values you have for the interaction term and for education coefficient alone only tell you that the effect of education for both woman and man are different from zero.
#INTERACTION TERM STATA 12 HOW TO#
When you have a continuous variable in the interaction term, it is always a good idea to check the distribution of the effect through a plot (I will show how to do this below).Īlso, as you included an interaction term, you are probably interested in the different effect of education between man and woman. When education equals to zero, woman earn around 21% less than man. So, for man, the average effect of additional years of education on log income is 0.09.īy the same logic, the coefficient of woman alone gives you the effect of woman (related to man) when education equals to zero, which maybe it is not very informative. When you include an interaction term between education and woman, the coefficient of education becomes the effect of education when variable woman equals zero (that is, when man). The average effect of education for man is given by the coefficient of education alone ( educ). So you could say that, for woman, every additional year of education is correlated with an increase of approximately 10% on earnings. The log scale is often considered to be an approximate of a percentage scale ( see this paper, for example). That is, for woman, every year of education is correlated, on average, with an increase of 0.11 on log of earnings. As woman is a dummy variable, you can interpret the interaction coefficient as the average effect of one year of education on the log of earnings for woman.