Page 1Page 2Page 3Page 4Page 5Page 6Page 7Page 8Page 9Page 10Page 11Page 12Page 13GVPT 722: Quantitative Methods for Political Science IIExamples of Regression with Dummy Variables and Interaction Terms: Analysis of the2004 National Election Study (H:\gvpt722_spring2006\nes2004\nes2004.dta)I. Regression on dummy variables representing categorical variables with two categories(1) Dummy variables only. reg kerryft sex south white Source | SS df MS Number of obs = 1191-------------+------------------------------ F( 3, 1187) = 33.26 Model | 64127.7793 3 21375.9264 Prob > F = 0.0000 Residual | 762776.777 1187 642.60891 R-squared = 0.0776-------------+------------------------------ Adj R-squared = 0.0752 Total | 826904.556 1190 694.877778 Root MSE = 25.35------------------------------------------------------------------------------ kerryft | Coef. Std. Err. t P>|t| [95% Conf. Interval]-------------+---------------------------------------------------------------- sex | 4.993928 1.473875 3.39 0.001 2.102238 7.885618 south | -4.915573 1.57679 -3.12 0.002 -8.009178 -1.821967 white | -15.83308 1.678053 -9.44 0.000 -19.12536 -12.54079 _cons | 63.55346 1.750819 36.30 0.000 60.11841 66.9885------------------------------------------------------------------------------(2) Dummy variables and continuous variables. reg kerryft white uniontherm Source | SS df MS Number of obs = 1032-------------+------------------------------ F( 2, 1029) = 84.09 Model | 102502.348 2 51251.174 Prob > F = 0.0000 Residual | 627177.132 1029 609.501586 R-squared = 0.1405-------------+------------------------------ Adj R-squared = 0.1388 Total | 729679.48 1031 707.739553 Root MSE = 24.688------------------------------------------------------------------------------ kerryft | Coef. Std. Err. t P>|t| [95% Conf. Interval]-------------+---------------------------------------------------------------- white | -11.19285 1.775339 -6.30 0.000 -14.67655 -7.70915 uniontherm | .352343 .0349918 10.07 0.000 .2836796 .4210064 _cons | 40.43913 2.705941 14.94 0.000 35.12933 45.74892------------------------------------------------------------------------------II. Regression on multiple dummy variables representing a multi-category discrete variable (1) Creating the dummy variables (from the nominal religious tradition variable) tab denom2 religious | tradition with | low commitment | coded as | secular | Freq. Percent Cum.----------------+----------------------------------- evangelical | 240 20.07 20.07 mainline | 196 16.39 36.45 black prot | 158 13.21 49.67 catholic | 258 21.57 71.24 secular | 270 22.58 93.81 jewish | 27 2.26 96.07conserv nontrad | 28 2.34 98.41liberal nontrad | 6 0.50 98.91 orthodox | 5 0.42 99.33 other | 8 0.67 100.00----------------+----------------------------------- Total | 1,196 100.00 gen evang2=0 gen mlprot2=0 gen blkprot2=0 gen catholic2=0 gen secular2=0 gen jewish2=0replace evang2=1 if denom2==1(240 real changes made) replace mlprot2=1 if denom2==2(196 real changes made) replace blkprot2=1 if denom2==3(158 real changes made) replace catholic2=1 if denom2==4(258 real changes made) replace secular2=1 if denom2==5(270 real changes made) replace jewish2=1 if denom2==6(27 real changes made). tab1 evang2 mlprot2 blkprot2 catholic2 jewish2 secular2-> tabulation of evang2 evang2 | Freq. Percent Cum.------------+----------------------------------- 0 | 972 80.20 80.20 1 | 240 19.80 100.00------------+----------------------------------- Total | 1,212 100.00-> tabulation of mlprot2 mlprot2 | Freq. Percent Cum.------------+----------------------------------- 0 | 1,016 83.83 83.83 1 | 196 16.17 100.00------------+----------------------------------- Total | 1,212 100.00-> tabulation of blkprot2 blkprot2 | Freq. Percent Cum.------------+----------------------------------- 0 | 1,054 86.96 86.96 1 | 158 13.04 100.00------------+----------------------------------- Total | 1,212 100.00-> tabulation of catholic2 catholic2 | Freq. Percent Cum.------------+----------------------------------- 0 | 954 78.71 78.71 1 | 258 21.29 100.00------------+----------------------------------- Total | 1,212 100.00-> tabulation of jewish2 jewish2 | Freq. Percent Cum.------------+----------------------------------- 0 | 1,185 97.77 97.77 1 | 27 2.23 100.00------------+----------------------------------- Total | 1,212 100.00-> tabulation of secular2 secular2 | Freq. Percent Cum.------------+----------------------------------- 0 | 942 77.72 77.72 1 | 270 22.28 100.00------------+----------------------------------- Total | 1,212 100.00(2) Regression on multiple dummy variables for a single nominal variable(a) No comparison category: perfect multicollinearity. reg candeval evang2 mlprot2 catholic2 blkprot2 jewish2 secular2 if denom2<7 Source | SS df MS Number of obs = 1131-------------+------------------------------ F( 5, 1125) = 37.80 Model | 11.9426467 5 2.38852934 Prob > F = 0.0000 Residual | 71.0792762 1125 .063181579 R-squared = 0.1438-------------+------------------------------ Adj R-squared = 0.1400 Total | 83.0219228 1130 .073470728 Root MSE = .25136------------------------------------------------------------------------------ candeval | Coef. Std. Err. t P>|t| [95% Conf.
View Full Document