Note the use of twoway-type options to label details of the graph. Next, use marginsplot to graph these means. First calculate the predicted means of logco2 at several combinations of urban (10, 40, 70 or 100) and reg4 (0 or 1). Percent urban ranges from about 10 to 100 percent in these data, so we could graph the interaction as follows. Or equivalently with a factor interaction, regress logco2 c.urban i.reg4 c.urban#i.reg4 reg4 is an indicator variable and urban is continuous, so the same model estimated above could be obtained by the command The symbol # specifies an interaction between two variables, and # a factorial interaction which automatically includes all the lower-level interactions involving those variables. The i.varname and c.varname notation for indicator and continuous variables, introduced in Chapter 6, provides an alternative way to include interactions. graph twoway scatter logco2 urban, msymbol(Oh) No European countries exhibit the low-urbanization, low-CO 2 profile seen in other parts of the world and even European nations with middling urbanization have relatively high CO 2 emissions. The line in the right panel (reg4 = 1) has a less-steep slope (.0084) and a higher y-intercept (.826). The line in the left-hand (reg4 = 0) panel has a slope of. Graphing the predicted values for this example visualizes our interaction effect (Figure 7.7). The post-regression command predict newvar generates a new variable holding predicted values from the recent regression. We could write the model above as two separate equations: But the interaction coefficient is negative, meaning that this upward slope is less steep for Europe. The main effect of urban is positive (.0217), meaning that logco2 tends to be higher in countries with more urbanized population. 043), suggesting that the relationship between percent urban and log CO 2 emissions is different for Europe than for the rest of the world. The interaction effect is statistically significant (p =. Regressing logco2 on urban, reg4 and the interaction term urb_reg4 gives a model that tests whether either the y-intercept or the slope relating logco2 to urban might be different for Europe compared with other regions. label variable urb_reg4 “interaction urban*reg4 (Europe)” The resulting variable urb_reg4 equals urban for countries in Europe, and zero for all other countries. We form an interaction term or slope dummy variable named urb_reg4 by multiplying the dummy variable reg4 times the measurement variable urban. We start out by labeling the values of reg4, and calculating a log version of co2 because of that variable’s severe positive skew. In this section we stay with the Nations2.dta data, but consider some different variables: per capita carbon dioxide emissions (co2), percent of the population living in urban areas (urban), and the dummy variable reg4 defined as 1 for European countries and 0 for all others. Another use for dummy variables is to form interaction terms called “slope dummy variables” by multiplying a dummy times a measurement variable. The previous section described what are called “intercept dummy variables,” because their coefficients amount to shifts in a regression equation’s y intercept, comparing the 0 and 1 groups.
0 Comments
Leave a Reply. |