# Introduction#

## The Financial Benefits of Your Major#

Welcome to Data 88E: Economics Models! This class will explore the intersection of Data Science and Economics. Specifically, we will utilize methods and techniques in data science to examine both basic and upper-division Economics concepts. Throughout the course, we will consider a variety of economic problems both on the macro and micro level.

In the first demo of the course, we hope to give you a sense of the types problems you can expect to explore this semester by considering a problem that may be of personal relevance to you: the post-graduate incomes of different majors at Cal.

We will be using various visualization techniques to analyze the median incomes of different majors at UC Berkeley, in addition to the median incomes of those same majors at other colleges. If you forgot, the median income is the “middle” value: if you sorted all the individual incomes of a major in ascending order, the median would be the value that’s exactly in the middle. The median is also called the 50th percentile – at the median, exactly 50% of the individuals have an income lower than the median.

Do not be concerned if you don’t understand the code below: this entire exercise is purely a demo to motivate many profound concepts in Economics. If you’re interested, you may choose to come back to this demo at the end of the course and consider all the different techniques utilized in it - it’d be a great way of reflecting upon how much you’ve learnt!

## Data Collection#

Before we can use data science to tackle any issue, we must–well–obtain data (kind of mind-boggling, I know). Recall that we want to examine the median incomes of different majors at UC Berkeley as well as the median incomes of those same majors at other colleges. The term ‘other colleges’ is a fairly general one, and in this case we shall consider the average median incomes of those majors at alll other colleges in the United States.

In order to obtain a dataset, you can either collect it yourself (via surveys, questionnaires, etc.) or you can use datasets that others have gathered for you. In this demo, we are combining 3 different datasets:

• The median income for each major at Cal was obtained from Cal’s 2019 First Destination survey.

• The median income for each major overall was obtained from surveys conducted by the American Community Survey (ACS) from 2010 to 2012, a very popular data source for Economics Research! In the survey, ACS essentially calls college graduates and asked them their income as well as what they majored in at college. (As a side note, FiveThirtyEight later published this article:The Economic Guide to Picking a College Major using the results of the survey.) In this project, we will be using a modified version of the ACS survey - we will only be looking at the respondents who are 28 or younger. Can you think of why we would do this?

• The longitudinal data on long-run outcomes of UC Berkeley alumni was obtained from the University of California webpage. We will use this dataset later for a slightly different analysis.

Take a moment to consider the ways in which the 3 different datasets were created. Is it fair to draw direct comparisons between the datasets? What would be some potential issues and how could the differences in our datasets affect our analysis?

### Mean vs Median#

Before proceeding further, it is important to consider why we are choosing to look at the median, and not the average, income. In order to answer this question, let us think about what the distribution of incomes for a population would look like. Most likely, you would see a high amount of incomes around or slightly below the mean, with a few massive outlier incomes above the mean. For example, consider a theatre major who becomes a star on Broadway - while they’d be doing absolutely fantastic in their career, they are not representative of the average theatre graduate from Berkeley and would likely pull the average income way up. For this reason, using the median is more robust: it gives us a better idea of what the typical graduate for any major can generally expect to earn.

Now we’ll load in all the data. Take a look at the tables for each dataset. Note that P25th referes to the 25th percentile of incomes (the income level at which exactly 25% of incomes are lower) and P75th refers to the 75th percentile of incomes (the income level at which exactly 75% of incomes are lower). You may not know what all the different columns in the tables mean. That’s okay! As data scientists, we often encounter a lot of irrelevant data that we will discard later.

# Load in table of all majors' median incomes at Cal
cal_income.show(10)

Major Cal Median Cal P25th Cal P75th
American Studies 55000 41600 60000
Anthropology 41600 36500 51000
Applied Mathematics 80004 65000 108000
Landscape Architecture 52000 45760 60000
Art 48880 38640 56390
Astrophysics 60000 50800 77182
Bioengineering 71000 54997 86500
Chemical Biology 49920 44000 68000
Chemical Engineering 70000 65000 80000

