Team Victory Dance
M11 Final Paper
Winning Percentage in Sports
Team Members:
TABLE OF CONTENTS
Baseball Defensive Model Building
Teams within professional sports leagues are always looking for an advantage over their competitors. For Major League Baseball (MLB) and the National Hockey League (NHL) our analysis looks at predicting a team’s regular season winning percentage based on a wide variety of variables. We look to identify those variables that have strong correlations with winning percentage and look to detect those variables that are applicable to both sports and may be consider “rules of thumb” for predicting likely winning percentage. For both sports, the effects of all-Stars on a team’s winning percentage are investigated. Furthermore, for MLB we explore the effects of defensive and offensive variables on winning percentage.
The American professional sports leagues generate a significant amount of revenue annually. Major League Baseball (MLB) and the National Hockey League (NHL) annually generate $4.7 billion1 and $3.3 billion2, respectively. Each member of a professional team has a financial incentive to increase the number of team wins. According to Burger and Walters’s (2003) analysis of MLB data from 1995-1999, team’s that are expected to be competitive (winning percentage >52%) derive up to six times more marginal revenue for each additional victory than teams not expected non-competitive teams. Furthermore, teams in large markets compared to smaller markets can derive an additional six fold for each additional win 3. Clearly, teams with greater revenues are able to pay for higher salaries of managers and staff and invest more into their facilities. Therefore, the ability of a team to look at what factors play a significant role in their winning percentage and predict their own is valuable. Managers and trainers may be able to “coach” to the factors that are essential to a team’s winning percentage with the hopes of improving it.
Besides those directly linked to the respective sports teams this analysis may be valuable to other interest groups, such as fans, oddsmakers, sports analysis, and fantasy sports players. Fantasy sports participation has grown tremendously. The Fantasy Sports Trade Association estimated in 2010 that 32 million people age 12 and above in the U.S. and Canada played fantasy sports. From the years 2004-10 participation grew over 60 percent4. An equation that estimates the winning percentage of a team may provide additional information for fantasy sports participants as they pick their teams and players.
All of the needed data could not be found in precompiled datasets. To meet the needs of this project, there was a need to crawl data from the web using PHP scripts. This data was stored in a MySQL database and populated seven key tables: ROSTER, ATHLETE, TEAM, All_Star_Roster(ASR), Season_Stats(SS), and Game_Stats(GS). ATHLETE contains information on an athletes’ full name and birth date. The TEAM table contains information about the sports team: sport, name, and city. ROSTER includes all the information stored in TEAM and ATHLETE plus the date when a player joins and leaves the team. ASR contains the ATHLETE dataset as well as year information and its sport category. At last, GS and SS record stats of each team on the scale of games and seasons, respectively.
Table 1
Baseball |
|
|
Lahman’s Database (2012) | Web address: | |
| Fields: | ERA, Weighted ERA of Starters, Average Saves, Average Hits Allowed, Average Errors, Average Double Plays, Fielding Percentage, Average Runs, Average At Bats, Average Double Plays, Average Triples, Average Homeruns, Average Base on Balls, Average Strikeouts, Average Num. of Stolen Bases |
| Format: | MS Access Database |
| Size: | ~ 60 MB (largest table 18,126 rows) Data from 1891-2012 |
ESPN | Web address: | |
| Fields: | Game Number within Season, Points For, Points Against, Win or Loss, Home/Away Team, Attendance |
| Format: | Web crawled and stored in MySQL Database |
| Size: | ~ 7 MB (largest table 58,297 rows) Data from 2002-2013 Season |
Baseball Almanac | Web address: | http://www.baseball-almanac.com/ |
| Fields: | All-stars, All-Star Pitchers, All-Star Starters |
| Format: | Web crawled and stored in MySQL Database |
USA Today | Web address: | http://content.usatoday.com/sportsdata/baseball/mlb/salaries |
| Fields: | Salaries |
| Format: | Web crawled and stored in MySQL Database |
Table 2:
Hockey | ||
QuantHockey | Web address: | |
| Format: | .CSV imported to database |
Hockey Reference | Web address: | |
| Fields: | All-Stars, All-Star Goalies, All-Star Starters |
| Format: | Web crawled and stored in MySQL Database |
ESPN | Web address: | |
| Fields: (per a game) | Game Number within Season, Points For, Points Against, Win or Loss, Home/Away Team, Ties, Shots For, Shots Against |
| Format: | Web crawled and stored in MySQL Database |
| Size: | ~ 7 MB (largest table 58,297 rows) Data from 2002-2012 Season |
NHL | Web address: | |
Open Source Sports | Web address: |
Table: Athlete
Name of Variables | Description |
Name_First | First Name of athlete |
Name_Last | Last Name of athlete |
Birth_DT | Used to calculate age |
Table: Team
Name of Variables | Description |
Sport | Sport |
Name | Name of the team |
City | The city where the team is based |
Table: Roster
Name of Variable | Description |
Team | Team |
Start_DT | Date on which player joins the team |
End_DT | Date on which player leave the team |
Table: All_Star_Roster(ASR)
Name of Variable | Description |
Athlete | Athlete |
Year | Year |
Sport | Sport |
Table: Season_Stats
Name of Variable | Description |
Team | Team |
Year | Year |
Salary | Salary |
Points_For | Average points scored by the team |
Points_Against | Average points allowed by the team |
Games_Played | Numbers of games played |
Made_Playoff_YN | Whether the team made the playoffs |
Champion_YN | Whether the team won its championship |
Table: Game_Stats
Name of Variable | Description |
Team | Team |
Year | Year |
Game_Number | Game number in a season |
Points_For | Points scored for a game |
Points_Against | Points allowed for a game |
Time_Of_Possession | Time of possession for a game |
Win_YN | Outcome of a game |
In this section, correlation and other analyses are performed on any potential factors that may be key to predict winning percentage. There are four subsets of our data that correspond to four models built for the project. Many variables are dropped due to their poor correlations with the response variable.
Original Goal
Originally the goal was to use the hockey attributes to predict a championship but due to a champion being binary and many other factors related to championship we change the response variable to winning percentage.
Refined Goal
The goal of this model is to predict hockey winning percentage based on a offensive attributes, defensive attributes, and the roster attributes. Then compare this model to the baseball model being developed in the project.
Model Building Process
The original dataset included following variables for each hockey team from 1999-2012 seasons:
Variable Blue - Kept Black - Dropped | Response / Explanatory | Description |
Winning Percentage | Response | A team’s winning percentage for the season |
Points For | Explanatory | The number of points (goals) the team scored during the season |
Points Against | Explanatory | The number of points (goals) the team allowed to be scored during the season |
Salary | Explanatory | The team’s roster salary for the year |
Average Age | Explanatory | The team’s roster average age |
Playoff Experience | Explanatory | The team’s roster average amount of playoff experience |
All Stars | Explanatory | The number of All Star’s on the team’s roster for the year. |
Previous Year Winning Percentage | Explanatory | A team’s winning percentage from the previous year. |
Winning Percentage by Quarter | Explanatory | A team’s winning percentage by each quarter of a season |
Possession | Explanatory | A team’s time of possession for the hockey puck |
Refined Variables
Model Analysis
Winning Percentage (WP) vs Points For (PF)
Definitely a good positive linear relationship between Winning Percentage (WP) and Points For (PF). Although there seems to be a slight curve to the data so when we model it we may use a square. Looking at the R-Square we see it is 0.5202 which is pretty good showing that WP accounts for about 52% of the variability in the model. F/t values are also low which is
very good.
Winning Percentage (WP) vs Points Against (PA)
Definitely a good negative linear relationship between Winning Percentage (WP) and Points Against (PA). This does not appear to be a curve and that would make sense because if you give up many points/runs in a game you are very likely to lose. Looking at the R-Square value we get 0.3367 with good F/t values.
One aspect that was reviewed regarding PF and PA was that in some seasons are shorter due to Olympics and strikes. Hence, we should use PF per game (PFPG) and PA per game (PAPG). Here are those scatter plots to confirm the same trends hold true:
We can see that the same linear relationship exists for PF and PFPG as well as PA and PAPG. The regression data is not influenced either. So to be more accurate we will use the PFPG and PAPG in building the model.
Winning Percentage (WP) vs. Average Player Age (AVG_AGE)
There does not appear to be a linear relationship with AVG_AGE. When we compute the Linear Regression we get a low R-Square of 0.0924.
We will try to multiple the AVG_AGE by number of games played that season.
Still no obvious linear relationship and the R-Square value goes down to 0.0222.
Next we will try to adjust the AVG_AGE by standardizing it to a Z-score.
Still no obvious relationship and the R-Square value remains the same as AVG_AGE.
Average age does not appear to be strongly tied to winning percentage. We will put it in the model on a test to see to make sure but it will likely be dropped.
Winning Percentage (WP) vs. Average Playoff Experience (APE)
No obvious linear relationship. Again we will consider it but likely not use it in the final model.
Winning Percentage (WP) vs. Previous Year Winning Percentage (PYWP)
There appears to be a linear relationship between WP and PYWP and when we look at the R-Square we get 0.3120 and good F/t values. This is definitely one variable we should include in the model.
Winning Percentage (WP) vs. Salary
Seems to have a curved linear relationship but this scatter plot does not take into account the increase in teams salary each year. We should do a ratio of salary to average league salary for that year. Before we do a ratio we review the R-Square of 0.1425 with low F/t values.
Repeating the plot but this time with a Salary Ratio of Team Salary over League Average Salary (for that year).
More linear but there is still a lot of variance. Actually it looks almost normally distributed but with too many right handed tails between 1.5 and 2. The R-Square isn’t really impacted but the ratio takes into account an increase in salary each year.
Winning Percentage (WP) vs. All Stars (AS)
Where the WP is compared to the number of AS on the team for that year.
The R-Square is very poor for linear regression at 0.0139 and the F/t values are not great at 0.0323. More analysis will need to be done to see if AS play any impact in WP.
Baseball All-Stars
The all-star mean for each MLB team was compared to the champion all-star mean over the course of 11 years. There are some factors to consider before delving into the details. First, MLB mandates that every team has at least one representative. Second, all-stars are selected by fans, players, and managers in a somewhat arbitrary and non-quantitative manner.
Two tables of categorical and numerical data were paramount to the analysis. The table "champions" consisted of each MLB champion and its corresponding year from 2002 to 2012. The table "all_stars" consisted of every all-star and his corresponding year and team from 2002 to 2012. The tables all_stars and champions were combined to associate each champion with its number of all-stars for the given year.
After the data prep, a histogram was created with the teams on the x-axis and the corresponding number of all-stars for the given year on the y-axis. The all-star mean was 2.27 and the champion all-star mean was 3.27. A line indicating the all-star mean was superimposed on the histogram to show the relationship between it and the number of all-stars for each champion. These numbers may have suggested that there was a correlation between all-stars and champions, but this suggestion must be qualified because non-champions were not considered.
The next logical step would be to integrate data from non-champions, which may reveal a true correlation. Other factors, such as weighted values for all-star rosters, if considered may also be more revealing.
Baseball WP & Defensive Variables
The original dataset included the following variables for each MLB team from 1969-2012:
Variable | Description | Type |
Winning Percentage | A team’s winning percentage for the season | Quantitative |
ERA | A team’s ERA (Earned Runs Average ) of their pitchers | Quantitative |
Weighted ERA of Starters | This is a weighted ERA of team’s starting pitchers | Quantitative |
Average Saves | The average number of saves for a team per a game | Quantitative |
Average Hits Allowed | The average number of hits a team allows its opponent per a game | Quantitative |
Average Errors | The average number of errors a team commits per a game | Quantitative |
Average Double Plays | The average number of double plays a team makes per a game | Quantitative |
Fielding Percentage | A team’s fielding percentage | Quantitative |
A look at the normality of winning percentage shows that our data is fairly normal.
ERA - When plotted against winning percentage there is a moderate negative linear correlation. A first order model should be sufficient to model effects.
Weighted ERA - When plotted against winning percentage there is a moderate negative linear correlation. A first order model should be sufficient to model effects.
Average Saves - When plotted against winning percentage there is a weak to moderate positive linear correlation. A first order model should be sufficient to model effects.
Average Hits Allowed - When plotted against winning percentage there is a moderate negative linear correlation. A first order model should be sufficient to model effects.
Average Errors - When plotted against winning percentage there is a weak to moderate negative linear correlation. A first order model should be sufficient to model effects.
Average Double Plays - When plotted against winning percentage there is appears to be very little correlation. This variable may not prove to be significant in the model.
Fielding Percentage - When plotted against winning percentage there is a weak to moderate positive linear correlation. A first order model should be sufficient to model effects.
Baseball WP & General Variables
Data are collected from opersourcesport.com except salary for hockey which comes from USA today database.
Variables | Response / Explanatory | Description |
Winning percentage | Response | Winning percentage of each team in regular season |
Sum_Points_for | Explanatory | Average points scored by a team in regular season |
Sum_Points_against | Explanatory | Average points allowed by a team in regular season |
Normalized_salary | Explanatory | Salary for a team divided by average salary for the league in one season |
Normalized_age | Explanatory | Average age for each team in one season |
Normalized_for | Explanatory | Normalized value of variable Sum_Points_For |
Normalized_against | Explanatory | Normalized value of variable Sum_Points_Against |
Inverse_Normalized_against | Explanatory | Inverse value of normalized Sum_Points_against |
For_I_Against | Explanatory | Variable Normalized_for times variable Inverse_Normalized_against |
Efficiency_for | Explanatory | Variable Normalized_for divided by Normalized_salary |
Efficiency_I_against | Explanatory | Variable Inverse_Normalized_against divided by Normalized_salary |
E_For_E_I_Against | Explanatory | Variable Efficiency_For times Variable Efficiency_Inverse_against |
Salary is always the most straightforward method to evaluate the strength of a team and the most popular topic when the trading window is open. The manipulation of salary data(normalized and division) is the attempt to find out the most appropriate measure to evaluate the effects of salary on winning percentage.
Model Analysis
Scatter plots on the left side of the panel is generated by the raw data of each team(sum_points_for, sum_points_against and salary) against winning percentage. The x variables used in the scatter plots on the right side is the normalized raw data. For these three particular variables, scatter plots of normalized data are prefered to that of raw data. It appears that data after normalized have stronger linear relationship with winning percentage.
The special case for normalized data is the average age. It appears that distribution of raw data after normalized does not have the ‘shrink-down’ effect as other variables have. For the purpose to unify the format of data, normalized average age will be applied to build the regression model.
In this scatter plot, the x variable is normalized points for times inverse of normalized points against. It shows a strong positive linear relationship with winning percentage, which can be explained that points for and points against are the only two variables can directly determine the result of a game.
There is no clear relationship revealing by three figures above. It suggest that the player trading market is an efficient market meaning all stats and attributes of a player is on the table when he is involved in a transaction, thus, most of the time his value will be fairly price. These figures do show us a fact that to achieve a high winning percentage has nothing to with how wise you spend your money.
P-values for correlations between response variable and independent variables are all less than 0.01%. All proposed independent variables will be included in the first attempt to build the model.
Each project member leveraged their analysis and prepared a linear regression model to answer their hypothesis. Below each model is broken down by topic.
MLB All-Stars
Find a correlation between all-stars on a given team and its winning percentage.
Data are from MLB all-star games from 2000 to 2012
Variable | Response / Explanatory | Description |
Winning Percentage | Response | Regular-season winning percentage |
World Series Title | Response | Outcome in the World Series |
League Champion | Reponse | Outcome in the League Championship |
All-Stars | Explanatory | Number of all-stars |
All-Star Starters | Explanatory | Number of all-star starters |
All-Star Starting Pitcher | Explanatory | Representative an all-star starting pitcher |
There is no exact science to the selection of MLB all-stars. It is rather arbitrary, considering that MLB all-star starters are selected by the fans and the reserves by coaches. The process is filled with biases and other perturbations that may explain preliminary results.
The selections for most variables are self-evident, but one interesting one is whether the all-star starter is a pitcher. Pitching is often considered the most important component of a winning baseball team. Other variables in future models may include other positions as well, lest our preconceived notions have fooled us.
Although our analysis focuses on overall winning percentage, logistic regression has also been performed for the response variables World Series title and league champion. These response variables are being considered for the time being because they are what most general managers care about: titles.
Pearson Correlation Matrix
One surprising correlation in the Pearson correlation matrix is between winning percentage and number of all-stars at 63%. There are also some obvious ones, such as world series title and league championship -- possible concern for multicollinearity -- but these are supplementary response variables and will not be included in the final model.
stars starters pitcher win_pct league_win ws_win
stars 1.0000000 0.6325646 0.2087598 0.6030053 0.2218073 0.1042533
starters 0.6325646 1.0000000 0.3284649 0.4351742 0.2255815 0.1408505
pitcher 0.2087598 0.3284649 1.0000000 0.2213875 0.1758242 0.1221641
win_pct 0.6030053 0.4351742 0.2213875 1.0000000 0.3022187 0.2024750
league_win 0.2218073 0.2255815 0.1758242 0.3022187 1.0000000 0.6948083
ws_win 0.1042533 0.1408505 0.1221641 0.2024750 0.6948083 1.0000000
First-Order Model
The first-order model has a significant p-value, which indicates that at least one t-test is significant. A look at the t-test indicates that there are three significant variables, and therefore sufficient evidence to reject the null hypothesis. The adjusted r-squared is 37%, which indicates 37% of the variability in winning percentage is explained by the model. It is not an ideal adjusted r-squared but shows that there is a positive correlation between the explanatory and response variables. All-star starters has a low t-test probability, so it is a candidate for exclusion.
Call:
lm(formula = tas$win_pct ~ tas$stars + tas$starters + tas$pitcher)
Residuals:
Min 1Q Median 3Q Max
-0.196521 -0.039786 -0.002737 0.043699 0.167676
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.437186 0.005237 83.475 <2e-16 ***
tas$stars 0.024768 0.002355 10.515 <2e-16 ***
tas$starters 0.004846 0.004274 1.134 0.258
tas$pitcher 0.025015 0.012201 2.050 0.041 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.05677 on 386 degrees of freedom
Multiple R-squared: 0.3752 Adjusted R-squared: 0.3704
F-statistic: 77.28 on 3 and 386 DF p-value: < 2.2e-16
Second-Order Model
The second-order model’s results are quite similar to the first order’s, so following the principle of Occam’s razor, the first-order model is sufficient.
Call:
lm(formula = tas$win_pct ~ tas$stars + tas$starters + tas$pitcher +
tas$stars^2 + tas$starters^2)
Residuals:
Min 1Q Median 3Q Max
-0.196521 -0.039786 -0.002737 0.043699 0.167676
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.437186 0.005237 83.475 <2e-16 ***
tas$stars 0.024768 0.002355 10.515 <2e-16 ***
tas$starters 0.004846 0.004274 1.134 0.258
tas$pitcher 0.025015 0.012201 2.050 0.041 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.05677 on 386 degrees of freedom
Multiple R-squared: 0.3752 Adjusted R-squared: 0.3704
F-statistic: 77.28 on 3 and 386 DF p-value: < 2.2e-16
Residual Plots
The residual plots make clear that the residuals are homoscedastic and therefore no violations of any of the four residual assumptions.
Relationships Between Variables
The scatter plots of the relationships between variables are rather interesting. There does not seem to be a relationship between few all-stars and winning percentage, but there does, however, seem to be one with the more all-stars a team has. This trend extends to all-star starters, as well, but surprisingly, all-star starting pitchers, too. Over the course of 12 years, a team with an all-star starting pitcher has at least a winning percentage of a little under 50%, with most teams above that.
First-Order Forward Stepwise Regression
There are not many variables to work with, so stepwise regression has little, if any, unambiguous value.
Analysis of Deviance Table
Initial Model:
tas$win_pct ~ tas$stars + tas$starters + tas$pitcher
Final Model:
tas$win_pct ~ tas$stars + tas$starters + tas$pitcher
First-Order Backward Stepwise Regression
It is no surprise that starters is removed from the final model, because it has the highest t-test.
Analysis of Deviance Table
Initial Model:
tas$win_pct ~ tas$stars + tas$starters + tas$pitcher
Final Model:
tas$win_pct ~ tas$stars + tas$pitcher
Second-Order Forward Stepwise Regression Model
Analysis of Deviance Table
Initial Model:
tas$win_pct ~ tas$stars + tas$starters + tas$pitcher + tas$stars^2 +
tas$starters^2
Final Model:
tas$win_pct ~ tas$stars + tas$starters + tas$pitcher + tas$stars^2 +
tas$starters^2
Second-Order Backward Stepwise Regression
Backward stepwise regression confirms that simpler is better and reduces the second-order model to the first-order model’s backward stepwise regression.
Analysis of Deviance Table
Initial Model:
tas$win_pct ~ tas$stars + tas$starters + tas$pitcher + tas$stars^2 +
tas$starters^2
Final Model:
tas$win_pct ~ tas$stars + tas$pitcher
NHL All-Stars
Find a correlation between all-stars on a given team and its winning percentage.
Data are from NHL all-star games from 2000 to 2011 :
Variable | Response / Explanatory | Description |
Winning Percentage | Response | Regular-season winning percentage |
All-Stars | Explanatory | Number of all-stars |
All-Star Goalies | Explanatory | Number of all-star goalies |
As with MLB, the selection of NHL all-stars is arbitrary. All-star starters are selected by the fans and the reserves by coaches. Further frustrating any possible correlations between winning percentage and all-stars is the NHL all-star game takes on many forms. There is no clear dichotomy of East vs. West, which is the basis in every other major sport. One year may follow such form, but the next may be the USA vs. the world. This frustrates possible correlations because there seems to be a different set of criteria for the selection of all-stars for each of its forms. Throughout the period between 2000 to 2011, 4 all-star games were cancelled due to three lockouts and the winter Olympics.
The selections for most variables are self-evident, but one interesting one is the number of all-star goalies. Goaltending is often considered the most important component of a winning hockey team.
Pearson Correlation Matrix
One surprising correlation in the Pearson correlation matrix is between winning percentage and number of all-stars at 31.5%, which is similar to MLB. All-star goalies are a subset of all-stars, so it is surprising that the correlation is not much higher than 35.7%.
row.names | all-stars | all-star goalies | winning percentage | |
1 | all-stars | 1.0000000 | 0.3570540 | 0.3150173 |
2 | all-star goalies | 0.3570540 | 1.0000000 | 0.1499355 |
3 | winning percentage | 0.3150173 | 0.1499355 | 1.0000000 |
First-Order Model
The first-order model has a significant p-value, which indicates that at least one t-test is significant. A look at the t-tests indicates that there is one significant variable, and therefore sufficient evidence to reject the null hypothesis. The adjusted r-squared is 9%, which indicates 9% of the variability in winning percentage is explained by the model. It is not an ideal adjusted r-squared but shows that there is a weak positive correlation between the explanatory and response variables. Goalies has a low t-test probability of 51.6%, so it is a candidate for exclusion.
Call:
lm(formula = winning ~ stars + goalies)
Residuals:
Min 1Q Median 3Q Max
-0.48058 -0.13566 0.01927 0.13948 0.49043
Coefficients:
Est. Std. Error t-value Pr(>|t|)
(Intercept) 0.45450 0.02057 22.093 < 2e-16 ***
stars 0.44051 0.09693 4.545 8.77e-06 ***
goalies 0.04120 0.06328 0.651 0.516
Residual standard error: 0.1969 on 237 degrees of freedom
Multiple R-squared: 0.1008
Adjusted R-squared: 0.09326
F-statistic: 13.29 on 2 and 237 DF
p-value: 3.384e-06
Second-Order Model
The second-order model’s results are quite similar to the first order’s, with the exception that the t-test for Goalies is higher. Following the principle of Occam’s razor, the first-order model is sufficient.
Call:
lm(formula = winning ~ stars + goalies + stars * goalies + stars^2 + goalies^2)
Residuals:
Min 1Q Median 3Q Max
-0.48218 -0.13622 0.01806 0.13352 0.48884
Coefficients:
Est. Std. Error t-value Pr(>|t|)
(Intercept) 0.46068 0.02197 20.965 < 2e-16 ***
stars 0.40389 0.10716 3.769 0.000207 ***
goalies -0.03421 0.11318 -0.302 0.762747
stars:goalies 0.27607 0.34346 0.804 0.422323
Residual standard error: 0.1971 on 236 degrees of freedom
Multiple R-squared: 0.1033
Adjusted R-squared: 0.0919
F-statistic: 9.062 on 3 and 236 DF
p-value: 1.058e-05
Residual Plots
The residual plots make clear that the residuals are homoscedastic and therefore no violations of any of the four residual assumptions.
Relationships Between Variables
One interesting relationship between all-stars and winning percentage is teams with four or more all-stars finish the season with a winning percentage over 50%, considering the all-star game takes place mid-season. There also seems to be a linear trend of the more all-stars a team has, the higher its winning percentage. Another interesting relationship is between goalies and winning percentage. It seems that there is no correlation between the number of all-star-goalie representatives and winning percentage. The variability of winning percentages of teams with two all-star-goalie representatives in a given year, which is quite rare, is nearly as high as teams with one and zero. This, however, may be a product of the instability of the all-star game format and its selection of all-stars.
The original dataset included following variables for each MLB from 1969-2012 seasons:
Variable | Response / Explanatory | Description |
Winning Percentage | Response | A team’s winning percentage for the season |
ERA | Explanatory | A team’s ERA (Earned Runs Average ) of their pitchers |
Weighted ERA of Starters | Explanatory | This is a weighted ERA of team’s starting pitchers |
Average Saves | Explanatory | The average number of saves for a team per a game |
Average Hits Allowed | Explanatory | The average number of hits a team allows its opponent per a game |
Average Errors | Explanatory | The average number of errors a team commits per a game |
Average Double Plays | Explanatory | The average number of double plays a team makes per a game |
Fielding Percentage | Explanatory | A team’s fielding percentage |
Num. of All Star Pitchers | Explanatory | The number of All Star Pitchers on a Team |
Initially the response variable was plotted against each explanatory variable. Those plots show that each of the explanatory variables has a weak to weak linear correlation to winning percentage. However, it appears that Average Double Plays has almost no correlation to winning percentage.
Before any additional analysis was done the explanatory variables were coded. They were normalized using z-scores for the sample dataset. After which a Pearson Correlation between the explanatory variables was checked. The results are in the table below. The analysis shows that ERA and weighted ERA are highly correlated.
winPerct | ERA | wtERA | avgSV | avgHA | avgE | avgDP | |
winPerct | 1 | -0.49649 | -0.47086 | 0.492047 | -0.43724 | -0.29749 | -0.11901 |
ERA | -0.49649 | 1 | 0.962418 | -0.07717 | 0.832049 | -0.16288 | 0.208530 |
wtERA | -0.47086 | 0.962418 | 1 | -0.01977 | 0.803426 | -0.17953 | 0.213868 |
avgSV | 0.49204 | -0.07717 | -0.01977 | 1 | -0.1113 | -0.36077 | -0.12008 |
avgHA | -0.437237 | 0.83205 | 0.803426 | -0.1113 | 1 | 0.0305549 | 0.319215 |
avgE | -0.297491 | -0.16288 | -0.17953 | -0.36077 | 0.030554 | 1 | 0.007880 |
avgDP | -0.11901 | 0.208530 | 0.213868 | -0.12008 | 0.319215 | 0.0078802 | 1 |
This result is not surprising. In professional baseball the majority of the pitches thrown are by the starting pitcher. While in more recent times this trend appears to be changing it is clear why a team’s starting pitchers have a large influences of a team’s overall ERA. To remove the issue of multicollinearity from the data Weighted ERA was dropped as an explanatory variable. The variable ERA was kept because it represents data for every pitcher on a team and not just the starting pitchers.
Variable screen was the next step in the analysis. A forward and reverse stepwise regression was performed on the dataset without Weighted ERA. The dataset used included not only the main effect variables but also all of the interaction variables. The two stepwise regressions show slightly different results. However, both showed ERA is the most impactful variable and that Average Double Plays as not impactful.
From the results of variable screening selection four models were built. Models One and two were initially created and after some analysis models three and four were added. One model has only the main effects and model two has main effects and interaction variables. In models three and four the variable All-Star pitchers was added. The variable Average Double Plays was not used in the building of any models based on the results of the variable screening.
Model 1:
Call:
lm(formula = winP ~ era + avgSv + avgHa + avgE)
Residuals:
Min 1Q Median 3Q Max
-0.138193 -0.033296 0.001098 0.032755 0.144536
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.499982 0.001419 352.297 < 2e-16 ***
era -0.043105 0.002737 -15.750 < 2e-16 ***
avgSv 0.025237 0.001540 16.386 < 2e-16 ***
avgHa 0.008635 0.002688 3.213 0.00135 **
avgE -0.019017 0.001627 -11.686 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.04912 on 1193 degrees of freedom
Multiple R-squared: 0.5098, Adjusted R-squared: 0.5081
F-statistic: 310.1 on 4 and 1193 DF, p-value: < 2.2e-16
E(yi) = 0.499982 - 0.043105(ERAi) + 0.025237(avg Savei) + 0.008635(avg Hits Allowedi) - 0.019017(avg Errori)
Where:
ERA = (ERA - 4.07) / 0.578
avg Save = (Avg Save - 0.23) / 0.055
avg Hits Allowed = (avg Hits Allowed - 8.91) / 0.557
avg Error = (Avg. Error - 0.75) / 0.141
Model 2:
Call:
lm(formula = winP ~ era + avgSv + avgHa + avgE + fp + eraAvgSv +
eraAvgHa + avgSvAvgE + avgSvFp + avgEFp)
Residuals:
Min 1Q Median 3Q Max
-0.130856 -0.033435 0.001138 0.032467 0.140866
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.499314 0.002144 232.887 < 2e-16 ***
era -0.042511 0.002755 -15.433 < 2e-16 ***
avgSv 0.028338 0.001619 17.507 < 2e-16 ***
avgHa 0.008426 0.002649 3.181 0.001507 **
avgE -0.020642 0.002483 -8.313 2.53e-16 ***
fp -0.003421 0.002334 -1.466 0.142923
eraAvgSv 0.007263 0.001537 4.725 2.58e-06 ***
eraAvgHa 0.004197 0.001115 3.764 0.000176 ***
avgSvAvgE -0.006927 0.002302 -3.009 0.002678 **
avgSvFp -0.005839 0.002338 -2.498 0.012641 *
avgEFp 0.003737 0.001712 2.182 0.029268 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.04824 on 1187 degrees of freedom
Multiple R-squared: 0.5296, Adjusted R-squared: 0.5257
F-statistic: 133.6 on 10 and 1187 DF, p-value: < 2.2e-16
E(yi) = 0.499314 - 0.042511(ERAi) + 0.028338(avg Savei) + 0.008426(avg Hits Allowedi) - 0.020642(avg Errori) - 0.003421(fielding P.i) + 0.007263(eraAvgSvi) + 0.004197(eraAvgHai) - 0.006927(avgSvAvgEi) - 0.005839(avgSvAvgFpi) + 0.003737(avgEFpi)
Where:
ERA = (ERA - 4.07) / 0.578
avg Save = (Avg Save - 0.23) / 0.055
avg Hits Allowed = (avg Hits Allowed - 8.91) / 0.557
avg Error = (Avg. Error - 0.75) / 0.141
fielding P. = (Fielding Percentage - 0.97) / 0.005
eraAvgSv = ERA * avg Save
eraAvgHa = ERA * avg Hits Allowed
avgSvAvgE = avg Save * avg Error
avgSvAvgFp = avg Save * Fielding P.
avgEFp = avg Error * Fielding P.
Model 3:
Call:
lm(formula = win ~ ERA + avgSV + avgHA + avgE + allS)
Residuals:
Min 1Q Median 3Q Max
-0.140982 -0.032918 0.001298 0.031421 0.147688
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.499983 0.001401 356.847 < 2e-16 ***
ERA -0.041608 0.002712 -15.344 < 2e-16 ***
avgSV 0.023786 0.001547 15.380 < 2e-16 ***
avgHA 0.010452 0.002675 3.907 9.87e-05 ***
avgE -0.017511 0.001628 -10.759 < 2e-16 ***
allS 0.008762 0.001580 5.544 3.65e-08 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.0485 on 1192 degrees of freedom
Multiple R-squared: 0.5226, Adjusted R-squared: 0.5206
F-statistic: 261 on 5 and 1192 DF, p-value: < 2.2e-16
E(yi) = 0.499983 - 0.041608(ERAi) + 0.023786(avg Savei) + 0.010452(avg Hits Allowedi) - 0.017511(avg Errori) + 0.008762(all Stars)
Where:
ERA = (ERA - 4.07) / 0.578
avg Save = (Avg Save - 0.23) / 0.055
avg Hits Allowed = (avg Hits Allowed - 8.91) / 0.557
avg Error = (Avg. Error - 0.75) / 0.141
all Stars = (all Stars - 0.77) / 0.784
Model 4:
Call:
lm(formula = win ~ ERA + avgSV + avgHA + avgE + allS + EraAvgSV +
EraAvgHA + avgSVAvgHA)
Residuals:
Min 1Q Median 3Q Max
-0.139937 -0.032584 0.000122 0.031768 0.145765
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.497254 0.001667 298.339 < 2e-16 ***
ERA -0.040236 0.002754 -14.612 < 2e-16 ***
avgSV 0.026921 0.001623 16.587 < 2e-16 ***
avgHA 0.009479 0.002663 3.560 0.000386 ***
avgE -0.017265 0.001608 -10.735 < 2e-16 ***
allS 0.007911 0.001570 5.040 5.38e-07 ***
EraAvgSV 0.011852 0.002665 4.447 9.50e-06 ***
EraAvgHA 0.003718 0.001109 3.353 0.000826 ***
avgSVAvgHA -0.005140 0.002512 -2.046 0.040997 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.04786 on 1189 degrees of freedom
Multiple R-squared: 0.5362, Adjusted R-squared: 0.5331
F-statistic: 171.8 on 8 and 1189 DF, p-value: < 2.2e-16
E(yi) = 0.497254 - 0.040236(ERAi) + 0.026921(avg Savei) + 0.009479(avg Hits Allowedi) - 0.017265 (avg Errori) + 0.007911(allStari) + 0.011852(eraAvgSvi) + 0.003718(eraAvgHai) - avgSVAvgHA (avgSvAvgEi)
Where:
ERA = (ERA - 4.07) / 0.578
avg Save = (Avg Save - 0.23) / 0.055
avg Hits Allowed = (avg Hits Allowed - 8.91) / 0.557
avg Error = (Avg. Error - 0.75) / 0.141
all Stars = (all Stars - 0.77) / 0.784
eraAvgSv = ERA * avg Save
eraAvgHa = ERA * avg Hits Allowed
avgSvAvgE = avg Save * avg Error
Evaluating the Models:
Model 3 - MB2 | Model 4 - MB2 | Model 1 - MB1 | Model 2 - MB1 | |
F-statistic | 261 | 171.8 | 310.1 | 133.6 |
Adjusted R2 | 0.5206 | 0.5331 | 0.5081 | 0.5257 |
RMSE | 0.04800 | 0.04786 | 0.04912 | 0.04824 |
The four models have very similar adjusted-R2 and RMSE. They do not have very high adjusted-R2 values. It is likely that there are other explanatory variables that are not represented within the two models. Possibly another statistic relating to pitching. When evaluating the two models it appears that “pitching” is very influential on winning percentage. The variables ERA, Average Saves, and Average Hits Allowed all have large t-test values and all relate to the dual of pitcher vs. batter. It appears the addition of the “Num. of All Star Pitchers” variable increased the adjusted R2 about 1-2% in Model 3 and 4. Future work may look deeper into this area with the hopes of identify additional explanatory variables to better predict winning percentage. Based on simplicity Model 3 appears to be the simplest. Model 3 has a lot few variables compared to Model 4 and 2.
However, based on simplicity Model 1 appears to be the simplest. Model 1 has a lot few variables compared to Model 2, and both appear to have similar abilities in predicting winning percentage from the dataset. The two models do not have very high adjusted-R2 values. It is likely that there are other explanatory variables that are not represented within the two models. Possibly another statistic relating to pitching. When evaluating the two models it appears that “pitching” is very influential on winning percentage. The variables ERA, Average Saves, and Average Hits Allowed all have large t-test values and all relate to the dual of pitcher vs. batter. Future work may look deeper into this area with the hopes of identify additional explanatory variables to better predict winning percentage.
Using a Stepwise Regression model with the key explanatory variables: Points For Per Game (PFPG), Points Against Per Game (PAPG), Previous Winning Percentage (PYWP), number of All Stars (AS), Playoff Experience (PE), Salary (S), and Average Age (AA) will review each variable separately and first select the most significant, then it will repeat the process for the remaining variables. Below are the results but in summary it drops Salary and Average Age because they are insignificant (< 0.15)
Using a backwards regression model where the least significant variable is removed first and then all the variables are analyzed again and the least significant continues to be removed produces the same results. Salary and Average Age are dropped.
Initial Linear Model
Retaining those five key variables we do a linear regression model to see the results:
Our overall Pr>F is good at 0.0001 (at least one of the variables is not equal to zero) and we are seeing an Adj R2 of 0.8269 which indicates the model accounts for 82.69% of the variability in Winning Percentage. Also our individual variable Pr>t are also good with all of them below 0.0097.
Initially there are two items that do concern us. The negative coefficients for the variables ALL_STAR (AS) and Points Against Per Game (PAPG). See below:
Taking PAPG first actually a negative coefficient is not too surprising because the more points a team gives up in a game the less likely they are to win the game so it would have a negative impact on Winning Percentage (WP). But the quantity of All Stars (AS) on a team would seem to be a positive linear relationship - more All Stars then more wins. There may be some correlation occurring here that needs to be reviewed.
Doing a Pearson Correlation Matrix for the variables we get our answer.
There is a little correlation between some variables. None higher than 0.51798 (Playoff Experience and Points Against Per Game) which is a warning sign but unless the correlation rises above .70 we should be ok.
Now that we have a proposed model we should analyze the residuals to confirm that the four key assumptions still hold.
Since the assumptions are true we can use the model of:
WP = 0.27601 - 0.00783{ALL_STARS} + 0.12954{PREV_WIN_PCT} + 0.00137{PLAYOFF_EXP} - 0.12917{PAPG} + 0.17984{PFPG}
Using this formula we can compare it to the 2012 hockey season although since we do not have the actual imported data we will have to compare it manually.
Here is a table of data from 2012 but we are not able to get PLAYOFF_EXP easily so any conclusions we make need to reference that.
We can see that the Predicted Winning Percentage is almost always lower than the actual (see Delta column). This is in some part related to the Playoff Exp column missing but since the coefficient of the Playoff Exp is only 0.00137 that is not the only reason. There is also the case that the 2012 hockey season was a strike shortened (only 48 games) and since not all the games were played that will influence a team's Winning Percentage. Regardless let’s look how the actual versus predicted rankings for the teams turned out (next page).
Using the model, we can see that 7 of the 30 teams season rankings, by winning percentage, were predicted correctly (green highlighted teams).
But predicting a ranking correctly compounds the error so lets examine if the model approximated the ranking.
If we break down the league into five equal groups of six teams each: top 6, 7-12, 13-18, 19-24, and bottom 6 then we can see if the model would place the team in the correct group.
We find the predicted ranking in the right group to be quite accurate.
You will see in the section graphic that by group the model predicted 21 of 30 correct placements; with the top 6 and bottom 6 being the most accurate.
Given more time to gather the data, adjust the model, and validating it we could make some solid predictions with high degree of confidence (80+%).
Now we need to compare these results against our Baseball analysis.
First model
Model: Winning_percent ~ Normalized_Salary + Normalized_Age + Normalized_For + Normalized_Against + For_I_Against + Efficiency_For + E_I_Against + E_For_E_I_Against
This model has a small p-value for F-test and high adj-R2 value, but it has 6 variables with VIF value is larger than 10 and 3 variables with p-value for t-test larger than 0.05. Also, a negative sign for the variable E_I_Agaisnt is not expected. The high VIF value and unexpected sign for variable both suggest that the model has multicollinearity effect which could also inflate the p-value for individual t-test. A ridge regression has been run to mitigate the effect of multicollinearity.
The parameters all seem to be stable and have VIF value less than 10 at beta = 0.018 at which the sign for the variable E_I_Against also turn from negative to positive.
Residuals in the quantile plot and the scatter plot all seem to be normally distributed indicating that the model has well captured the dependency in the data.
Second model
From the regression results above, what noticed is that four variables, Normalized_Salary, Efficiency_For, E_I_Against and E_F_E_I_Against, all have p-value for t-test greater than 0.05. Thus, in this second model, these four variables have been dropped except for Normalized_Salary.
Model: Winning_percent ~ Normalized_Salary + Normalized_Age + Normalized_For + Normalized_Against + For_I_Against
This model also has a p-value for F-test less than 0.01% and a marginally smaller adj-R2 than that of first one. However, VIF values in the table still indicate that there is multicollinearity existing in the model.
Again, residuals for this model all fit the assumptions for an adequate regression model.
Third Model
Considering the fact that p-value for t-test of variable Normalized_Salary is greater than 0.05 and the variable has VIF value significantly less than 10, which suggest that the high p-value for t-test is not caused by multicollinearity effect. As a result, variable Normalized_Salary has been dropped to build the third model.
Model: Winning_percent ~ Normalized_Age + Normalized_For + Normalized_Against + For_I_Against
By taking out an explanatory variable with high p-value for t-test, the third model has adj-R2 slightly larger than that of second model. The F value is large enough to reject the null hypothesis and the model’s RMSE is relatively small compared to to dependent mean.
We find that a team’s winning percentage can be predicted with a high level of confidence. Fans love high-scoring games and our analyses confirm that so should contenders. The key factor to predicting winning percentage is points scored. Some factors that many believe play an important role but do not are salary, all-stars in hockey, and age.
The most meaningful explanatory variable is points scored. It is no surprise that this is the strongest indicator of a high winning percentage. Most teams give big contracts to point producers and now there is evidence to justify that. In hockey, previous winning percentage is the second most important variable. It is also no surprise, because logically previous success tends to translate to current success. In baseball, points against, ERA, walks, all stars, and saves all positively correlate with winning percentage. For walks, this confirms Billy Beane’s decision, popularized by the movie Moneyball, to focus on non-traditional statistics to form a winning baseball team.
All our models have the same response variable, winning percentage, which allows us to compare baseball salaries with hockey salaries, baseball all-stars with hockey all-stars, and baseball offense with baseball defense, to name a few.
For our comparison between baseball and hockey all-stars, all stars are much more important in baseball than in hockey, with a moderate positive correlation for baseball and little to no positive correlation in hockey. For our comparison between baseball offense and defense, offense is more important than defense, with a moderate positive correlation for offense and a weak positive correlation for hockey. For our comparison between baseball and hockey, both our models reliably predict winning percentage, with high positive correlations.
Originally, our target variable was whether a team won its championship. We soon found out that due to its binary nature and the fact that only one team wins made it hard to model. We have instead chosen winning percentage, which by no means guarantees a championship, but is a strong indicator. Each team’s set of variables and each variable can be modeled against winning percentage with more meaningful results than championships. This allows great flexibility in the kinds of models, which is why we are able to include many in our analyses. Our implications are also broader, because teams can be grouped, such as over .600 (a great team), over .500 (a good team), between .400 and .500 (a bad team), and under .400 (an abysmal team). This route is one suggestion as a next step.
As we close our analyses, we have a few recommendations to consider for any follow-up work. We have covered only two sports, so are our findings the same in basketball, football, soccer, and women’s leagues? Coaches are increasingly getting higher and higher salaries. Are their salaries justified? How does a coach’s winning percentage compare with his or her current team? Now that winning percentage has been modeled, will it be easier to model championships as a response variable? Minor league baseball teams have always been integral to its major league counterpart, so is there a relationship between a major league team’s winning percentage and its minor league teams? These are just a few of the many questions we have for follow-up work, but our primary question, whether a team’s winning percentage can be accurately predicted, is a resounding yes, with at least 83% of the variability in winning percentage explained by our models.