11.07.2015 Views

[U] User's Guide

[U] User's Guide

[U] User's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

[ U ] 25.2 Estimation with factor variables 34925.2.7 Testing significance of interactionsWe are using the model. use http://www.stata-press.com/data/r11/fvex. regress y i.sex i.group sex#group ageWe can test the overall significance of the sex#group interaction by typing. testparm sex#group( 1) 1.sex#2.group = 0( 2) 1.sex#3.group = 0F( 2, 2993) = 3.98Prob > F = 0.0188Just as with testing the main effects, we type the term to be tested—sex#group—in the sameway as we typed it to include it in the regression. The interaction is significant beyond the 5% level.That is not surprising because both interaction indicators were significant in the regression.testparm relies on having sex#group mean the same thing as sex#group meant at the time themodel was fit. If the relevant dataset were no longer in memory, we could not use testparm. Wewould need to use the test command and specify the individual coefficients for ourselves:. test 1.sex#2.group 1.sex#3.group(output omitted )Results would be the same. How did we know what to type after test? If you have been followingthe technical notes, you knew already what to type—you type the name of the corresponding virtualvariables. Typing regress, coeflegend will remind you of the names of the virtual variables.The testparm command did not save us much typing in this example. Using the same dataset,try fitting the regression. regress y i.sex i.age sex#age(output omitted )In the above, we are treating age as if it were a categorical variable. The result is that there willbe forty coefficients in the interaction! Now type. testparm sex#ageYou could perform the same command using test, but we would need to type out the fortycoefficients:. test 1.sex#21.age 1.sex#22.age ... 1.sex#60.age25.2.8 Including factorial specificationsWe have the model. use http://www.stata-press.com/data/r11/fvex. regress y i.sex i.group sex#group ageThe above model is called a factorial specification with respect to sex and group because sexand group appear by themselves and an interaction. Were it not for age being included in the model,we could call this model a full-factorial specification. In any case, Stata provides a shorthand forfactorial specifications. We could fit the model above by typing. regress y sex##group age

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!