We can see that the differences between males and females is significant for values of socst below about 60. Now, we can graph these differences using the marginsplot command. Note: dy/dx for factor levels is the discrete change from the base level. We can obtain this difference for all of the values of socst using the margins command with the dydx option. The same value for females is 43.26361 as shown in row 11. So, the write value for males at socst = 25 is 33.38182 as shown in row 1. We will let socst vary between 25 and 70 in increments of 5. Will do is look at the male-female difference for various values of socst using the margins command. The difference between males and females may or may not be significantly different for different values of socst. margins female, dydx(socst)Īverage marginal effects Number of obs = 200Įxpression : Linear prediction, predict() We can also get the slopes for the two groups using the margins command. The value for the female by socst interaction is -.2047 which is the difference in slope between the male and female group, i.e., the slope for the female group would be about. 6247 which is the slope of the regression line for the male group (i.e., female=0).
![stata 12 ic stata 12 ic](https://data.princeton.edu/stata/stata16doc.png)
i.e., the expected value for write when both socst and female equal zero. This is the value of the intercept for socst regressed on write for males. Let’s interpret the coefficients for this model starting with the constant (17.76). Which tells us that the level for females is higher than for males. How could we tell that females are higher than males? The coefficient for female is positive (15.00) Looking at the graph, we can see that the two regression lines are not parallel and that the line for females falls above the line for males. (lfit write socst if ~female)(lfit write socst if female), /// Twoway (scatter write socst, msym(oh) jitter(3)) /// Please note that we use c.socst to indicate that socst is a continuous variable. We will begin by running the regression model and graphing the interaction. The continuous predictor variable, socst, is a standardized test score for social studies.
![stata 12 ic stata 12 ic](https://www.stata.com/bookstore/bi/12_i_lg.jpg)
The categorical variable is female, a zero/one variable with females coded as one (therefore, male is the reference group). We will use an example from the hsbdemo dataset that has a statistically significant categorical by continuous interaction to illustrate one possible explanatory approach.
![stata 12 ic stata 12 ic](http://docplayer.net/docs-images/56/39037273/images/7-0.png)
![stata 12 ic stata 12 ic](http://oceanofdmg.com/wp-content/uploads/2018/12/StataCorp-Stata-for-Mac-Offline-Installer-Download-OceanofDMG.com_.jpg)
It means that the slope of the continuous variable is different for one or more levels of the categorical variable. First off, let’s start with what a significant categorical by continuous interaction means.