1 Overview

This is a fast-paced course that covers a lot of material. There will be a large amount of references. You may need to do your own research to fill in the gaps in between lectures and homework/projects. It is impossible to learn data science without getting your hands dirty. Please budget your time evenly. Last-minute work ethic will not work for this course.

Homework in this course is different from your usual homework assignment as a typical student. Most of the time, they are built over real case studies. While you will be applying methods covered in lectures, you will also find that extra teaching materials appear here. The focus will be always on the goals of the study, the usefulness of the data gathered, and the limitations in any conclusions you may draw. Always try to challenge your data analysis in a critical way. Frequently, there are no unique solutions.

Case studies in each homework can be listed as your data science projects (e.g. on your CV) where you see fit.

1.1 Objectives

  • Get familiar with R-studio and RMarkdown
  • Hands-on R
  • Learn data science essentials
    • gather data
    • clean data
    • summarize data
    • display data
    • conclusion
  • Packages
    • dplyr
    • ggplot

1.2 Instructions

  • Homework assignments can be done in a group consisting of up to three members. Please find your group members as soon as possible and register your group on our Canvas site.

  • All work submitted should be completed in the R Markdown format. You can find a cheat sheet for R Markdown here For those who have never used it before, we urge you to start this homework as soon as possible.

  • Submit the following files, one submission for each group: (1) Rmd file, (2) a compiled HTML or pdf version, and (3) all necessary data files if different from our source data. You may directly edit this .rmd file to add your answers. If you intend to work on the problems separately within your group, compile your answers into one Rmd file before submitting. We encourage that you at least attempt each problem by yourself before working with your teammates. Additionally, ensure that you can ‘knit’ or compile your Rmd file. It is also likely that you need to configure Rstudio to properly convert files to PDF. These instructions might be helpful.

  • In general, be as concise as possible while giving a fully complete answer to each question. All necessary datasets are available in this homework folder on Canvas. Make sure to document your code with comments (written on separate lines in a code chunk using a hashtag # before the comment) so the teaching fellows can follow along. R Markdown is particularly useful because it follows a ‘stream of consciousness’ approach: as you write code in a code chunk, make sure to explain what you are doing outside of the chunk.

  • A few good or solicited submissions will be used as sample solutions. When those are released, make sure to compare your answers and understand the solutions.

1.3 Review materials

  • Study Basic R Tutorial
  • Study Advanced R Tutorial (to include dplyr and ggplot)
  • Study lecture 1: Data Acquisition and EDA

2 Case study 1: Audience Size

How successful is the Wharton Talk Show Business Radio Powered by the Wharton School

Background: Have you ever listened to SiriusXM? Do you know there is a Talk Show run by Wharton professors in Sirius Radio? Wharton launched a talk show called Business Radio Powered by the Wharton School through the Sirius Radio station in January of 2014. Within a short period of time the general reaction seemed to be overwhelmingly positive. To find out the audience size for the show, we designed a survey and collected a data set via MTURK in May of 2014. Our goal was to estimate the audience size. There were 51.6 million Sirius Radio listeners then. One approach is to estimate the proportion of the Wharton listeners to that of the Sirius listeners, \(p\), so that we will come up with an audience size estimate of approximately 51.6 million times \(p\).

To do so, we launched a survey via Amazon Mechanical Turk (MTurk) on May 24, 2014 at an offered price of $0.10 for each answered survey. We set it to be run for 6 days with a target maximum sample size of 2000 as our goal. Most of the observations came in within the first two days. The main questions of interest are “Have you ever listened to Sirius Radio” and “Have you ever listened to Sirius Business Radio by Wharton?”. A few demographic features used as control variables were also collected; these include Gender, Age and Household Income.

We requested that only people in United States answer the questions. Each person can only fill in the questionnaire once to avoid duplicates. Aside from these restrictions, we opened the survey to everyone in MTurk with a hope that the sample would be more randomly chosen.

The raw data is stored as Survey_results_final.csv on Canvas.

2.1 Data preparation

  1. We need to clean and select only the variables of interest.

Select only the variables Age, Gender, Education Level, Household Income in 2013, Sirius Listener?, Wharton Listener? and Time used to finish the survey.

Change the variable names to be “age”, “gender”, “education”, “income”, “sirius”, “wharton”, “worktime”.

2.1.1 Answer

  1. Handle missing/wrongly filled values of the selected variables

As in real world data with user input, the data is incomplete, with missing values, and has incorrect responses. There is no general rule for dealing with these problems beyond “use common sense.” In whatever case, explain what the problems were and how you addressed them. Be sure to explain your rationale for your chosen methods of handling issues with the data. Do not use Excel for this, however tempting it might be.

Tip: Reflect on the reasons for which data could be wrong or missing. How would you address each case? For this homework, if you are trying to predict missing values with regression, you are definitely overthinking. Keep it simple.

2.1.2 Answer

We noticed that the age column had the datatype of character rather than numeric, so we decided to convert the type accordingly. We also checked the range and noticed some ages that were either too young (MTurk does not let users under 18 partake in its surveys) or too old to be accurate values (for ex, 223 years old). We accordingly filtered by age.

In the code chunk below, we also cleaned up blank values in the other columns using filter.

## Warning: NAs introduced by coercion

Most of our data was also of the character type, but was not yet defined as a factor. We accordingly define factors here, and order them where it makes sense (e.g. in terms of increasing education, increasing income)

We considered dropping values in the worktime column that were abnormally large like the 108, but decided that it is possible someone opened the browser to take the survey and just left it alone for a long time.

  1. Brief summary

Write a brief report to summarize all the variables collected. Include both summary statistics (including sample size) and graphical displays such as histograms or bar charts where appropriate. Comment on what you have found from this sample. (For example - it’s very interesting to think about why would one work for a job that pays only 10cents/each survey? Who are those survey workers? The answer may be interesting even if it may not directly relate to our goal.)

2.1.3 Answer

From the structure of data1, we see that after cleaning the dataset we are left with a sample size of 1725.

We can examine the age across these samples and see that the median age is 28, with the ages ranging from 18 to 76. As can be seen in the histogram below, the majority of survey takers are below the age of 40.

We also see that there are more men than women in this data set: 996 compared to 729, as obtained from our earlier data summary.

When looking at income, we see that the survey participants are largely in income brackets that are on the lower end, with the majority of participants below the median USA income in 2014 of $53,657 (see the Census report on this topic).

When looking at education, we see that the majority of survey takers have either “Some college, no diploma; or Associate’s degree” or “Bachelor’s degree or other 4-year degree”, referring to having roughly 0-4 years of college education.

2.2 Sample properties

The population from which the sample is drawn determines where the results of our analysis can be applied or generalized. We include some basic demographic information for the purpose of identifying sample bias, if any exists. Combine our data and the general population distribution in age, gender and income to try to characterize our sample on hand.

  1. Does this sample appear to be a random sample from the general population of the USA? Why it is crucial to have randomness here?

  2. Does this sample appear to be a random sample from the MTURK population?

Note: You can not provide evidence by simply looking at our data here. For example, you need to find distribution of education in our age group in US to see if the two groups match in distribution. You may need to gather some background information about the MTURK population to have a slight sense if this particular sample seem to a random sample from there… Please do not spend too much time gathering evidence.

2.2.1 Answer

To compare the population from the MTurk survey to the general population of the USA, we examined a dataset from the US Census Bureau website for 2014 demographics, which can be downloaded here: https://data.census.gov/table/ACSDP1Y2014.DP05?q=age distribution in the United States in 2014.

This dataset states that in 2014, the median age in the US was 37.7 years old, and the sex ratio was 96.9 males per 100 females. From our earlier analysis of the MTurk survey, we saw that the median age was 28 years old and that the sex ratio was 996:729, or roughly 136.6 males per 100 females.

Some background information on American MTurk survey takers can be found from a 2016 Pew Research Center study: https://www.pewresearch.org/internet/2016/07/11/turkers-in-this-canvassing-young-well-educated-and-frequent-users/

Comparing all working adults to MTurk workers, there are roughly equal numbers of men and women in both samples (this differs from what we see in our dataset, so our survey takers may differ from the average MTurk population as well). Furthermore, MTurk workers are more likely to be college educated (51% of workers have a college degree or more, compared to 36% of all working adults). They are also more likely to be white, and tend to be lower income.

Based on this, we can answer questions 1 and 2.

  1. The sample does not appear to be a random sample from the general population of the USA, due to some significant demographic differences. This sample skews male, is younger in age, and and has a larger portion of low-income individuals, since most survey takers fall below the median USA income in 2014.

  2. This sample does not appear to be a random sample of the MTurk population either. The MTurk population has a roughly equal gender split based on the Pew Research Center study, but this survey has far more male respondents. However, though the “bins” that PRC uses to classify MTurk users based on income and education differ from those used in our MTurk survey, it is true that both samples have similar income and education profiles.

2.3 Final estimate

Give a final estimate of the Wharton audience size by May of 2014. Assume that the sample is a random sample of the MTURK population, and that the proportion of Wharton listeners vs. Sirius listeners in the general population is the same as that in the MTURK population. Write a brief executive summary to summarize your findings and how you came to that conclusion.

To be specific, you should include:

  1. Goal of the study
  2. Method used: data gathering, estimation methods
  3. Findings
  4. Limitations of the study.

2.3.1 Executive Summary

On May 24, 2014, we launched a survey using MTurk to estimate the audience size of Business Radio Powered by the Wharton School, a talk show that operates on SiriusXM. This survey offered $0.10 for each answered survey, and ran over six days with a maximum sample size of 2000.

Upon conclusion of the survey, we received 1764 responses, and cleaned up the data accordingly, removing responses that had incomplete or missing values, as well as values that did not make logical sense. Of the remaining 1725 responses, 69 of the respondents stated that they listened to the Wharton show, which is 4% of the total survey respondents.

Assuming that the sample is a random sample of the MTURK population, and additionally that the proportions of radio listeners in the MTURK population carry over to the general population, we can apply this proportion to the number of people who listen to SiriusXM in 2014 (given to be 51.6 million Sirius Radio listeners). This would suggest that there are approximately 2,587,725 listeners to Wharton’s podcast.

A major limitation of the study is that the assumptions made in the previous paragraph are undermined by examinations of the MTurk and general population demographics. For example, MTurk users must be ages 18 and over, whereas this is not true of the general population. In addition, the respondents to this survey were disproportionaly male, lower income, and higher educated compared to the average American, and possibly the average SiriusXM listener as well.

It is worth nothing that when we ran the above code, there were 67 people that had listened to both Wharton and Sirius, versus 69 people that had listened to Wharton only. This doesn’t make sense since Wharton is part of Sirius. We chose to use only the 67 people that had listened to both Wharton and Sirius for the proportion, because it did not make sense for someone to listen to Wharton but not Sirius, since Wharton is hosted on Sirius.

2.4 New task

Now suppose you are asked to design a study to estimate the audience size of Wharton Business Radio Show as of today: You are given a budget of $1000. You need to present your findings in two months.

Write a proposal for this study which includes:

  1. Method proposed to estimate the audience size.
  2. What data should be collected and where it should be sourced from. (Can we use ChatGPT to get us a rough estimate?)

Please fill in the google form to list your platform where surveys will be launched and collected HERE

A good proposal will give an accurate estimation with the least amount of money used.

2.4.1 Proposal

State the name and Attach a URL where you want to launch a survey or describe your own way to collect information

  1. To estimate the audience size, we could prioritize estimating the proportion of SiriusXM listeners that listen to Wharton, as opposed to surveying the general US population. SiriusXM has used Nielsen in the past to survey subscribers’ listening (https://www.insideradio.com/free/siriusxm-hires-nielsen-to-survey-subscribers-listening/article_664fa9fe-cb8c-11e8-ba60-d76021532e05.html) and could potentially conduct a similar survey again. In this survey we could ask more granular questions about which shows SiriusXM users listen to (to avoid bias where only Wharton radio listeners respond), and also ask more specific questions about viewership (how often does someone listen, for how long, etc.) to better understand the audience.

Explain briefly Pros and Cons of your proposal

  1. Pros: Does not survey too broadly (only SiriusXM users would listen to the Wharton radio show anyway), more likely to serve as a random sample of SiriusXM users compared to MTurk, which did not adequately represent them or the general US population

Cons: It will likely be more expensive than MTurk to incentivize users to fill out the survey, because the audience is likely higher-income and older than the MTurk users. It risks overlooking casual listeners who do not check in on SiriusXM at all. Also, different radio listeners having a habit of answering surveys at different rates, so this survey assumes that all types of radio listeners are equally likely to answer surveys, which is not necessarily the case.

3 Case study 2: Women in Science

Are women underrepresented in science in general? How does gender relate to the type of educational degree pursued? Does the number of higher degrees increase over the years? In an attempt to answer these questions, we assembled a data set (WomenData_06_16.xlsx) from NSF about various degrees granted in the U.S. from 2006 to 2016. It contains the following variables: Field (Non-science-engineering (Non-S&E) and sciences (Computer sciences, Mathematics and statistics, etc.)), Degree (BS, MS, PhD), Sex (M, F), Number of degrees granted, and Year.

Our goal is to answer the above questions only through EDA (Exploratory Data Analyses) without formal testing. We have provided sample R-codes in the appendix to help you if needed.

3.1 Data preparation

  1. Understand and clean the data

Notice the data came in as an Excel file. We need to use the package readxl and the function read_excel() to read the data WomenData_06_16.xlsx into R.

a). Read the data into R.

b). Clean the names of each variables. (Change variable names to Field,Degree, Sex, Year and Number )