... (39 rows omitted)

# Load in table of all other universities' average major median incomes
other_income.show(10)

Rank Major_code Major Total Men Women Major_category ShareWomen Sample_size Employed Full_time Part_time Full_time_year_round Unemployed Unemployment_rate Median P25th P75th College_jobs Non_college_jobs Low_wage_jobs
1 2419 PETROLEUM ENGINEERING 2339 2057 282 Engineering 0.120564 36 1976 1849 270 1207 37 0.0183805 110000 95000 125000 1534 364 193
2 2416 MINING AND MINERAL ENGINEERING 756 679 77 Engineering 0.101852 7 640 556 170 388 85 0.117241 75000 55000 90000 350 257 50
3 2415 METALLURGICAL ENGINEERING 856 725 131 Engineering 0.153037 3 648 558 133 340 16 0.0240964 73000 50000 105000 456 176 0
4 2417 NAVAL ARCHITECTURE AND MARINE ENGINEERING 1258 1123 135 Engineering 0.107313 16 758 1069 150 692 40 0.0501253 70000 43000 80000 529 102 0
5 2405 CHEMICAL ENGINEERING 32260 21239 11021 Engineering 0.341631 289 25694 23170 5180 16697 1672 0.0610977 65000 50000 75000 18314 4440 972
6 2418 NUCLEAR ENGINEERING 2573 2200 373 Engineering 0.144967 17 1857 2038 264 1449 400 0.177226 65000 50000 102000 1142 657 244
7 6202 ACTUARIAL SCIENCE 3777 2110 1667 Business 0.441356 51 2912 2924 296 2482 308 0.0956522 62000 53000 72000 1768 314 259
8 5001 ASTRONOMY AND ASTROPHYSICS 1792 832 960 Physical Sciences 0.535714 10 1526 1085 553 827 33 0.0211674 62000 31500 109000 972 500 220
9 2414 MECHANICAL ENGINEERING 91227 80320 10907 Engineering 0.119559 1029 76442 71298 13101 54639 4650 0.0573423 60000 48000 70000 52844 16384 3253
10 2408 ELECTRICAL ENGINEERING 81527 65511 16016 Engineering 0.19645 631 61928 55450 12695 41413 3895 0.0591738 60000 45000 72000 45829 10874 3170

... (163 rows omitted)

To make direct comparisons across majors, we combined all the tables above into a single one for us to use below.

majors = Table.read_table("cal_vs_all.csv")
majors.show(10)

Index Major Major Category Median Income Difference Cal P25th Cal Median Cal P75th Overall P25th Overall Median Overall P75th
1 American Studies Humanities & Liberal Arts 15000 41600 55000 60000 30000 40000 42000
2 Anthropology Humanities & Liberal Arts 13600 36500 41600 51000 20000 28000 38000
3 Applied Mathematics Computers & Mathematics 35004 65000 80004 108000 34000 45000 63000
4 Art Arts 18380 38640 48880 56390 21000 30500 41000
5 Astrophysics Physical Sciences -2000 50800 60000 77182 31500 62000 109000
6 Bioengineering Engineering 13900 54997 71000 86500 40000 57100 76000
Our combined table above dropped the columns in above tables that we didn’t need to conduct our exploration. It has a column Median Income Difference: this column is the Berkeley median income minus the overall median income for each major. It gives us a sense of the value of Cal over the average university: the difference is the additional income we recieve from obtaining a Cal degree.
Before moving forward, take a second to consider how well the above tables would match with each other. For example, Electrical Engineering and Computer Science (EECS) is a popular major at Berkeley. However, the majors dataset didn’t have a direct equivalent for it. Instead, the majors dataset had Electrical Engineering, Electrical Engineering Technologies and Computer Engineering as separate majors. Since in theory students in EECS focus more on computer engineering, we chose to use the computer engineering data for drawing comparions in our final, combined table. However, there’s room for ambiguity here and that is another potential flaw in our exploration!