©2019 by Connor Rothschild

Exploring the Decision to Leave or Enter STEM Majors While in College (Using R and Tableau)

March 30, 2019

NOTE: You can find an interactive version of these visualizations on Tableau.


The goal of this project is to explore trends in STEM enrollment for different populations.


Specifically, it asks: Are traditionally underrepresented groups more likely to migrate into or out of STEM majors? What discrepancies are present between different demographic groups?


The Data

The dataset for this R project is taken from data.world and contains the enrollment numbers for undergraduates nationwide. I modified that data in Excel to make it more suitable for this project.


I did the majority of work for this project in R. You can find the documentation here.


Although I'll spare you the details of every command (if you were that interested, you would be reading the code and not this blog post), the analysis relies on a few simple calculations and summary statistics.


First, I'm interested in the proportion of a class that is of a certain demographic (female, Black, Hispanic).
Second, I want to find the change in that proportional enrollment between the class's first year (matriculation) and their final year (graduation).

By creating a variable which divides the groups enrollment by overall enrollment, we can find proportional enrollment. By subtracting proportional enrollment at the time of graduation from the time of matriculation, we can see how that class changed. In other words, we can see how a certain group (e.g. women) migrated in and out of STEM majors. 


I carried out these calculations using mutate, gather, and select from the tidyr package



I am first curious how enrollment has changed for each group in my analysis. The following plots enrollment for different underrepresented groups as a proportion of overall enrollment in STEM majors at the undergraduate level.



Of the traditionally underrepresented groups, women fare the best in STEM. But even at their peak, they only held 19% of seats in STEM classrooms.


Next, I am curious how these shifts vary from one graduation class to another. In other words, which classes experience the greatest shifts in representation throughout their time in university?


I explore this by mutating the data to include a new variable: growth.
This variable (which may be more accurately be named "change") examines the difference between the underrepresented proportion of STEM enrollment at the time of graduation and the time of matriculation
If women were 19% of their class's STEM majors at time of matriculation in 2015 and 17% of their class's STEM majors at time of graduation, growth would be 2% (19%-17%).

We can explore these changes by graduation year:



It seems as if women experience the greatest growth in STEM enrollment during their time as undergraduates, while Black students tend to migrate out of STEM majors.


We can break that down group-by-group.







Summaries and Takeaways

The decision to migrate into or out of STEM majors is both an individual choice and one shaped by institutional factors. In the face of demographic discrepancies, universities may or may not make changes to make STEM fields more accessible to underrepresented groups. 


The data paint a neutral picture of trends in STEM. This analysis may suggest something about individual choices; it may also suggest that universities are not doing enough to make STEM majors accessible to Black students. However, it is promising that women and Hispanic students are able to, and often choose to, migrate into STEM majors. 


There does not seem to be a temporal dynamic to these decisions. Although some classes (the Class of 2009) were more than others likely to migrate into STEM majors, no trend makes itself apparent year-by-year.


This analysis may suggest that more can be done to bring women and racial minorities into STEM, or it may simply present the product of individual decisions on the part of underrepresented groups.


Interactive Visualization


Please reload

Our Recent Posts

Texas Vaccination Rates (Using Rayshader!)

September 28, 2019

Building My First Shiny App

August 3, 2019

Making Publication-Ready Plots for the Texas Policy Lab (using R)

July 23, 2019

Please reload


Please reload