c). Set the variable natures properly.

d). Any missing values?

  1. Write a summary describing the data set provided here.

Summary: The provided dataset contains information about the number of degrees awarded in each major to both females and males. It consists of 10 fields of study, with 9 of them related to science and engineering, while the remaining field pertains to non-science and engineering disciplines. The data spans a period of 11 years from 2006 to 2016. Additionally, the dataset breaks down the degrees into different types, including Bachelor’s, Master’s, and PhDs. Each record in the dataset likely represents the number of degrees awarded in a specific major, gender, and degree type for a particular year within the specified timeframe. This dataset can be used to analyze trends and patterns in degree attainment across different fields of study and genders over the specified period.

a). How many fields are there in this data?

There are five columns, and ten “fields” in the sense of majors being pursued.

b). What are the degree types?

The degree types are BS, MS, and PhD.

c). How many year’s statistics are being reported here?

11 years of statistics are being reported.

3.2 BS degrees in 2015

Is there evidence that more males are in science-related fields vs Non-S&E? Provide summary statistics and a plot which shows the number of people by gender and by field. Write a brief summary to describe your findings.

In 2015, Across all degree types, Females obtained more non-S&E (Science and Engineering) degrees, whereas males had a higher number of S&E degrees.

When considering S&E fields individually, males predominated in most majors, with the exception of Psychology and Social Sciences where females had a higher degree count. Particularly noteworthy was the substantial gender disparity observed in the Engineering field, where males obtained approximately 3.59 times more degrees than females.

