Image: Cornell University Arts Quad. Photograph by Tomwsulcer, Wikimedia Commons, CC0.
Introduction and Dataset Background
For this project, what I decided to do was explore how the different college characteristics actually relate to the future earnings of the students. I’m currently going through the college application process myself, and I thought it would be quite interesting to take a look at the factors beyond the basic ones, such as rankings and admission rates. I wanted to really examine how the different colleges compare in terms of the student outcomes.
The dataset that I used was the College Scorecard from the U.S. Department of Education. This dataset contained 690 colleges and 20 different variables. It included quantitative variables such as average SAT scores, tuition and faculty salaries, Pell Grant percentages, and median earnings 10 years after students enter college. In addition, it also had categorical variables, which were things like the institution type, geographical region, and state, along with the latitude and longitude coordinates.
The original dataset was filtered so that it would focus on currently operating public and private nonprofit institutions that primarily award bachelor’s degrees, have at least 1,500 undergraduate students, and report information about both SAT scores and earnings. I also went and took a look at the missing values, and what I found was that one college was missing its average faculty salary. My regression analysis ended up having 689 observations.
The goal I have is to investigate the different college characteristics that are associated with higher median earnings and then explore how these relationships are different across the institutions and geographical locations. I plan to use descriptive statistics, multiple linear regression, and visualizations so I can better understand these patterns.
Loading and Exploring the College Scorecard Dataset
# Loading the packages for data analysis and visualizationlibrary(tidyverse)# Importing the approved College Scorecard datasetcolleges <- readr::read_csv("college_scorecard_690.csv")# Previewing the dataset and examining its structurehead(colleges)
# A tibble: 6 × 20
UNITID INSTNM CITY STABBR CONTROL REGION LOCALE LATITUDE LONGITUDE PREDDEG
<dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 100654 Alabama … Norm… AL 1 5 12 34.8 -86.6 3
2 100663 Universi… Birm… AL 1 5 12 33.5 -86.8 3
3 100706 Universi… Hunt… AL 1 5 12 34.7 -86.6 3
4 100724 Alabama … Mont… AL 1 5 12 32.4 -86.3 3
5 100751 The Univ… Tusc… AL 1 5 12 33.2 -87.5 3
6 100830 Auburn U… Mont… AL 1 5 12 32.4 -86.2 3
# ℹ 10 more variables: CURROPER <dbl>, UGDS <dbl>, SAT_AVG <dbl>,
# ADM_RATE <dbl>, PCTPELL <dbl>, AVGFACSAL <dbl>, TUITIONFEE_OUT <dbl>,
# GRAD_DEBT_MDN <dbl>, C150_4 <dbl>, MD_EARN_WNE_P10 <dbl>
As I wrote above, the original College Scorecard dataset was filtered to include institutions that primarily award bachelor’s degrees, are currently operating, are public or private nonprofit, have at least 1,500 undergraduate students, and report both average SAT scores and median earnings. I also excluded institutions that were in outlying U.S. territories, and after I applied all of these criteria, the dataset ended up containing 690 colleges.
That is when I decided to then check the remaining variables for any missing values. I did find one institution that was missing its average faculty salary, so I excluded that observation from my regression analysis rather than trying to replace the missing value. This left me with 689 colleges available for my model that I was creating.
# Checking the original inclusion criteria in the approved dataseteligible_colleges <- colleges %>%filter(PREDDEG ==3, CURROPER ==1, CONTROL %in%c(1, 2), REGION !=9, UGDS >=1500,!is.na(SAT_AVG),!is.na(MD_EARN_WNE_P10))# Confirming how many colleges satisfy these criterianrow(eligible_colleges)
[1] 690
# Filtering colleges to include complete regression variablesregression_colleges <- colleges %>%filter(!is.na(MD_EARN_WNE_P10),!is.na(SAT_AVG),!is.na(PCTPELL),!is.na(AVGFACSAL),!is.na(TUITIONFEE_OUT))# Checking how many observations remain for regressionnrow(regression_colleges)
[1] 689
Exploring Quantitative Variables and Missing Values
# Summarizing the main quantitative variables for our analysissummary(colleges[, c("MD_EARN_WNE_P10", "SAT_AVG","PCTPELL", "AVGFACSAL", "TUITIONFEE_OUT")])
MD_EARN_WNE_P10 SAT_AVG PCTPELL AVGFACSAL
Min. : 37551 Min. : 880 Min. :0.0927 Min. : 3147
1st Qu.: 56341 1st Qu.:1092 1st Qu.:0.2300 1st Qu.: 8565
Median : 64243 Median :1190 Median :0.3225 Median :10071
Mean : 67866 Mean :1210 Mean :0.3361 Mean :10626
3rd Qu.: 77120 3rd Qu.:1297 3rd Qu.:0.4085 3rd Qu.:12016
Max. :152553 Max. :1560 Max. :0.8402 Max. :25354
NAs :1
TUITIONFEE_OUT
Min. : 6888
1st Qu.:21137
Median :34055
Mean :37515
3rd Qu.:50931
Max. :75162
# Counting missing values in each columncolSums(is.na(colleges))
UNITID INSTNM CITY STABBR CONTROL
0 0 0 0 0
REGION LOCALE LATITUDE LONGITUDE PREDDEG
0 0 0 0 0
CURROPER UGDS SAT_AVG ADM_RATE PCTPELL
0 0 0 0 0
AVGFACSAL TUITIONFEE_OUT GRAD_DEBT_MDN C150_4 MD_EARN_WNE_P10
1 0 0 0 0
Exploring Categorical Variables
# Counting colleges by institution typetable(colleges$CONTROL)
1 2
357 333
# Counting colleges by geographical regiontable(colleges$REGION)
1 2 3 4 5 6 7 8
70 152 104 62 187 58 18 39
# Checking how many states are representedlength(unique(colleges$STABBR))
[1] 49
# Checking the most frequently represented statessort(table(colleges$STABBR), decreasing =TRUE)[1:10]
NY PA TX MA OH FL GA IL NC VA
69 51 41 35 26 25 23 23 23 21
Exploring the Distribution of College Earnings
# Creating a histogram of median earnings across collegesggplot(colleges, aes(x = MD_EARN_WNE_P10)) +geom_histogram(binwidth =10000, fill ="steelblue",color ="white") +theme_minimal() +labs(title ="Distribution of Median Earnings Across Colleges",x ="Median Earnings 10 Years After Entry ($)",y ="Number of Colleges",caption ="Source: U.S. Department of Education, College Scorecard" )
Comparing Earnings by College Type
# Creating readable labels for public and private nonprofit collegescolleges <- colleges %>%mutate(college_type =factor(CONTROL,levels =c(1, 2),labels =c("Public", "Private Nonprofit")))# Comparing earnings distributions across college typesggplot(colleges, aes(x = college_type, y = MD_EARN_WNE_P10,fill = college_type)) +geom_boxplot() +scale_fill_brewer(palette ="Set2") +theme_minimal() +labs(title ="Median Earnings by College Type",x ="College Type",y ="Median Earnings 10 Years After Entry ($)",fill ="College Type",caption ="Source: U.S. Department of Education, College Scorecard" )
Examining Correlations Between Quantitative Variables
# Selecting the quantitative variables for our regression analysisregression_vars <- colleges %>%select(MD_EARN_WNE_P10, SAT_AVG, PCTPELL, AVGFACSAL, TUITIONFEE_OUT)# Calculating correlations between the selected variablescor(regression_vars, use ="pairwise.complete.obs")
# Building a multiple linear regression model to predict median earningsearnings_model <-lm(MD_EARN_WNE_P10 ~ SAT_AVG + PCTPELL + AVGFACSAL + TUITIONFEE_OUT,data = regression_colleges)# Displaying the regression coefficients and model statisticssummary(earnings_model)
Call:
lm(formula = MD_EARN_WNE_P10 ~ SAT_AVG + PCTPELL + AVGFACSAL +
TUITIONFEE_OUT, data = regression_colleges)
Residuals:
Min 1Q Median 3Q Max
-31505 -4794 -995 4059 35384
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.724e+03 5.163e+03 1.303 0.19318
SAT_AVG 2.295e+01 4.666e+00 4.918 1.1e-06 ***
PCTPELL -1.050e+04 3.379e+03 -3.107 0.00197 **
AVGFACSAL 2.581e+00 1.524e-01 16.935 < 2e-16 ***
TUITIONFEE_OUT 2.524e-01 2.776e-02 9.092 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 8317 on 684 degrees of freedom
Multiple R-squared: 0.7578, Adjusted R-squared: 0.7564
F-statistic: 535 on 4 and 684 DF, p-value: < 2.2e-16
Regression Results and Interpretation
I used multiple linear regression to take a look at and examine how SAT score, Pell Grant percentages, average faculty salaries, and out-of-state tuition really relate to the median earnings 10 years after the student enters the college. I chose and selected these variables because they each showed meaningful correlations with earnings, and they represented different characteristics of the colleges.
The adjusted R-squared value came out to be 0.7564. What this means is that the model explained approximately 75.6% of the variation in the median earnings across the different colleges that I included in this regression. All four of the independent variables had p-values that were below 0.05, and what this suggests statistically is that there are significant associations with earnings after we account for the other variables.
The average faculty salary is measured monthly, and so the model suggested that if there was an additional $1,000 in monthly faculty salary, it would be associated with approximately $2,581 higher median earnings (while holding the other variables constant).
We saw that the average SAT scores, faculty salaries, and tuition all had positive relationships with earnings, while the Pell Grant percentages, on the other hand, had a negative relationship with it. Something I also noticed is that the SAT scores and tuition were strongly correlated with one another, which means some of the predictors may overlap in the information they provide.
As I mentioned earlier, there was one college that was excluded from the regression because it was missing the average faculty salary. That left us with 689 observations. Although these results did show us evidence of relationships between institutional characteristics and earnings, we cannot say that they establish causation.
Interactive Visualization: SAT Scores and College Earnings
# Loading Plotly to create an interactive visualizationlibrary(plotly)# Creating a scatterplot comparing SAT scores and median earningssat_plot <-ggplot(colleges, aes(x = SAT_AVG,y = MD_EARN_WNE_P10,color = college_type,text = INSTNM)) +geom_point(alpha =0.7, size =2) +scale_color_brewer(palette ="Set1") +theme_minimal() +labs(title ="Average SAT Scores and College Earnings",subtitle ="Comparing public and private nonprofit colleges",x ="Average SAT Score",y ="Median Earnings 10 Years After Entry ($)",color ="College Type",caption ="Source: U.S. Department of Education, College Scorecard" )# Making the graph interactive with college names on hoverggplotly(sat_plot, tooltip =c("text", "x", "y", "colour"))
Source: U.S. Department of Education, College Scorecard.
This interactive scatterplot compares average SAT scores and median earnings across public and private nonprofit colleges. Hovering over a point displays the institution’s name and corresponding values.
Geographical Visualization of College Earnings
# Loading the package used for U.S. state boundarieslibrary(maps)# Preparing the map boundaries and college locationsus_states <-map_data("state")map_colleges <- colleges %>%filter(!STABBR %in%c("AK", "HI"))# Creating a map showing college locations and earningsggplot() +geom_polygon(data = us_states,aes(x = long, y = lat, group = group),fill ="gray95", color ="gray75") +geom_point(data = map_colleges,aes(x = LONGITUDE, y = LATITUDE,color = MD_EARN_WNE_P10),size =2, alpha =0.8) +scale_color_viridis_c(labels = scales::label_dollar()) +coord_quickmap() +annotate("label", x =-112, y =26,label ="684 colleges shown\nAlaska and Hawaii excluded",size =3, fill ="white", alpha =0.9) +theme_minimal() +labs(title ="College Locations and Median Earnings Across the U.S.",subtitle ="Colleges colored by median earnings 10 years after entry",x ="Longitude",y ="Latitude",color ="Median Earnings",caption ="Source: U.S. Department of Education, College Scorecard" )
Visualization Results and Interpretation
The interactive scatterplot that I created is comparing the average SAT scores and the median earnings 10 years after students enter the college. Each point on it represents a different college, and the colors distinguish between the public and the private nonprofit institutions. When you hover over the points, you are able to identify the individual colleges and examine the reported values.
A pattern that really stood out to me was the positive relationship that existed between the average SAT scores and earnings. Colleges that had higher average SAT scores were generally reporting higher median earnings. Something else I noticed is that private nonprofit colleges did have a wider range of earnings, which also did include several institutions with particularly high values.
The geographical map is showing where the colleges in my dataset are actually located when looking across the contiguous United States. Each different point that you see is also representing a college, and its color is indicating median earnings. Something I noticed here is that colleges with higher reported earnings appear in several parts of the country, particularly, though, around the Northeast and some major metropolitan areas. However, the map is showing that earnings can really vary considerably, even when looking within the same geographical region.
One limitation of my analysis is that the earnings data reflect students who entered college around 2011-2013, with their earnings then being measured 10 years after, in 2022-2023. Some of my other college characteristics actually come from more recent years, so the years from which each data characteristic is being taken vary. The regression I made also is not really accounting for every factor that could influence earnings, such as the students’ majors, career choices, or local cost of living. If I were to expand this project, I would most likely explore how these additional factors I mentioned, as well as some other ones, might affect the results that I got.
Overall, the visualizations that I created definitely do help demonstrate that institutional characteristics and geographical location are associated with students’ future earnings. They do not establish, however, that attending a particular college causes higher earnings.
I used ChatGPT and Claude for help troubleshooting errors, including understanding why they happened and as a guide to better understand how to fix them, and for reviewing my analysis to make sure everything made sense. I wanted another look at my work so I could be more confident in it.