You are on page 1of 11

t

os
W25531

Student Appendix

THE INDIAN PREMIER LEAGUE: GAUGING PLAYER PERFORMANCE

rP
Soumya Roy, Soumyadeep Kundu, and Dipayan Roy wrote this student appendix as an aid to students in the classroom use of the
case The Indian Premier League: Gauging Player Performance, No. W25528. This appendix should not be used in any way that would
prejudice the future use of the case.

This publication may not be transmitted, photocopied, digitized, or otherwise reproduced in any form or by any means without the
permission of the copyright holder. Reproduction of this material is not covered under authorization by any reproduction rights

yo
organization. To order copies or request permission to reproduce materials, contact Ivey Publishing, Ivey Business School, Western
University, London, Ontario, Canada, N6G 0N1; (t) 519.661.3208; (e) cases@ivey.ca; www.iveycases.com. Our goal is to publish
materials of the highest quality; submit any errata to publishcases@ivey.ca. i1v2e5y5pubs

Copyright © 2022, Ivey Business School Foundation Version: 2022-01-31

# Read Data Set


op
d=read.csv("C:/Users/Soumya‐Roy/Desktop/Cases/IPL/IPL_US.csv",header=T)

# Names of Variables
names(d)

## [1] "Sl_No" "Player" "Team" "Runs" "Avg" "SR"


tC

## [7] "Hundreds" "Fifties" "Fours" "Sixes" "Salary"

# Player Names
players=d[,2]
players

## [1] "AB de Villiers" "Ajinkya Rahane" "Akshdeep Nath"


No

## [4] "Ambati Rayudu" "Andre Russell" "Axar Patel"


## [7] "Ben Stokes" "Bhuvneshwar Kumar" "Chris Gayle"
## [10] "Chris Lynn" "Chris Morris" "Colin Ingram"
## [13] "David Warner" "David Miller" "Deepak Hooda"
## [16] "Dinesh Karthik" "Dwayne Bravo" "Faf du Plessis"
## [19] "Hardik Pandya" "Ishan Kishan" "Jofra Archer"
## [22] "Jonny Bairstow" "Jos Buttler" "Kane Williamson"
## [25] "Kedar Jadhav" "Keemo Paul" "Kieron Pollard"
## [28] "KL Rahul" "Krunal Pandya" "Mandeep Singh"
Do

## [31] "Manish Pandey" "Marcus Stoinis" "Mayank Agarwal"


## [34] "Moeen Ali" "Mohammad Nabi" "MS Dhoni"
## [37] "Nicholas Pooran" "Nitish Rana" "Parthiv Patel"
## [40] "Piyush Chawla" "Prithvi Shaw" "Quinton de Kock"
## [43] "Rahul Tripathi" "Rashid Khan" "Ravichandran Ashwin"
## [46] "Ravindra Jadeja" "Rishabh Pant" "Riyan Parag"

This document is authorized for educator review use only by RAJAT BOHRA, Taxila Business School until Mar 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Page 2 W25531

t
## [49] "Robin Uthappa" "Rohit Sharma" "Sam Curran"

os
## [52] "Sanju Samson" "Sarfaraz Khan" "Shane Watson"
## [55] "Sherfane Rutherford" "Shikhar Dhawan" "Shimron Hetmyer"
## [58] "Shreyas Gopal" "Shreyas Iyer" "Shubman Gill"
## [61] "Steve Smith" "Stuart Binny" "Sunil Narine"
## [64] "Suresh Raina" "Suryakumar Yadav" "Umesh Yadav"

rP
## [67] "Vijay Shankar" "Virat Kohli" "Wriddhiman Saha"
## [70] "Yusuf Pathan"

# Attach the dataset


attach(d)

# Structure of Data Set

yo
str(d)

## 'data.frame': 70 obs. of 11 variables:


## $ Sl_No : int 1 2 3 4 5 6 7 8 9 10 ...
## $ Player : chr "AB de Villiers" "Ajinkya Rahane" "Akshdeep Nath" "Ambat
i Rayudu" ...
## $ Team : chr "Royal Challengers Bangalore" "Rajasthan Royals" "Royal
Challengers Bangalore" "Chennai Super Kings" ...
op
## $ Runs : int 442 393 61 282 510 110 123 12 490 405 ...
## $ Avg : num 44.2 32.8 12.2 23.5 56.7 ...
## $ SR : num 154 137.9 107 93.1 204.8 ...
## $ Hundreds: int 0 1 0 0 0 0 0 0 0 0 ...
## $ Fifties : int 5 1 0 1 4 0 0 0 4 4 ...
## $ Fours : int 31 45 5 20 31 10 8 1 45 41 ...
tC

## $ Sixes : int 26 9 2 7 52 3 4 0 34 22 ...


## $ Salary : num 1.719 0.625 0.514 0.344 1.328 ...

# Summary Statistics
summary(d)

## Sl_No Player Team Runs


## Min. : 1.00 Length:70 Length:70 Min. : 12.0
No

## 1st Qu.:18.25 Class :character Class :character 1st Qu.: 96.5


