HR-analys: Förutsäga personalomsättning i R
Abhishek Trehan
People Analytics Practitioner
# Plot the distribution of compensation
ggplot(emp_tenure, aes(x = compensation)) +
geom_histogram()

# Plot the distribution of compensation across levels
ggplot(emp_tenure,
aes(x = level, y = compensation)) +
geom_boxplot()

$$ \text{Compa Ratio} = \frac{\text{ Actual Compensation }}{\text{Median Compensation}} $$
Compa-kvot på 1,2 eller 120 % innebär att medarbetaren tjänar 20 % över medianlönen
Compa-kvot på 1 eller 100 % innebär att medarbetaren tjänar exakt medianlönen
Compa-kvot på 0,8 eller 80 % innebär att medarbetaren tjänar 20 % under medianlönen

# Derive Compa-ratio
emp_compa_ratio <- emp_tenure %>%
group_by(level) %>%
mutate(median_compensation = median(compensation),
compa_ratio = (compensation / median_compensation))
# Look at the median compensation for each level
emp_compa_ratio %>%
distinct(level, median_compensation)
# A tibble: 2 x 2
# Groups: level[2]
level median_compensation
<fct> <dbl>
1 Analyst 51840
2 Specialist 83496
HR-analys: Förutsäga personalomsättning i R