Multiple regression analysis y=Bo B Bx+ Bx +.Bkk+u ◆5. dummy variables Economics 20- Prof anderson
Economics 20 - Prof. Anderson 1 Multiple Regression Analysis y = b0 + b1 x1 + b2 x2 + . . . bk xk + u 5. Dummy Variables
Dummy variables o a dummy variable is a variable that takes on the value 1 or o o Examples: male= 1 if are male, 0 otherwise), south(=l if in the south, 0 otherwise), etc o Dummy variables are also called binary variables for obvious reasons Economics 20- Prof anderson
Economics 20 - Prof. Anderson 2 Dummy Variables A dummy variable is a variable that takes on the value 1 or 0 Examples: male (= 1 if are male, 0 otherwise), south (= 1 if in the south, 0 otherwise), etc. Dummy variables are also called binary variables, for obvious reasons
A Dummy Independent variable e Consider a simple model with one continuous variable(x) and one dummy (d) ◆y=B+ad+B1x+ o This can be interpreted as an intercept shift o If d=0, then y=Bo+ Bx+u o If d=1, then y=(Bo+8)+Bx+u 2 The case of d=0 is the base group Economics 20- Prof anderson
Economics 20 - Prof. Anderson 3 A Dummy Independent Variable Consider a simple model with one continuous variable (x) and one dummy (d) y = b0 + d0d + b1 x + u This can be interpreted as an intercept shift If d = 0, then y = b0 + b1 x + u If d = 1, then y = (b0 + d0 ) + b1 x + u The case of d = 0 is the base group
Example of so>0 y=(B+)+B1 slope= B d=0 B y= Bo t Bix X Economics 20- Prof anderson 4
Economics 20 - Prof. Anderson 4 Example of d0 > 0 x y d0{ }b0 y = (b0 + d0 ) + b1 x y = b0 + b1 x slope = b1 d = 0 d = 1
Dummies for Multiple Categories o We can use dummy variables to control for something with multiple categories e Suppose everyone in your data is either a Hs dropout, Hs grad only, or college grad To compare hS and college grads to Hs dropouts, include 2 dummy variables o hsgrad=1 if HS grad only o otherwise. and colgrad- 1 if college grac d, O otherw Economics 20- Prof anderson 5
Economics 20 - Prof. Anderson 5 Dummies for Multiple Categories We can use dummy variables to control for something with multiple categories Suppose everyone in your data is either a HS dropout, HS grad only, or college grad To compare HS and college grads to HS dropouts, include 2 dummy variables hsgrad = 1 if HS grad only, 0 otherwise; and colgrad = 1 if college grad, 0 otherwise
Multiple Categories(cont) Any categorical variable can be turned into a set of dummy variables o Because the base group is represented b the intercept, if there are n categories there should be n-l dummy variables o If there are a lot of categories, it may make sense to group some together e Example: top 10 ranking, 11-25, etc Economics 20- Prof anderson 6
Economics 20 - Prof. Anderson 6 Multiple Categories (cont) Any categorical variable can be turned into a set of dummy variables Because the base group is represented by the intercept, if there are n categories there should be n – 1 dummy variables If there are a lot of categories, it may make sense to group some together Example: top 10 ranking, 11 – 25, etc
Interactions Among Dummies 2 Interacting dummy variables is like subdividing the e group Example: have dummies for male, as well as hsgrad and colgrad Add male*hsgrad and male colgrad for a total of 5 dummy variables-> 6 categories e Base group is female Hs dropouts O hsgrad is for female HS grads, colgrad is for female college grads o The interactions reflect male HS grads and male college grads Economics 20- Prof anderson 7
Economics 20 - Prof. Anderson 7 Interactions Among Dummies Interacting dummy variables is like subdividing the group Example: have dummies for male, as well as hsgrad and colgrad Add male*hsgrad and male*colgrad, for a total of 5 dummy variables –> 6 categories Base group is female HS dropouts hsgrad is for female HS grads, colgrad is for female college grads The interactions reflect male HS grads and male college grads
More on dummy Interactions o Formally, the model is y-Bo+ smale S,hsgrad+ &3 colgrad Emale hsgrad Smale colgrad+ Bx+ u, then, for example If male =0 and hsgrad =0 and colgrad =0 Bo+ Bx+u o If male=0 and hsgrad=1 and colgrad=0 y=Bo 8+hsgt rad Bx+ o If male= 1 and hsgrad =0 and colgrad 1=1 by=Bo+s,male +s,colgrad +Smale*colgrad Bx+u Economics 20- Prof anderson 8
Economics 20 - Prof. Anderson 8 More on Dummy Interactions Formally, the model is y = b0 + d1male + d2hsgrad + d3colgrad + d4male*hsgrad + d5male*colgrad + b1x + u, then, for example: If male = 0 and hsgrad = 0 and colgrad = 0 y = b0 + b1x + u If male = 0 and hsgrad = 1 and colgrad = 0 y = b0 + d2hsgrad + b1x + u If male = 1 and hsgrad = 0 and colgrad = 1 y = b0 + d1male + d3colgrad + d5male*colgrad + b1x + u
Other interactions with dummies o Can also consider interacting a dummy variable d. with a continuous variable. x ◆y=Bn+d+Bx+oad*x+l ◆Ifd=0, then y=B+Bx+l o If d=1, then y=(B0+8)+(B, +8,)x+u This is interpreted as a change in the slope Economics 20- Prof anderson 9
Economics 20 - Prof. Anderson 9 Other Interactions with Dummies Can also consider interacting a dummy variable, d, with a continuous variable, x y = b0 + d1d + b1 x + d2d*x + u If d = 0, then y = b0 + b1 x + u If d = 1, then y = (b0 + d1 ) + (b1+ d2 ) x + u This is interpreted as a change in the slope
Example of 80>0 and 8< y=Bo+ y=(Bn+)+(+S)x Economics 20- Prof anderson 10
Economics 20 - Prof. Anderson 10 y x y = b0 + b1 x y = (b0 + d0 ) + (b1 + d1 ) x Example of d0 > 0 and d1 < 0 d = 1 d = 0