## Median :35.50 Mode :character Mode :character Median :216.5
## Mean :37.43 Mean :249.3
## 3rd Qu.:54.25 3rd Qu.:395.2
## Max. :92.00 Max. :692.0
## Avg SR Hundreds Fifties
## Min. : 3.60 Min. : 63.15 Min. :0.00000 Min. :0.000
## 1st Qu.:18.00 1st Qu.:120.64 1st Qu.:0.00000 1st Qu.:0.000
Do

## Median :27.07 Median :133.31 Median :0.00000 Median :1.000


## Mean :28.58 Mean :133.12 Mean :0.08571 Mean :1.486
## 3rd Qu.:35.16 3rd Qu.:148.47 3rd Qu.:0.00000 3rd Qu.:3.000
## Max. :83.20 Max. :204.81 Max. :1.00000 Max. :8.000
## Fours Sixes Salary
## Min. : 1.00 Min. : 0.00 Min. :0.0286

This document is authorized for educator review use only by RAJAT BOHRA, Taxila Business School until Mar 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Page 3 W25531

t
## 1st Qu.: 8.00 1st Qu.: 4.00 1st Qu.:0.3217

os
## Median :19.00 Median : 8.00 Median :0.7009
## Mean :22.40 Mean :10.51 Mean :0.9120
## 3rd Qu.:36.75 3rd Qu.:14.00 3rd Qu.:1.3281
## Max. :64.00 Max. :52.00 Max. :2.6562

rP
# Boxplot
boxplot(Salary,col="red",lwd=2)

yo
op
tC

# Players Earning More than US$2 million


Player[Salary>2]
No

## [1] "MS Dhoni" "Rishabh Pant" "Rohit Sharma" "Virat Kohli"

# Inter‐Quartile Range
quantile(Salary,probs=0.75)‐quantile(Salary,probs=0.25)

## 75%
## 1.006468

# Correlation Matrix
Do

cor(d[,4:11])

## Runs Avg SR Hundreds Fifties Fours S


ixes
## Runs 1.0000000 0.7348088 0.3552689 0.4366210 0.8701533 0.9269084 0.769
8171

This document is authorized for educator review use only by RAJAT BOHRA, Taxila Business School until Mar 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Page 4 W25531

t
## Avg 0.7348088 1.0000000 0.4587212 0.3704745 0.6568595 0.5707617 0.659

os
4927
## SR 0.3552689 0.4587212 1.0000000 0.1343445 0.2477918 0.2657353 0.579
0312
## Hundreds 0.4366210 0.3704745 0.1343445 1.0000000 0.2989482 0.4229155 0.192
8595

rP
## Fifties 0.8701533 0.6568595 0.2477918 0.2989482 1.0000000 0.7985036 0.675
4056
## Fours 0.9269084 0.5707617 0.2657353 0.4229155 0.7985036 1.0000000 0.565
4438
## Sixes 0.7698171 0.6594927 0.5790312 0.1928595 0.6754056 0.5654438 1.000
0000
## Salary 0.3234302 0.2919955 0.1055668 0.2331481 0.2900521 0.2550323 0.246

yo
8059
## Salary
## Runs 0.3234302
## Avg 0.2919955
## SR 0.1055668
## Hundreds 0.2331481
## Fifties 0.2900521
op
## Fours 0.2550323
## Sixes 0.2468059
## Salary 1.0000000

# Defining New Variable: Fifty_New


d$Fifty_New=2*Hundreds+Fifties
tC

# Attach the Data Set Again


attach(d)

## The following objects are masked from d (pos = 3):


##
## Avg, Fifties, Fours, Hundreds, Player, Runs, Salary, Sixes, Sl_No,
## SR, Team
No

# Boxplot of Batting Average and Strike Rate


par(mfrow=c(1,2))
boxplot(Avg,main="Batting Average",col="red",lwd=2)
boxplot(SR,main="Strike Rate",col="blue",lwd=2)
Do

This document is authorized for educator review use only by RAJAT BOHRA, Taxila Business School until Mar 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Page 5 W25531

t
os
rP
yo
op
# Outstanding Players w.r.t. Batting Average and Strike Rate
boxplot(Avg)$out

## [1] 69.2 83.2


tC

Player[which(Avg==69.2)]

## [1] "David Warner"

Player[which(Avg==83.2)]

## [1] "MS Dhoni"


No

boxplot(SR)$out

## [1] 204.81 63.15 191.42 75.00

Player[which(SR==204.81)]

## [1] "Andre Russell"

Player[which(SR==191.42)]
Do

## [1] "Hardik Pandya"

# Principal Component Analysis (PCA)


# Variables for PCA
d.new=cbind(Runs,Avg,SR,Fours,Sixes,Fifty_New)
row.names(d.new)<‐players

This document is authorized for educator review use only by RAJAT BOHRA, Taxila Business School until Mar 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Page 6 W25531

t
os
# Principal Components
# scale=T for standardizing the variables
pr.out=prcomp(d.new,scale=T)
names(pr.out)