These findings underscore the gender imbalances within different academic disciplines, highlighting areas where females are achieving greater representation, such as non-S&E fields, while also indicating significant disparities, particularly in traditionally male-dominated fields like Engineering and S&E fields.

Across different degree types, the biggest imbalanced was noted in PhD degrees where males had notably more degrees that female. However, females had higher number of non-S&E degrees across the three degrees types.

## `summarise()` has grouped output by 'Field'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'SE'. You can override using the `.groups`
## argument.

## `summarise()` has grouped output by 'SE', 'Sex'. You can override using the
## `.groups` argument.

3.3 EDA bringing type of degree, field and gender in 2015

Describe the number of people by type of degree, field, and gender. Do you see any evidence of gender effects over different types of degrees? Again, provide graphs to summarize your findings.

Summary:In general, S&E fields showed lower number obtained than non-S&E regardless of gender and Degree type. Among S&E fields, similar trends were observed comparing genders. male or female dominance was not affected by degree type. However, the highest number of degrees given were BS followed by MS then PhD. (please refer to graph below and above)

## `summarise()` has grouped output by 'SE', 'Sex', 'Year'. You can override using
## the `.groups` argument.

3.4 EDA bring all variables

In this last portion of the EDA, we ask you to provide evidence numerically and graphically: Do the number of degrees change by gender, field, and time?

