Wages, Experience and Schooling

A panel of 595 observations from 1976 to 1982

Number of Observations: 3,294

observation: individuals

country: United States

path <- 'https://raw.githubusercontent.com/dhairavc/MSDS2019_RBridge/master/Wages1.csv'
wages <- read.csv(path)
head(wages)
##   X exper    sex school     wage
## 1 1     9 female     13 6.315296
## 2 2    12 female     12 5.479770
## 3 3    11 female     11 3.642170
## 4 4     9 female     14 4.593337
## 5 5     8 female     14 2.418157
## 6 6     9 female     14 2.094058
class(wages)
## [1] "data.frame"
#Wages2 <- data.frame(wages[,2:5])

#head(Wages2)
Wages2 <- wages[,2:5]
colnames(Wages2) <- c("Experience", "Gender", "Education", "Earnings")
Wages2 <- Wages2[, c("Gender", "Experience", "Education", "Earnings")]
summary(Wages2)
##     Gender       Experience       Education        Earnings       
##  female:1569   Min.   : 1.000   Min.   : 3.00   Min.   : 0.07656  
##  male  :1725   1st Qu.: 7.000   1st Qu.:11.00   1st Qu.: 3.62157  
##                Median : 8.000   Median :12.00   Median : 5.20578  
##                Mean   : 8.043   Mean   :11.63   Mean   : 5.75759  
##                3rd Qu.: 9.000   3rd Qu.:12.00   3rd Qu.: 7.30451  
##                Max.   :18.000   Max.   :16.00   Max.   :39.80892

Observation A

When comparing how wages are related to education or experience, it seems that more experience doesn’t mean a larger wage.

However in contrast, the more educated the person, the higher the wage seems

plot(Wages2[,"Experience"], Wages2[,"Earnings"], main = "Experience/Wage Comparison", xlab = "Experience", ylab = "Wage", col=heat.colors(2))

plot(Wages2[,"Education"], Wages2[,"Earnings"], main = "Education/Wage Comparison", xlab = "Education", ylab = "Wage", col=heat.colors(3))

Observation B

How do Males and Females compare with respect to earnings? While both genders have similar education, females earn about 7% less than their male counter parts

malesummary <- c(apply(subset(Wages2, Wages2[,"Gender"] == "male")[,2:4], 2, mean ))
femalesummary <- c(apply(subset(Wages2, Wages2[,"Gender"] == "female")[,2:4], 2, mean ))

malesummary
## Experience  Education   Earnings 
##   8.326377  11.442319   6.313021
femalesummary
## Experience  Education   Earnings 
##   7.732314  11.837476   5.146924
((abs(unname(malesummary["Experience"]) - unname(femalesummary["Experience"])))/(mean(unname(malesummary["Experience"]), unname(femalesummary["Experience"]))))*100
## [1] 7.134715

Observation C

The level of schooling has an increased likelyhood of consistent higher earnings. While there are outliers, having atleast a high school education is indicative of higher earnings

edulevel <- vector()

for (x in 1:nrow(Wages2))
{
  if(Wages2[x,"Education"] <= 6)
  {
    edulevel[x] <- "Elementry"
  } else
  {
    if(Wages2[x,"Education"] <= 8)
    {
      edulevel[x] <- "Middle School"
    }else
    {
      if(Wages2[x,"Education"] <= 12)
      {
        edulevel[x] <- "High School"
      }else
      {
         edulevel[x] <- "College"
      }
    }
  }
}

Wages3 <-cbind(Wages2, edulevel)
colnames(Wages3)[5] <- "EducationLevel"
str(Wages3)
## 'data.frame':    3294 obs. of  5 variables:
##  $ Gender        : Factor w/ 2 levels "female","male": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Experience    : int  9 12 11 9 8 9 8 10 12 7 ...
##  $ Education     : int  13 12 11 14 14 14 12 12 10 12 ...
##  $ Earnings      : num  6.32 5.48 3.64 4.59 2.42 ...
##  $ EducationLevel: Factor w/ 4 levels "College","Elementry",..: 1 3 3 1 1 1 3 3 3 3 ...
boxplot(Earnings~EducationLevel,
        data = Wages3,
        main = "Impact of Education on Earnings",
        xlab = "Education Level",
        ylab = "Wages",
        col = "pink",
        border = "red"
        )