rP
## [1] "sdev" "rotation" "center" "scale" "x"

# Interpretation
pr.out$rotation=‐pr.out$rotation
pr.out$x=‐pr.out$x

yo
# Summary
summary(pr.out)

## Importance of components:
## PC1 PC2 PC3 PC4 PC5 PC6
## Standard deviation 2.0373 0.9884 0.62587 0.55014 0.39928 0.13728
## Proportion of Variance 0.6917 0.1628 0.06529 0.05044 0.02657 0.00314
op
## Cumulative Proportion 0.6917 0.8546 0.91985 0.97029 0.99686 1.00000

# Ranking
dim(pr.out$x)

## [1] 70 6
tC

pr.1.score=pr.out$x[,1]

# Rank
p=sort(pr.1.score,decreasing=T)
M=cbind(p,1:70)
colnames(M)=c("Score","Rank")
No

## Cluster Analysis

# Load Libraries
library(cluster)
library(factoextra)

## Loading required package: ggplot2

## Welcome! Want to learn more? See two factoextra‐related books at https://g


Do

oo.gl/ve3WBa

This document is authorized for educator review use only by RAJAT BOHRA, Taxila Business School until Mar 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Page 7 W25531

t
os
rP
yo
op
# Scale the variables
d.new.s=scale(d.new)

# Number of Clusters
tC

gap=clusGap(d.new.s,FUN=kmeans,nstart=20,K.max=10,B=100)

# Plot the result


fviz_gap_stat(gap)
No
Do

This document is authorized for educator review use only by RAJAT BOHRA, Taxila Business School until Mar 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Page 8 W25531

t
os
rP
yo
op
# K‐means Clustering for K=4
km.out=kmeans(d.new.s,4,nstart=20)

# Cluster Identification
tC

km.clus=km.out$cluster
Player[km.clus==1]

## [1] "AB de Villiers" "Andre Russell" "Chris Gayle" "David Warner"


## [5] "Hardik Pandya" "Jonny Bairstow" "KL Rahul" "MS Dhoni"
## [9] "Quinton de Kock" "Rishabh Pant"
No

#Cluster Size
table(km.clus)

## km.clus
## 1 2 3 4
## 10 27 21 12

# Visualize cluster
fviz_cluster(km.out,d.new.s)
Do

This document is authorized for educator review use only by RAJAT BOHRA, Taxila Business School until Mar 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Page 9 W25531

t
os
rP
yo
op
# Silhouette Statistic
sil=silhouette(km.out$cluster, dist(d.new.s))
rownames(sil)=rownames(d.new)
fviz_silhouette(sil)
tC

## cluster size ave.sil.width


## 1 1 10 0.06
## 2 2 27 0.21
## 3 3 21 0.44
## 4 4 12 0.46
No
Do

This document is authorized for educator review use only by RAJAT BOHRA, Taxila Business School until Mar 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Page 10 W25531

t
os
rP
yo
op
# Negative Silhouette Statistic used for identifying the states which should
belong to different clusters
neg_sil_index=which(sil[, "sil_width"] < 0)
sil[neg_sil_index, , drop = FALSE]
tC

## cluster neighbor sil_width


## Jonny Bairstow 1 3 ‐0.053465386
## Kieron Pollard 2 3 ‐0.005541784
## Quinton de Kock 1 3 ‐0.218668307
## Rishabh Pant 1 3 ‐0.045206679
## Shimron Hetmyer 2 4 ‐0.005421673
No

# Cluster Statistics by Variables


A=aggregate(d.new,list(km.clus),mean)

# Overall Average
A_M=apply(d.new,2,mean)

# Player Distribution across Different Clusters for Each Team


T_P=table(Team,km.clus)
Do

prop.table(T_P,margin=1)

## km.clus
## Team 1 2 3 4
## Chennai Super Kings 0.12500000 0.12500000 0.37500000 0.37500000
## Delhi Capitals 0.14285714 0.28571429 0.42857143 0.14285714
## Kings XI Punjab 0.22222222 0.66666667 0.11111111 0.00000000

This document is authorized for educator review use only by RAJAT BOHRA, Taxila Business School until Mar 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Page 11 W25531

t
## Kolkata Knight Riders 0.11111111 0.11111111 0.55555556 0.22222222

os
## Mumbai Indians 0.28571429 0.28571429 0.28571429 0.14285714
## Rajasthan Royals 0.00000000 0.54545455 0.36363636 0.09090909
## Royal Challengers Bangalore 0.12500000 0.50000000 0.25000000 0.12500000
## Sunrisers Hyderabad 0.18181818 0.45454545 0.09090909 0.27272727

rP
# Cluster and Salary
d$Cluster=km.clus
tapply(d$Salary,d$Cluster,mean)

## 1 2 3 4
## 1.4189310 0.7038378 1.0148814 0.7779758

mean(d$Salary)

yo
## [1] 0.9120164 op
tC
No
Do

This document is authorized for educator review use only by RAJAT BOHRA, Taxila Business School until Mar 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860

You might also like