Descriptive statistics of dataset “Glassdoor Gender Pay Gap”

mydata <- read.table( "./Glassdoor Gender Pay Gap.csv", header = TRUE, sep = ",")
head(mydata)
##              JobTitle Gender Age PerfEval Education           Dept Seniority
## 1    Graphic Designer Female  18        5   College     Operations         2
## 2   Software Engineer   Male  21        5   College     Management         5
## 3 Warehouse Associate Female  19        4       PhD Administration         5
## 4   Software Engineer   Male  20        5   Masters          Sales         4
## 5    Graphic Designer   Male  26        5   Masters    Engineering         5
## 6                  IT Female  20        5       PhD     Operations         4
##   BasePay Bonus
## 1   42363  9938
## 2  108476 11128
## 3   90208  9268
## 4  108080 10154
## 5   99464  9319
## 6   70890 10126

1. Description of data set used in the analysis

1.1 Definition of variables

  • Unit of observation: workers of different types of jobs
  • Sample size: 1000 observations
  • Variables:
    • JobTitle: name of the job of the person. Categorical
    • Gender: categorical
    • Age :age in years of the person. Numeric
    • PerfEval: Performance Evaluation score. Numeric
    • Education: Level of education. Categorical
    • Dept: Department. Categorical
    • Seniority: number of year worked. Numeric
    • BasePay: annual basic pay in $. Numeric
    • Bonus: annual bonus pay. Numeric

2 Descriptive statistics

summary(mydata)
##    JobTitle            Gender               Age           PerfEval    
##  Length:1000        Length:1000        Min.   :18.00   Min.   :1.000  
##  Class :character   Class :character   1st Qu.:29.00   1st Qu.:2.000  
##  Mode  :character   Mode  :character   Median :41.00   Median :3.000  
##                                        Mean   :41.39   Mean   :3.037  
##                                        3rd Qu.:54.25   3rd Qu.:4.000  
##                                        Max.   :65.00   Max.   :5.000  
##   Education             Dept             Seniority        BasePay      
##  Length:1000        Length:1000        Min.   :1.000   Min.   : 34208  
##  Class :character   Class :character   1st Qu.:2.000   1st Qu.: 76850  
##  Mode  :character   Mode  :character   Median :3.000   Median : 93328  
##                                        Mean   :2.971   Mean   : 94473  
##                                        3rd Qu.:4.000   3rd Qu.:111558  
##                                        Max.   :5.000   Max.   :179726  
##      Bonus      
##  Min.   : 1703  
##  1st Qu.: 4850  
##  Median : 6507  
##  Mean   : 6467  
##  3rd Qu.: 8026  
##  Max.   :11293
  • Age: The average age is 41.39. The age seems to be balanced because the distance between the minim and the maxim to the mean is almost the same.

  • Bonus: The 3rd quantile indicates that the 75% of the people receive $8026 or less so we can say that there is a predominant trend of receiving low bonus in comparison to the max value.

library(psych)
## Warning: package 'psych' was built under R version 4.3.3
describeBy(mydata$BasePay, mydata$Gender)
## 
##  Descriptive statistics by group 
## group: Female
##    vars   n     mean       sd  median  trimmed     mad   min    max  range skew
## X1    1 468 89942.82 24378.28 89913.5 89813.96 25229.4 34208 160614 126406 0.06
##    kurtosis      se
## X1    -0.36 1126.89
## ------------------------------------------------------------ 
## group: Male
##    vars   n     mean       sd median trimmed      mad   min    max  range skew
## X1    1 532 98457.55 25517.52  98223 97881.3 25539.27 36642 179726 143084 0.22
##    kurtosis      se
## X1    -0.16 1106.32

The mean salary of the Female in the observation is 89942.82 and of the Male is 98457.55 so we can derive that in average Males earns more than Female.

describeBy(mydata$PerfEval, mydata$Gender)
## 
##  Descriptive statistics by group 
## group: Female
##    vars   n mean   sd median trimmed  mad min max range skew kurtosis   se
## X1    1 468 2.94 1.43      3    2.92 1.48   1   5     4 0.03    -1.34 0.07
## ------------------------------------------------------------ 
## group: Male
##    vars   n mean   sd median trimmed  mad min max range  skew kurtosis   se
## X1    1 532 3.13 1.41      3    3.16 1.48   1   5     4 -0.11    -1.29 0.06

