SlideShare a Scribd company logo
1 of 76
Download to read offline
Baseball Data with R
김 경 민
Customer Clustering, Recommendation
DS 개발팀
DMP 개발자
야구는 기록의 스포츠
타율, 타점, 다승, 홈런 ...
성적은 Money 순일까?
기록을 계속 신뢰해도 되는
가?
타율, 타점, 승수 ...
기록이 가치를 제대로 나타
내는가?
야구의 목적은?
높은 타율? 많은 홈런?
이기기 위해서는?
좋은 선수란?
팀의 승리에 기여하는 선수
득점을 하고
실점을 하지 않는 선수
모든 플레이는 점수와 관련
하여 평가해야 한다.
야구는 이벤트의 집합
득점에 도움이 되느냐
어떻게 이벤트의 가치를
평가할 것인가?
Before State → Event → After State
야구에서의 상태(State)란?
무사 만루에서
점수를 못내다니..
이런 XX..
State의 기대득점을 알 수 있다면?
Event Value = After State - Before State
상태(State)의 가치
득점 기대치
(Run Expectancy)
이벤트의 가치
(Run Value)
RV = After RE - Before RE
홈런의 가치
Before : 0 아웃에 주자없는 상황 (0.555)
Event : 홈런 (+1)
After : 0 아웃에 주자없는 상황 (0.555)
홈런의 가치 = (1 + 0.555) - 0.555 = 1
홈런의 가치
2 아웃에 주자 1,3루 상황 (0.538)
홈런 (+3)
2 아웃에 주자없는 상황 (0.117)
홈런의 가치 = (3 + 0.117) - 0.538 = 2.579
이벤트 별 가치
이벤트 점수
홈런 1.397
안타 0.475
3루타 1.070
아웃 - 0.299
Runs Above Replacement = (RV)
(득점 기여도)
득점과 승리 사이의 관계?
팀 데이터 가져오기
- Data Frame은 RDB의 테이블과 비슷
- 팀 데이터 : 팀의 연도별 기록 (경기수, 승리 횟수, 패배 횟수, 순위)
필요한 데이터 추출
- subset으로 조건에 맞는 데이터를 검색
- ‘[ ]’를 사용하여 원하는 row와 column을 정의
득실점 차이와 승률 구하기
- $ : column에 접근
- with : data에 대한 expression을 수행
득실점 차이와 승률의 관계
> plot(myteams$RD, myteams$Wpct, xlab="run differential", ylab="winning
percentage")
선형 회귀 (Linear Regression)
- 경향을 설명할 수 있는 직선 그래프 얻기
득실점 차이와 승률의 관계
Wpct = 0.499992 + 0.000623 * RD (직선 그래프 함수)
> abline(a=coef(linfit)[1], b=coef(linfit)[2], lwd=2)
추정값에 대한 오차 확인
오차 분포 확인
> plot(myteams$RD, myteams$linResiduals, xlab="run differential", ylab="
residual")
평균 오차
이정도 오차 수준이면 나쁘지 않은 듯
선형회귀 결과를 정말 믿을 수 있을까
가정)
1년(162 경기)에
득점 : 1620점
실점 : 810점
득실점 차이 : 810점
0.499992 + 0.000623 * 810 = 1.004622
승률 : 100.4622 % (?!?!?)
피타고라스 정리를 통한 추정
피타고라스 방정식은?
가정)
1년(162 games)에
득점 : 1620점
실점 : 810점
득실점 차이 : 810점
승률 : 약 80%
1승 = ?득점
1승을 위해서 필요한 득점은?
1승을 위해서 필요한 점수는?
1점 낼때마다, 얼마나 승리에 가까워질까?
1승을 위해 필요한 점수는?
가정) 3점 ~ 6점 나는 경기
1승을 위해 필요한 점수
1승을 위해 필요한 점수
1승 = 10득점
1년에 90승을 거두기 위해서 필요한 점수는 900
점
Runs Above Replacement = (RV)
(득점 기여도)
Wins Above Replacement = RAR / 10
(승리 기여도)
세이버메트릭스
야구계의 데이터 사이언티스트
세이버메트리션
야구를
진실을 찾아내려는 노력
Shin-Soo Choo Carlos Gonzalez
타율 .276 .271
홈런 22 40
타점 82 97<
출처 : Fangraphs
2015년 성적
Shin-Soo Choo Carlos Gonzalez
WAR 3.5 2.4
Value $ 28M $ 18M
Salary $ 14M $ 17M
출처 : Fangraphs
>
2015년 가치
보이는 것이 전부가 아니다.
Thank You

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Baseball data with r (@tech ver.) 공개본