line chart year vs number of degrees

## `summarise()` has grouped output by 'SE'. You can override using the `.groups`
## argument.

## `summarise()` has grouped output by 'Degree', 'SE', 'Sex'. You can override
## using the `.groups` argument.

3.5 Women in Data Science

Finally, is there evidence showing that women are underrepresented in data science? Data science is an interdisciplinary field of computer science, math, and statistics. You may include year and/or degree.

Summary: Referring to the plot below, it is clear that women have lower degree numbers that males in data scince across all degree types.

## `summarise()` has grouped output by 'Degree', 'SE', 'Sex'. You can override
## using the `.groups` argument.

3.6 Final brief report

Summarize your findings focusing on answering the questions regarding if we see consistent patterns that more males pursue science-related fields. Any concerns with the data set? How could we improve on the study?

3.6.1 Answer

Findings: The analysis of the data reveals consistent patterns suggesting a higher inclination of males towards pursuing science-related fields. Across various degree types, males consistently obtained a greater number of degrees in Science & Engineering (S&E) fields compared to females. Notably, the gender gap was particularly significant in the Engineering field, with males recording a substantially higher number of degrees than females.

This trend persisted across all degree types examined, indicating a consistent disparity in gender representation within science-related disciplines. Furthermore, the analysis highlighted a noticeable gender discrepancy in data science-related fields, with males outnumbering females in obtaining degrees in this area. Overall, the findings underscore the existing gender disparity in science-related fields, emphasizing the need for initiatives aimed at encouraging and supporting greater female participation and representation in these disciplines.