The median score of both Female and Male is 3 so it means that the 50% of the samples took more than 3 points in the evaluation. Also, as there is almost no difference between the average score of Female and Male we infer that this is not a reason why there is such a gap in salaries.

describeBy(mydata$BasePay, mydata$Seniority)
## 
##  Descriptive statistics by group 
## group: 1
##    vars   n     mean       sd median trimmed      mad   min    max  range skew
## X1    1 195 76840.35 21991.72  76103 75961.8 21511.04 36548 136836 100288 0.37
##    kurtosis      se
## X1    -0.27 1574.86
## ------------------------------------------------------------ 
## group: 2
##    vars   n     mean       sd median  trimmed      mad   min    max  range skew
## X1    1 209 84640.42 22796.98  84132 84342.79 25413.25 34208 148178 113970  0.1
##    kurtosis     se
## X1    -0.56 1576.9
## ------------------------------------------------------------ 
## group: 3
##    vars   n     mean       sd median  trimmed      mad   min    max  range skew
## X1    1 219 94679.64 21137.68  91711 93717.06 21402.81 46263 160614 114351 0.45
##    kurtosis      se
## X1     0.12 1428.35
## ------------------------------------------------------------ 
## group: 4
##    vars   n     mean       sd   median  trimmed      mad   min    max  range
## X1    1 184 104146.2 22193.28 103835.5 103492.2 21610.38 55569 179726 124157
##    skew kurtosis      se
## X1 0.33     0.14 1636.11
## ------------------------------------------------------------ 
## group: 5
##    vars   n     mean       sd median  trimmed   mad   min    max  range skew
## X1    1 193 113477.7 20931.17 112976 112774.9 20918 60070 176789 116719 0.29
##    kurtosis      se
## X1    -0.06 1506.66

When we increase the number of working years of the person we can see that in average the salary increases too. The more experience that a person has, the more he earns. However, I can see a lot of outliers in all the categories of seniority. There is one person with 1 year of experience who earns more than the average of people with 5 years of experience. I saw this in the max value of seniority 1. This is not strange to happen because the salaries can change a lot depending on the type of job.

Graphics

Age

library(car)
## Warning: package 'car' was built under R version 4.3.3
## Loading required package: carData
## Warning: package 'carData' was built under R version 4.3.3
## 
## Attaching package: 'car'
## The following object is masked from 'package:psych':
## 
##     logit
scatterplot(BasePay ~ Age, 
            ylab = "Salary ($)", 
            xlab = "Age", 
            smooth = FALSE, 
            data = mydata,
            col = "indianred2")

I can see just a bit of correlation between age and salaries. This means that there is a very small tendency of increasing the salary when the person is older.

PerfEval

library(ggplot2)
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
ggplot(mydata, aes(x = PerfEval)) +
  geom_histogram(binwidth = 1, color = "gray", fill = "skyblue3") +
  scale_x_continuous(breaks = seq(1, 5, by = 1)) +  
  labs(x = "Score", y = "Frequency") +
  facet_wrap(~Gender, ncol = 1)

The number of people on each score is very similar. I can see that there is a slight more women that took 1 and men who took 5 but the average score, as we saw before, is almost the same.

BasePay

library(ggplot2)
ggplot(mydata, aes(x = Gender, y = BasePay)) +
  geom_boxplot(color = "darkgray") +
  labs(x = "Gender", y = "Salary")

The boxplot shows that there is a difference between the salaries of Female and Male. The median salary of men is higher than the median salary of women. There is also two outliers in Male and one in Female. However, this is not strange because salaries can change a lot dependieng on other factors.

Bonus

library(car)
scatterplot(Age ~ Bonus, 
            ylab = "Salary ($)", 
            xlab = "Age", 
            smooth = FALSE, 
            data = mydata,
            col = "plum3")

There is no correlation between the age and the bonus.The ponits are really disperse. The amount of bonus that a person receives is not explain by the age.