2026-12-05
Students choosing a major may want to compare what graduates earn with how exposed they are to AI and/or how much people make in the related field they are pursuing
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
ai_salary_majors <- readr::read_csv(
'https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-10-20/ai_salary_majors.csv',
col_types = readr::cols(cip4 = readr::col_character())
)
major_occupations <- readr::read_csv(
'https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-10-20/major_occupations.csv',
col_types = readr::cols(cip4 = readr::col_character())
)
majors_raw <- ai_salary_majors
jobs_raw <- major_occupations## spc_tbl_ [285 × 13] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
## $ cip4 : chr [1:285] "4604" "5003" "4807" "4703" ...
## $ field_of_study : chr [1:285] "Building/Construction Finishing, Management, and Inspection" "Dance" "Woodworking" "Heavy/Industrial Equipment Maintenance Technologies/Technicians" ...
## $ broad_field : chr [1:285] "Construction Trades" "Visual and Performing Arts" "Precision Production" "Mechanic and Repair Technologies/Technicians" ...
## $ broad_field_short : chr [1:285] "Construction Trades" "Visual & Performing Arts" "Precision Production" "Mechanic & Repair Tech" ...
## $ median_starting_salary: num [1:285] 72864 21878 19151 65331 84187 ...
## $ median_salary_4yr : num [1:285] 90691 39716 37055 83528 117176 ...
## $ ai_exposure : num [1:285] -1.201 -1.162 -1.101 -1.091 -0.736 ...
## $ ai_exposure_percentile: num [1:285] 0 0.4 0.7 1.1 1.4 1.8 2.1 2.5 2.8 3.2 ...
## $ ai_exposure_language : num [1:285] -1.133 -0.557 -1.174 -1.129 -0.905 ...
## $ ai_exposure_image : num [1:285] -0.984 -1.796 -0.75 -0.746 -0.139 ...
## $ n_occupations : num [1:285] 21 3 6 9 4 12 18 3 1 6 ...
## $ n_institutions : num [1:285] 4 62 1 1 7 1 4 49 3 10 ...
## $ n_graduates : num [1:285] 206 1798 24 25 632 ...
## - attr(*, "spec")=
## .. cols(
## .. cip4 = col_character(),
## .. field_of_study = col_character(),
## .. broad_field = col_character(),
## .. broad_field_short = col_character(),
## .. median_starting_salary = col_double(),
## .. median_salary_4yr = col_double(),
## .. ai_exposure = col_double(),
## .. ai_exposure_percentile = col_double(),
## .. ai_exposure_language = col_double(),
## .. ai_exposure_image = col_double(),
## .. n_occupations = col_double(),
## .. n_institutions = col_double(),
## .. n_graduates = col_double()
## .. )
## - attr(*, "problems")=<pointer: 0x59fedfeb0230>
## spc_tbl_ [1,505 × 7] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
## $ cip4 : chr [1:1505] "0100" "0100" "0100" "0100" ...
## $ field_of_study : chr [1:1505] "Agriculture, General" "Agriculture, General" "Agriculture, General" "Agriculture, General" ...
## $ soc : chr [1:1505] "19-1011" "19-1012" "25-1041" "19-1013" ...
## $ occupation : chr [1:1505] "Animal Scientists" "Food Scientists and Technologists" "Agricultural Sciences Teachers, Postsecondary" "Soil and Plant Scientists" ...
## $ ai_exposure : num [1:1505] 1.041 0.794 0.755 0.632 1.404 ...
## $ ai_exposure_language: num [1:1505] 0.972 0.573 1.154 0.609 1.33 ...
## $ ai_exposure_image : num [1:1505] 1.12 1.129 -0.29 0.804 1.299 ...
## - attr(*, "spec")=
## .. cols(
## .. cip4 = col_character(),
## .. field_of_study = col_character(),
## .. soc = col_character(),
## .. occupation = col_character(),
## .. ai_exposure = col_double(),
## .. ai_exposure_language = col_double(),
## .. ai_exposure_image = col_double()
## .. )
## - attr(*, "problems")=<pointer: 0x59fee4405560>
## median_starting_salary ai_exposure
## Min. : 10084 Min. :-1.2010
## 1st Qu.: 33319 1st Qu.: 0.6770
## Median : 41189 Median : 1.0350
## Mean : 46381 Mean : 0.8281
## 3rd Qu.: 59738 3rd Qu.: 1.1890
## Max. :106754 Max. : 1.4190
## ai_exposure
## Min. :-2.6700
## 1st Qu.: 0.4500
## Median : 1.0100
## Mean : 0.7535
## 3rd Qu.: 1.3200
## Max. : 1.5280
salary_correlation <- cor(majors$ai_exposure, majors$median_starting_salary)
cat("Pearson correlation:", round(salary_correlation, 4))## Pearson correlation: 0.0045
ggplot(majors, aes(x = ai_exposure, y = median_starting_salary)) +
geom_point(color = "red", alpha = 0.65, size = 2) +
geom_smooth(method = "lm", formula = y ~ x, se = FALSE, color = "blue") +
scale_y_continuous(labels = scales::label_dollar()) +
labs(
x = "AI exposure score for the major",
y = "Median earnings one year after graduation"
) +
theme_minimal(base_size = 14)examples <- majors |>
filter(ai_exposure_percentile <= 25 | ai_exposure_percentile >= 75) |>
group_by(Band = if_else(
ai_exposure_percentile <= 25, "Lower quarter", "Upper quarter"
)) |>
slice_max(median_starting_salary, n = 2, with_ties = FALSE) |>
ungroup()
p <- ggplot(examples, aes(
x = reorder(field_of_study, median_starting_salary),
y = median_starting_salary,
fill = Band
)) +
geom_col() +
coord_flip() +
labs(x = NULL, y = "Starting salary")
plotly::ggplotly(p)# Computer Science has the major code 1107.
cs_major <- majors |> filter(cip4 == "1107")
cs_major |>
transmute(
`Median earnings one year out` = scales::dollar(median_starting_salary),
`AI exposure percentile` = ai_exposure_percentile
) |>
knitr::kable()| Median earnings one year out | AI exposure percentile |
|---|---|
| $70,906 | 70.6 |
cs_jobs <- jobs |> filter(cip4 == "1107")
job_spread <- jobs |>
group_by(cip4) |>
summarize(
job_count = n(),
spread = max(ai_exposure) - min(ai_exposure)
) |>
filter(job_count >= 2)
cs_gap <- max(cs_jobs$ai_exposure) - min(cs_jobs$ai_exposure)
cat("Gap between the two Computer Science roles:", round(cs_gap, 2),
"points. Median gap across", nrow(job_spread), "majors:",
round(median(job_spread$spread), 2), "points.")## Gap between the two Computer Science roles: 0.22 points. Median gap across 261 majors: 0.63 points.
ggplot(cs_jobs, aes(x = ai_exposure, y = reorder(occupation, ai_exposure))) +
geom_point(color = "blue", size = 4) +
geom_text(aes(label = sprintf("%.2f", ai_exposure)), nudge_x = 0.08) +
scale_x_continuous(limits = c(0, 1.5)) +
scale_y_discrete(labels = scales::label_wrap(32)) +
labs(x = "AI exposure score for the occupation", y = NULL) +
theme_minimal(base_size = 13)Question 1: Do majors with higher AI exposure have higher or lower starting earnings?
There is almost no linear relationship between AI exposure and earnings one year after graduation across these majors.
Question 2: How much does exposure vary within Computer Science?
The two linked occupations differ by 0.218 exposure points, less than the median gap among majors with multiple linked occupations.
Takeaway: Earnings and AI exposure provide different information. Students should consider both alongside their interests and potential career paths.