Data was obtained from survays by Department of Education; Census Bureau, Department of Commerce; and Bureau of Labor Statistics, Department of Labor and it seemed to include different areas and schools in the US. Indeed, the sample is random.

Concerns: - The data does not include females and males pursuing a double major across the two disciplines S&E and non-S&E, it did not specify which category these individuals were included in. This might have increased the number of non-S&E degrees given to females. - Degrees did not include MD or JD excluding more than 0.5% of the US population in the study. (https://en.wikipedia.org/wiki/Physicians_in_the_United_States) - Data did not include career outlook into consideration. Individuals who obtain a degree but decide to purue a job in another filed are not represented in the study.(https://ncses.nsf.gov/pubs/nsf19304/digest/data-sources)

Suggestions: The study could benefit from including race to future understand how the female degree number is distributed among race.

4 Case study 3: Major League Baseball

We would like to explore how payroll affects performance among Major League Baseball teams. The data is prepared in two formats record payroll, winning numbers/percentage by team from 1998 to 2014.

Here are the datasets:

-MLPayData_Total.csv: wide format -baseball.csv: long format

Feel free to use either dataset to address the problems.

4.1 EDA: Relationship between payroll changes and performance

Payroll may relate to performance among ML Baseball teams. One possible argument is that what affects this year’s performance is not this year’s payroll, but the amount that payroll increased from last year. Let us look into this through EDA.

Create increment in payroll

a). To describe the increment of payroll in each year there are several possible approaches. Take 2013 as an example:

- option 1: diff: payroll_2013 - payroll_2012
- option 2: log diff: log(payroll_2013) - log(payroll_2012)

Explain why the log difference is more appropriate in this setup.

Using a log difference normalizes the differences in payroll subject to different teams payroll, making it scale-independent. This means that we can compare a 10% increase in payroll regardless of whether it is for a team that has 100 million in payroll or 20 million in payroll. Log differences can also be beneficial for statistical analyses for models that assume normality because log transformations stabilize the variance and can shape the data distribution to be more normal. Furthermore, for small percent changes, using log differences can approximate percent change so we can have a more standardized comparison of a change in payroll (e.g., an increase of payroll by 10% is more informative than dealing in numerical terms, say an increase of $10 million). Finally, using log differences can simplify analysis of growth rates (for small percent changes) and compounded growth by converting multiplication into addition.

b). Create a new variable diff_log=log(payroll_2013) - log(payroll_2012). Hint: use dplyr::lag() function.

4.1.1 Answer

c). Create a long data table including: team, year, diff_log, win_pct

4.1.2 Answer

4.2 Exploratory questions

a). Which five teams had highest increase in their payroll between years 2010 and 2014, inclusive?

The teams with the highest percent change in payroll between 2010 and 2014, inclusive, are the Los Angeles Dodgers, the Toronto Blue Jays, the Washington Nationals, the San Diego Padres, and the Arizona Diamondbacks, in descending order.

