You may not earn more than a 100% on this assignment.
The first step in the process of turning information into knowledge process is to summarize and describe the raw information - the data. In this assignment we explore data on college majors and earnings, specifically the data begin the FiveThirtyEight story “The Economic Guide To Picking A College Major”.
These data originally come from the American Community Survey (ACS) 2010-2012 Public Use Microdata Series. While this is outside the scope of this assignment, if you are curious about how raw data from the ACS were cleaned and prepared, see the code FiveThirtyEight authors used.
We should also note that there are many considerations that go into picking a major. Earnings potential and employment prospects are two of them, and they are important, but they don’t tell the whole story. Keep this in mind as you analyze the data.
Workflow + formatting
Make sure to
Update author name on your document.
Follow the Tidyverse code style guidelines.
Make at least 3 commits.
Use informative labels for plot axes, titles, etc.
Turn in an organized, well formatted document.
Packages
We’ll use the tidyverse package for much of the data wrangling and visualization and the scales package for better formatting of labels on visualizations.
Warning: package 'scales' was built under R version 4.3.3
Data
The data originally come from the fivethirtyeight package but we’ll use versions of the data that have been slightly modified to better suit this assignment. You can load the two datasets we’ll be using for this analysis with the following:
These two datasets have a trove of information. Three variables are common to both datasets:
major_code: Major code, FO1DP in ACS PUMS
major: Major description
major_category: Category of major from Carnevale et al
The remaining variables start with either grad_ or undergrad_ suffix, depending on which dataset they are in. The descriptions of these variables is as follows.
*_total: Total number of people with major
*_sample_size: Sample size (unweighted) of full-time, year-round ONLY (used for earnings)
*_employed: Number employed (ESR == 1 or 2)
*_employed_fulltime_yearround: Employed at least 50 weeks (WKW == 1) and at least 35 hours (WKHP >= 35)
*_median: Median earnings of full-time, year-round workers
*_p75th: 75th percentile of earnings
Finally, undergrad_sharewomen is the proportion of women with the major, and we only have this information for undergraduates.
Let’s think about some questions we might want to answer with these data:
Which major has the lowest unemployment rate?
Which major has the highest percentage of women?
How do the distributions of median income compare across major categories?
How much are college graduates (those who finished undergrad) making?
How do incomes of those with a graduate degree compare to those with an undergraduate degree?
In the following exercises we aim to answer some of these questions.
Exercises
Exercise 1
Which majors have the lowest unemployment rate? Answer the question using a single data wrangling pipeline and focusing on undergraduates (major_income_undergrad). The output should be a tibble with the columns major, and undergrad_unemployment_rate, with the major with the lowest unemployment rate on top, and displaying the majors with the lowest 5 unemployment rates. Include a sentence listing the majors and the unemployment rates (as percentages).
Exercise 2
Which majors have the highest percentage of women? Answer the question using a single data wrangling pipeline and focusing on undergraduates (major_income_undergrad). The output should be a tibble with the columns major, and undergrad_sharewomen, with the major with the highest proportion of women on top, and displaying the majors with the highest 5 proportions of women. Include a sentence listing the majors and the percentage of women with the major.
Render, commit (with a descriptive and concise commit message), and push. Make sure that you commit and push all changed documents and your Git pane is completely empty before proceeding.
Exercise 3
How much are college graduates (those who finished undergrad) making? For this exercise, focus on undergraduates (major_income_undergrad).
Plot the distribution of all median incomes using a histogram with an appropriate binwidth.
Note: You can earn +2 extra credit points for using scale_x_continuous(), making the x axis have the appropriate $ label and units (K). Example: $50k.
Calculate the mean and median for median income. Based on the shape of the histogram, determine which of these summary statistics is useful for describing the distribution. Justify your answer.
Describe the distribution of median incomes of college graduates across various majors based on your histogram from part (a) and incorporating the statistic you chose in part (b) to help your narrative. Hint: Mention shape, center, spread, any unusual observations.
Now is a good time to render, commit (with a descriptive and concise commit message), and push again. Make sure that you commit and push all changed documents and your Git pane is completely empty before proceeding.
Exercise 4
One of the sections of the FiveThirtyEight story is “All STEM fields aren’t the same”. Let’s see if this is true. Once again, focus on undergraduates (major_income_undergrad) for this exercise.
First, let’s create a new vector called stem_categories that lists the major categories that are considered STEM fields.
stem_categories<-c("Biology & Life Science","Computers & Mathematics","Engineering","Physical Sciences")
Then, fill in the partial code to create a new variable in our data frame indicating whether a major is STEM or not. Note that you need to figure out the logical operator that goes into ___.
In a single pipeline, determine which STEM majors’ median earnings are less than $55,000. Your answer should be a tibble with the columns major, major_type, and undergrad_median, arranged in order of descending undergrad_median.
Once again, render, commit, and push. Make sure that you commit and push all changed documents and your Git pane is completely empty before proceeding.
Exercise 5
Finally, we want to compare median incomes of STEM majors with and without a graduate degree in their major.
To do so, we will first join data that contains information on median incomes of those with undergraduate and graduate degrees. Join the major_income_undergrad and the major_income_grad data sets by major_code. Join them in such a way where only rows that include the same major_code from each data set are included. Name the new data set major_income.
Create a new variable called grad_multiplier – the ratio of median income of those with a graduate degree divided by median income of those with an undergraduate degree, for STEM majors. The result should be tibble with the variables major, grad_multiplier, grad_median, and undergrad_median. The results should be displayed in descending order of grad_multiplier and display the STEM majors with top 10 grad_multiplier.
Render, commit, and push one last time. Make sure that you commit and push all changed documents and your Git pane is completely empty before proceeding.
Wrap up
Submission
Go to http://www.gradescope.com
Click on the assignment, and you’ll be prompted to submit it.
Mark all the pages associated with exercise. All the pages of your homework should be associated with at least one question (i.e., should be “checked”). If you do not do this, you will be subject to lose points on the assignment.
Do not select any pages of your PDF submission to be associated with the “Workflow & formatting” question.