Access code files from the following books by Thomas Miller
- Sports Analytics and Data Science: Winning the Game with Methods and Models
- Marketing Data Science: Modeling Techniques in Predictive Analytics with R and Python
Sports Analytics and Data Science: Winning the Game with Methods and Models
By Thomas W. Miller
Programs and Data to Accompany "Sports Analytics and Data Science: Winning the Game with Methods and Models" Miller (2016)
Note that many R programs contain library commands for bringing in R functions included in packages. To run these programs, the user needs to first install the packages in his/her R environment. Likewise for Python programs, many utilize data structures and methods that require the prior installation and importing of Python packages.
R programs were tested under R 3.1.1 on Mac OS 10.6.8. Python programs were tested under Enthought Canopy and Python 2.7 on Mac OS 10.6.8.
| Book Location | Description of Directory or File | File Name |
| SADS Chapter 1 | Major League Baseball Player Salaries 2015 | mlb_player_salaries_2015.csv |
| National Basketball Association Player Salaries 2015 | nba_player_salaries_2015.csv | |
| National Football Association Player Salaries 2015 | nfl_player_salaries_2015.csv | |
| Major League Baseball Player Salaries and Performance Data | mlb_payroll_performance_2014.csv | |
| MLB, NBA, and NFL Player Salaries (R) | sads_exhibit_1_1.R | |
| Payroll and Performance in Major League Baseball (R) | sads_exhibit_1_2.R | |
| Making a Perceptual Map of Sports (R) | sads_exhibit_1_3.R | |
| SADS Chapter 3 | National Basketball Association Game Data from 2014-2015 Season | basketball_2014_2015_season.csv |
| NBA Team Names and Abbreviations (same as Appendix B Table B4) | nba_team_names_abbreviations.csv | |
| Assessing Team Strength by Unidimensional Scaling | sads_exhibit_3_1.R | |
| SADS Chapter 6 | Consumer Preference Data for Dodger Stadium Seating (Table 6.2) | sporting_event_ranking.csv |
| Mapping Entertainment Events and Activities (R) | sads_exhibit_6_1.R | |
| Mapping Entertainment Events and Activities (Python) | sads_exhibit_6_2.py | |
| Preferences for Sporting Events—Conjoint Analysis (R) | sads_exhibit_6_3.R | |
| Preferences for Sporting Events—Conjoint Analysis (Python) | sads_exhibit_6_4.py | |
| SADS Chapter 7 | Major League Baseball Attendance and Promotion Data for 2012 Season | bobbleheads.csv |
| Dodgers Attendance and Promotion Data for 2012 Season | dodgers.csv | |
| Shaking Our Bobbleheads Yes and No (R) | sads_exhibit_7_1.R | |
| Shaking Our Bobbleheads Yes and No (Python) | sads_exhibit_7_2.py | |
| SADS Chapter 10 | Team Winning Probabilities by Simulation (R) | sads_exhibit_10_1.R |
| Team Winning Probabilities by Simulation (Python) | sads_exhibit_10_2.py | |
| SADS Chapter 11 | Simple One-Site Web Crawler and Scraper (Python) Code Listing | sads_exhibit_11_1.py |
| Simple One-Site Web Crawler and Scraper (Python) Compressed Directory | sads_exhibit_11_1.zip | |
| Gathering Opinion Data from Twitter: Football Injuries (Python) | sads_exhibit_11_2.py | |
| SADS Appendix A | Arizona Diamondbacks Game Day Data from August 2007 | MLB_2007_ARI_data_frame.csv |
| Oklahoma City Thunder Data from 2014-2015 Season | okc_data_2014_2015.csv | |
| Programming the Anscombe Quartet (Python) | sads_exhibit_A_1.py | |
| Programming the Anscombe Quartet (R) | sads_exhibit_A_2.R | |
| Making Differential Runs Plots for Baseball (R) | sads_exhibit_A_3.R | |
| Moving Fraction Plot: A Basketball Example (R) | sads_exhibit_A_4.R | |
| Visualizing Basketball Games (R) | sads_exhibit_A_5.R | |
| Seeing Data Science as an Eclectic Discipline (R) | sads_exhibit_A_6.R | |
| SADS Appendix B | Women’s National Basketball Association (WNBA) | sads_table_B_1.csv |
| Major League Baseball (MLB) | sads_table_B_2.csv | |
| Major League Soccer (MLS) | sads_table_B_3.csv | |
| National Basketball Association (NBA) | sads_table_B_4.csv | |
| National Football League (NFL) | sads_table_B_5.csv |
Marketing Data Science: Modeling Techniques in Predictive Analytics with R and Python
By Thomas W. Miller
Programs and Data to Accompany "Marketing Data Science: Modeling Techniques in Predictive Analytics with R and Python" Miller (2015)
| Book Location | Description of Directory or File | File Name |
| MDS Chapter 1 | Measuring and Modeling Individual Preferences (R) | MDS_Exhibit_1_1.R |
| Measuring and Modeling Individual Preferences (Python) | MDS_Exhibit_1_2.py | |
| "Measuring and Modeling Individual Preferences (data)" | mobile_services_ranking.csv | |
| Questions for Conjoint Survey (documentation) | questions_for_survey.txt | |
| Conjoint Analysis Spine Chart (R binary) | mtpa_spine_chart.Rdata | |
| MDS Chapter 2 | Predicting Commuter Transportation Choices (R) | MDS_Exhibit_2_1.R |
| Predicting Commuter Transportation Choices (Python) | MDS_Exhibit_2_2.py | |
| Predicting Commuter Transportation Choices (data) | sydney.csv | |
| Correlation Heat Map Utility (R binary) | correlation_heat_map.RData | |
| MDS Chapter 3 | Identifying Customer Targets (R) | MDS_Exhibit_3_1.R |
| Identifying Customer Targets (Python) | MDS_Extra_3_1.py | |
| Identifying Customer Targets (data) | bank.csv | |
| Empty Python Directory | __init__.py | |
| Evaluating Predictive Accuracy of a Binary Classifier (Python) | evaluate_classifier.py | |
| MDS Chapter 4 | Identifying Consumer Segments (R) | MDS_Exhibit_4_1.R |
| Identifying Consumer Segments (Python) | MDS_Exhibit_4_2.py | |
| Identifying Consumer Segments (data) | bank.csv | |
| MDS Chapter 5 | Predicting Customer Retention (R) | MDS_Exhibit_5_1.R |
| Predicting Customer Retention (Python) | MDS_Extra_5_1.py | |
| Predicting Customer Retention (data) | att.csv | |
| Empty Python Directory | __init__.py | |
| Evaluating Predictive Accuracy of a Binary Classifier (Python) | evaluate_classifier.py | |
| MDS Chapter 6 | Product Positioning of Movies (R) | MDS_Exhibit_6_1.R |
| Product Positioning of Movies (Python) | MDS_Exhibit_6_2.py | |
| Multidimensional Scaling Demonstration: US Cities (R) | MDS_Exhibit_6_3.R | |
| Multidimensional Scaling Demonstration: US Cities (Python) | MDS_Exhibit_6_4.py | |
| Using Activities Market Baskets for Product Positioning (R) | MDS_Exhibit_6_5.R | |
| Using Activities Market Baskets for Product Positioning (Python) | MDS_Exhibit_6_6.py | |
| Hierarchical Clustering of Activities (R) | MDS_Exhibit_6_7.R | |
| Hierarchical Clustering of Activities (Python) | MDS_Extra_6_7.py | |
| Hierarchical Clustering of Activities (data) | wisconsin_dells.csv | |
| MDS Chapter 7 | Analysis for a Field Test of Laundry Soaps (R) | MDS_Exhibit_7_1.R |
| Analysis for a Field Test of Laundry Soaps (Python) | MDS_Extra_7_1.py | |
| Analysis for a Field Test of Laundry Soaps (grouped data) | gsoaps.csv | |
| Analysis for a Field Test of Laundry Soaps (individual data) | soaps.csv | |
| MDS Chapter 8 | Shaking Our Bobbleheads Yes and No (R) | MDS_Exhibit_8_1.R |
| Shaking Our Bobbleheads Yes and No (Python) | MDS_Exhibit_8_2.py | |
| Shaking Our Bobbleheads Yes and No (data) | dodgers.csv | |
| MDS Chapter 9 | Market Basket Analysis of Grocery Store Data (R) | MDS_Exhibit_9_1.R |
| Market Basket Analysis of Grocery Store Data (Python to R) | MDS_Exhibit_9_2.py | |
| MDS Chapter 10 | Training and Testing a Hierarchical Bayes Model (R) | MDS_Exhibit_10_1.R |
| Analyzing Consumer Preferences and Building a Market Simulation (R) | MDS_Exhibit_10_2.R | |
| Training and Testing a Hierarchical Bayes Model (data) | computer_choice_study.csv | |
| Market Simulation Utilities (R binary) | mtpa_market_simulation_utilities.Rdata | |
| Split-plotting Utilities (R binary) | mtpa_split_plotting_utilities.Rdata | |
| MDS Chapter 11 | Network Models and Measures (R) | MDS_Exhibit_11_1.R |
| Analysis of Agent-Based Simulation (R) | MDS_Exhibit_11_2.R | |
| Defining and Visualizing a Small-World Network (Python) | MDS_Exhibit_11_3.py | |
| Analysis of Agent-Based Simulation (Python) | MDS_Exhibit_11_4.py | |
| Analysis of Agent-Based Simulation (data trials) | NetLogo_results | |
| Analysis of Agent-Based Simulation (summary data) | virus_results.csv | |
| MDS Chapter 12 | Competitive Intelligence: Spirit Airlines Financial Dossier (R) | MDS_Exhibit_12_1.R |
| MDS Chapter 13 | Restaurant Site Selection (R) | MDS_Exhibit_13_1.R |
| Restaurant Site Selection (Python) | MDS_Exhibit_13_2.py | |
| Restaurant Site Selection (data) | studenmunds_restaurants.csv | |
| Correlation Heat Map Utility (R binary) | correlation_heat_map.RData | |
| MDS Appendix C | AT&T Choice Study | MDS_Appendix_C_1 |
| Anonymous Microsoft Web Data | MDS_Appendix_C_2 | |
| Bank Marketing Study | MDS_Appendix_C_3 | |
| Boston Housing Study | MDS_Appendix_C_4 | |
| Computer Choice Study | MDS_Appendix_C_5 | |
| DriveTime Sedans | MDS_Appendix_C_6 | |
| Lydia E. Pinkham Medicine Company | MDS_Appendix_C_7 | |
| Procter & Gamble Laundry Soaps | MDS_Appendix_C_8 | |
| Return of the Bobbleheads | MDS_Appendix_C_9 | |
| Studenmund’s Restaurants | MDS_Appendix_C_10 | |
| Sydney Transportation Study | MDS_Appendix_C_11 | |
| ToutBay Begins Again | MDS_Appendix_C_12 | |
| Two Month’s Salary | MDS_Appendix_C_13 | |
| Wisconsin Dells | MDS_Appendix_C_14 | |
| Wikipedia Votes | MDS_Appendix_C_16 | |
| MDS Appendix D | Conjoint Analysis Spine Chart (R) | MDS_Exhibit_D1.R |
| Market Simulation Utilities (R) | MDS_Exhibit_D2.R | |
| Split-plotting Utilities (R) | MDS_Exhibit_D3.R | |
| Utilities for Spatial Data Analysis (R) | MDS_Exhibit_D4.R | |
| Correlation Heat Map Utility (R) | MDS_Exhibit_D5.R | |
| Evaluating Predictive Accuracy of a Binary Classifier (Python) | MDS_Exhibit_D6.py |