The bar graph above shows the percent change in payroll for the 30 teams in the MLB from 2010 to 2014. This percent change in payroll was calculated by multiplying the log differences in payroll of the year before. We use this statistic, rather than absolute payroll value, to better judge whether a change in payroll has an effect on win percentage gain. Using percent change also allows us to better compare across teams within vastly different payrolls (a $1 million difference in payroll will not affect the New York Yankees as much as the Miami Marlins).

In this period, almost every team increased their payroll. The Los Angeles Dodgers led the pack with nearly a 200% increase in payroll. Only two teams did not increase their payrolls during this period. These two teams were the Houston Astros and the Miami Marlins, who decreased their payrolls by around 2% and 23% respectively.

b). Between 2010 and 2014, inclusive, which team(s) “improved” the most? That is, had the biggest percentage gain in wins?

The five teams with the highest “average” win percentage increase between 2010 and 2014 are the Pittsburgh Pirates, Baltimore Orioles, Washington Nationals, Kansas City Royals and Seattle Mariners. This “average” win percentage was calculated using the slope of a best fit line using the different teams’ win rates per year. This criteria is used to estimate the best overall performances of teams across five years (assuming a payroll increase would affect performance for subsequent years as well) since performances from a single year could be attributed to random chance.

The average win percentage gains range from a 5.19% increase to a -4.75% decrease. However, with a p-value of above 0.05 for many teams, such as Washington Nationals and Cleveland Indians, we fail to reject the null hypothesis in these cases. Thus, it is hard to say definitively whether the change in win percentage is statistically significant for many teams.

The bar graph above shows the 30 teams of the MLB and their “average” win percentage gain from 2010 to 2014, obtained from running a regression on their year to year win percentage rate. We use this average win percentage gain statistic between 2010 to 2014 to balance against other factors, such as luck or bad year, that might affect analyses that focus solely on year to year win percentage rates.

As we might expect, roughly half of the teams show a positive win percentage gain between 2010 to 2014 and the other half show a negative win percentage gain. This is because the 30 teams play each other and one team’s win must also be another team’s loss. Somewhat surprisingly, we see that the Pittsburgh Pirates followed by the Baltimore Orioles and the Washington Nationals had the highest win percentage gains in this period. Although admittedly I am not a baseball fan, the teams I would expect to top this chart would have been teams I have heard of like the New York Yankees or the Boston Red Sox. This discrepancy might be explained by the fact that this chart only shows the gain (or loss) in win percentage from year to year. Being teams with traditionally high win rates, the Yankees and the Red Sox cannot be expected to improve by that much more every year and may simply be “reverting back to the mean” during this period.

4.3 Do log increases in payroll imply better performance?

Is there evidence to support the hypothesis that higher increases in payroll on the log scale lead to increased performance?

Pick up a few statistics, accompanied with some data visualization, to support your answer.

First, let us look at a side by side comparison of the top six teams with the largest log payroll change and compare it to the top six teams with the largest win percentage gain.

## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine

Comparing the top six teams for each variable, win percentage change and payroll percent change, we see some overlap (the Washington Nationals and the Kansas City Royals), but overall the top teams that had the highest win percentage change were not the same teams who had the highest payroll percent change. This may suggest to us that payroll change does not have a huge impact on win percentage change.

This graph shows the relationship between win rate percent change and payroll percent change. The light blue bar graph shows the total payroll percent change from 2010 to 2014 for each MLB team. The red line graph shows the average win percent gains between 2010 to 2014. From this graph, we are unable to see any relationship between payroll and win percentage changes.

Let us take another visualization of the data, this time looking at a scatterplot.

This scatterplot shows the payroll change (%) from 2010 to 2014 against average win percentage change from 2010 to 2014 for every team in the MLB. We see that the Houston Astros and the Miami Marlins (colored red) are outliers in our dataset as they are the only two teams with overall decreasing payrolls from 2010 to 2014.

In this scatterplot, we removed the two outliers, the Houston Astros and the Miami Marlins. The blue line marks the average win percentage gain, which is at 0%. This is because for one team to increase their win rate, another team must decrease their win rate. The red line marks the regression line fitted onto the data. Of note here are the Los Angeles Dodgers, who had the greatest increase in payroll. The Pittsburgh Pirates, Washington Nationals, and Oakland Athletics all “beat” the average for how they were expected to do with the increase in payroll. The Boston Red Sox and the New York Yankees are at the bottom of this scatterplot.

