Dummy Variable Trap with Example

Zahid Asghar

11/25/2020

QUALITATIVE VARIABLES

Dummy variables are also called indicator variables, categorical variables, and qualitative variables. Examples: gender, race, color, religion, nationality, geographical region, party affiliation, and political upheavals

DUMMY VARIABLE TRAP

REFERENCE CATEGORY

POINTS TO KEEP IN MIND

INTERPRETATION OF DUMMY VARIABLES

Data on Teachers Evaluation and Beauty

TeachingRatings <- read_excel("C:/Users/hp/Dropbox/Applied Econometrics SBP/Stock and Watson Data sets/TeachingRatings.xls")
sample_n(TeachingRatings, size=5)
minorityagefemaleonecreditbeautycourse_evalintronnenglish
049001.05 4  00
042000.2173.800
03810-1.02 3.510
035000.2754.200
039000.5774.200
TeachingRatings1<-TeachingRatings %>% mutate(male=(1-female), advanced=(1-intro))
set.seed(12345)
sample_data<-sample_n(TeachingRatings1, size=20)

sample_data
minorityagefemaleonecreditbeautycourse_evalintronnenglishmaleadvanced
047000.541 4.70011
033100.724 4.40001
06400-0.111 4.40011
152000.212 3.50111
152000.212 3.90111
042000.217 3.70011
057000.632 4.20011
032001.23  4.31010
047100.339 3.81000
05210-1.09  4.40001
152000.212 4.60111
14700-1.05  3.40011
042001.77  4.91010
06010-0.05674  0101
06200-0.728 4  0011
04010-0.678 4.60001
05210-1.09  3.70001
06000-0.395 4.50011
05700-0.767 4.71010
037000.933 3.50011

Dummy Variable

lm_dummy<-lm(course_eval~beauty+female,data = sample_data)

lm_saturated<-lm(course_eval~beauty+female+male,data = sample_data)

lm_nointercept<-lm(course_eval~beauty+female+male+0,data = sample_data)


huxreg("One Less Dummy"=lm_dummy,"Constant+Dummies"=lm_saturated, "full dummies without constant"=lm_nointercept) %>% set_caption("Teaching Evaluation as function of Beauty")
Teaching Evaluation as function of Beauty
One Less DummyConstant+Dummiesfull dummies without constant
(Intercept)4.140 ***4.140 ***        
(0.130)   (0.130)           
beauty0.117    0.117    0.117    
(0.142)   (0.142)   (0.142)   
female0.046    0.046    4.186 ***
(0.242)   (0.242)   (0.198)   
male                4.140 ***
                (0.130)   
N20        20        20        
R20.039    0.039    0.989    
logLik-11.760    -11.760    -11.760    
AIC31.520    31.520    31.520    
*** p < 0.001; ** p < 0.01; * p < 0.05.