I would like to do regression to find relationship between ln_wage and education level. The education levels are used as dummy variables. The data looks like this:
unique(data1$grade)
'MiddleSchool' 'University' 'Primary' 'Vocational' 'HighSchool' 'PostSecondary'
AT first, the reference group is HighSchool as I checked with contrast() , it returns:
data1$grade = as.factor(data1$grade)
contrasts(data1$grade)
MiddleSchool PostSecondary Primary University Vocational
HighSchool 0 0 0 0 0
MiddleSchool 1 0 0 0 0
PostSecondary 0 1 0 0 0
Primary 0 0 1 0 0
University 0 0 0 1 0
Vocational 0 0 0 0 1
Then, I proceed to do regression.
olsreg <- lm(ln_wage ~ age + age_sqr + grade + indus + year -1, data=data1)
summary(olsreg)$coefficient
Estimate Std. Error
> gradePrimary 2.561 1.127378e-02
> gradeMiddleSchool 2.680 1.108296e-02
> gradeHighSchool 2.743 1.128950e-02
> gradeVocational 2.820 1.165518e-02
> gradePostSecondary 2.915 1.147913e-02
> gradeUniversity 3.191 1.136915e-02
The results show every category, not one is omitted as the reference group.
Then, I proceed to use relevel to change the reference group to Primary.
data1$grade = relevel(data1$grade, ref='Primary')
contrasts(data1$grade)
HighSchool MiddleSchool PostSecondary University Vocational
Primary 0 0 0 0 0
HighSchool 1 0 0 0 0
MiddleSchool 0 1 0 0 0
PostSecondary 0 0 1 0 0
University 0 0 0 1 0
Vocational 0 0 0 0 1
The reference group changed to Primary. Then, I do regression again.
olsreg <- lm(ln_wage ~ age + age_sqr + grade + indus + year -1, data=data1)
summary(olsreg)$coefficient
Estimate Std. Error
> gradePrimary 2.561 1.127378e-02
> gradeMiddleSchool 2.680 1.108296e-02
> gradeHighSchool 2.743 1.128950e-02
> gradeVocational 2.820 1.165518e-02
> gradePostSecondary 2.915 1.147913e-02
> gradeUniversity 3.191 1.136915e-02
The coefficients do not change at all from the previous regression, and there also seems to be no baseline. What did I do wrong here? Any advice is very much appreciated.