Using a percent change in payroll from 2010 to 2014, inclusive, we find that there is not very strong evidence of payroll change being correlated with average win percentage change. The variable payroll_pctchange, as indicated by the regression model (0.03453), is the slope of the relationship between payroll percentage change and average win percentage change. This means for every one percent increase in payroll, the average win rate percent change increases by around 3.45%. However, the p-value for this coefficient is 0.0672, which is above the conventional 0.05 significance level but close, indicating a suggestive but not definitive positive relationship between payroll changes and performance. Moreover, the R-squared value (0.1231) indicates that only 12.31% of the variability in the average win percent change is explained by this model. This is relatively low, suggesting that other factors not included in the model, may better explain and are influencing the average win percent change.

Next, let us run a regression comparing the year to year changes in win rate compared to year to year changes in payroll. The two statistics were calculated using the difference in win rates from the current to the previous year and the difference in log payroll from the current to the previous year. This is contrast to our previous methodology, in which we “averaged” the change in win rates from 2010 to 2014, and summed the total payroll difference between the five years. Using this new criteria (per year differences) may allow us to see into the data, what was previously hidden because of the use of averages.

Looking at a regression run on the yearly log changes in payroll on the yearly changes in win rate, again, we find that there is no statistically signficant finding.

Let us plot these regression analyses to visualize these differences.

The right plot shows the total payroll change from 2010 to 2014 and the average win percentage change from 2010 to 2014 (our first analysis). The middle plot shows the difference in log payroll change on the difference in win rates per year from 2010 to 2014 (the new methodology). The right plot shows log payroll on win percentages per year (what we saw in class). As we saw from class, there does seem to be a pretty convincing postive relationship between payroll and win rates in the right graph. However, we fail to see this relationship convincingly mapped out when it comes to total payroll changes and average win percentages changes from 2010 to 2014. Moreover, we see the opposite relationship when it comes to yearly differences in payroll on yearly differences in win rates.

To explain this discrepancy, let us look at year to year changes in the data, starting with 2010.

Between 2010 and 2014, we see this finding of no relation holds true. There does not seem to be any noticeable pattern between log(payroll) difference from the previous year and changes in win rates from the previous year.

Finally, let’s look simply at team differences to see whether there is any pattern between payroll increases and win rates.

While looking at all teams, we see that the differences in win rates on differences in log payroll changes differ enormously between teams. Some teams increasing their payrolls actually has a negative relationship with win rate. To simplify the graphic, we show only a couple hand selected teams to illustrate the differences in between teams of the relationship between differences in payroll and the differences in win rate.

4.4 Comparison

Which set of factors are better explaining performance? Yearly payroll or yearly increase in payroll? What criterion is being used?

Yearly payroll seems to be a better indicator of performance than yearly increase in payroll. Increase in payroll does not seem to have any statistically significant effects on increasing win rates. Yet, based on the data we analyzed in class, yearly payroll (which in relative terms tend to remain the same between teams) does seem to be correlated with win percentage. There are several possible explanations on why this is the case. The first is that there is some higher order polynomial or logistic regression hiding in the new data that we cannot tell through a linear regression. In other words, it would be overly simplistic to assume that an added dollar to payroll translates in linear form to an increase in win rates.

A second reason could be because there are generally different classes of teams, with richer teams generally performing better (this lends some credence to Brad Pitt’s line in the movie Moneyball: “there are rich teams and there are poor teams. Then there’s fifty feet of crap, and then there’s us”). It would take a poorer team several years of consistently high payrolls to turn their team around. A one year massive increase in payroll would be unlikely to change a team’s performance.

The criteria we used for this analysis used both the average win rate across all years between 2010 and 2014 (by finding the slope of the line of best fit of the win rates from 2010 to 2014) as well as a yearly analysis on the difference in win rates on the difference in payroll from the year before. We performed a regression analysis on both these possibilities. We found that there were no statistically significant trends between total increase in payroll from 2010 to 2014 and average win percentage gain. We also found that there was no statistically significant trends between year to year differences in log payroll and year to year differences in win rates. Moreover, while the overall trend using the averaging method produced a positive correlation coefficient, using the year-by-year method produced a negative correlation coefficient. Thus, we conclude that there seem to be no significant relationship between increase in payroll and increase in win rates.