Professional Documents
Culture Documents
Create PDF in Your Applications With The Pdfcrowd: HTML To PDF Api
Create PDF in Your Applications With The Pdfcrowd: HTML To PDF Api
csv')
head(data)
GAME_ID DATE HOME_TEAM AWAY_TEAM PLAYER_NAME PLAYER_ID LOCATION WIN_LOSE SHOT_NUMBER PERIOD SEC_REMAIN SHOT_CLOCK DRIBBLES TOUCH_TIM
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
GAME_ID DATE HOME_TEAM AWAY_TEAM PLAYER_NAME PLAYER_ID LOCATION WIN_LOSE SHOT_NUMBER PERIOD SEC_REMAIN SHOT_CLOCK DRIBBLES TOUCH_TIM
summary(data)
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
## Max. :32.000 Max. :23.900 Max. :47.2 Max. :3.000
## CLOSEST_DEFENDER CLOSEST_DEFENDER_ID CLOSE_DEF_DIST SUCCESS
## Length:50000 Min. : 708 Min. : 0.000 Min. :0.0000
## Class :character 1st Qu.:101187 1st Qu.: 2.300 1st Qu.:0.0000
## Mode :character Median :201949 Median : 3.700 Median :0.0000
## Mean :158788 Mean : 4.113 Mean :0.4535
## 3rd Qu.:203078 3rd Qu.: 5.300 3rd Qu.:1.0000
## Max. :530027 Max. :53.200 Max. :1.0000
M=cor(data[sapply(data,is.numeric)])
M
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
## SEC_REMAIN 1.000000000 0.083547254 -0.119217923 -0.107193663
## SHOT_CLOCK 0.083547254 1.000000000 -0.093604980 -0.152240041
## DRIBBLES -0.119217923 -0.093604980 1.000000000 0.930430405
## TOUCH_TIME -0.107193663 -0.152240041 0.930430405 1.000000000
## SHOT_DIST -0.024088534 -0.186365653 -0.081751017 -0.085041616
## PTS_TYPE -0.048798718 -0.049868136 -0.164934735 -0.181563830
## CLOSEST_DEFENDER_ID -0.010107345 -0.002970448 0.013922407 0.010644263
## CLOSE_DEF_DIST 0.005220037 0.019357294 -0.152893777 -0.167642788
## SUCCESS 0.014607510 0.106144010 -0.035780988 -0.048719861
## SHOT_DIST PTS_TYPE CLOSEST_DEFENDER_ID
## GAME_ID 0.0015126456 0.008382307 0.0307846174
## PLAYER_ID -0.0235278731 0.012251003 -0.0087141881
## SHOT_NUMBER 0.0118769583 0.002240424 0.0155151537
## PERIOD 0.0277700399 0.046885668 0.0100036363
## SEC_REMAIN -0.0240885342 -0.048798718 -0.0101073449
## SHOT_CLOCK -0.1863656530 -0.049868136 -0.0029704478
## DRIBBLES -0.0817510172 -0.164934735 0.0139224075
## TOUCH_TIME -0.0850416163 -0.181563830 0.0106442633
## SHOT_DIST 1.0000000000 0.746107695 0.0004503692
## PTS_TYPE 0.7461076948 1.000000000 0.0054807594
## CLOSEST_DEFENDER_ID 0.0004503692 0.005480759 1.0000000000
## CLOSE_DEF_DIST 0.5250464243 0.418037003 -0.0179132936
## SUCCESS -0.1905261604 -0.123084899 0.0016405956
## CLOSE_DEF_DIST SUCCESS
## GAME_ID 0.010862689 -0.0095059285
## PLAYER_ID 0.013346077 0.0004739182
## SHOT_NUMBER -0.035186967 -0.0099333813
## PERIOD -0.009965387 -0.0175436905
## SEC_REMAIN 0.005220037 0.0146075099
## SHOT_CLOCK 0.019357294 0.1061440103
## DRIBBLES -0.152893777 -0.0357809878
## TOUCH_TIME -0.167642788 -0.0487198609
## SHOT_DIST 0.525046424 -0.1905261604
## PTS_TYPE 0.418037003 -0.1230848986
## CLOSEST_DEFENDER_ID -0.017913294 0.0016405956
## CLOSE_DEF_DIST 1.000000000 0.0017080389
## SUCCESS 0.001708039 1.0000000000
library(DataExplorer)
plot_missing(data)
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
library(corrplot)
corrplot(M)
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
library(PerformanceAnalytics)
##
## Attaching package: 'zoo'
##
## Attaching package: 'PerformanceAnalytics'
# showing histogram
# color grey
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
chart.Correlation(data[sapply(data,is.numeric)],histogram=TRUE,
col="grey10",
pch=1,
cex.cor.scale=2,
main="Correlation Plot",
cex.labels=20)
data$SUCCESS = as.factor(data$SUCCESS)
library(ggplot2)
library(readr)
library(repr)
options(repr.plot.width=6, repr.plot.height=3.5)
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
# CLOSE_DEF_DIST
library(dplyr)
##
## Attaching package: 'dplyr'
summary(data$CLOSE_DEF_DIST)
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
options(repr.plot.width=6, repr.plot.height=3.5)
# CTOUCH_TIME
library(dplyr)
summary(data$TOUCH_TIME)
options(repr.plot.width=6, repr.plot.height=3.5)
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
data$HOME_TEAM = as.factor(data$HOME_TEAM)
data$AWAY_TEAM = as.factor(data$AWAY_TEAM)
data$LOCATION = as.factor(data$LOCATION)
data$WIN_LOSE = as.factor(data$WIN_LOSE)
model <- glm(SUCCESS ~ LOCATION + SHOT_NUMBER + PERIOD + PLAYER_ID +SHOT_DIST +CLOSE_DEF_DIST, data = data, famil
y = "binomial")
summary(model)
##
## Call:
## glm(formula = SUCCESS ~ LOCATION + SHOT_NUMBER + PERIOD + PLAYER_ID +
## SHOT_DIST + CLOSE_DEF_DIST, family = "binomial", data = data)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.0455 -1.0934 -0.8205 1.1522 2.0879
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.395e-01 3.407e-02 7.030 2.07e-12 ***
## LOCATIONH 3.539e-02 1.845e-02 1.918 0.0551 .
## SHOT_NUMBER 3.285e-03 2.617e-03 1.256 0.2093
## PERIOD -2.494e-02 1.087e-02 -2.294 0.0218 *
## PLAYER_ID -2.097e-07 1.164e-07 -1.802 0.0716 .
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
## SHOT_DIST -6.418e-02 1.308e-03 -49.072 < 2e-16 ***
## CLOSE_DEF_DIST 1.182e-01 4.360e-03 27.102 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 68882 on 49999 degrees of freedom
## Residual deviance: 66245 on 49993 degrees of freedom
## AIC: 66259
##
## Number of Fisher Scoring iterations: 4
The Location of the team has a very slight impact on the result of the shot, From the summary it’s is evident as we see that LOCATION is not
significant to predict the result.
barplot(table(data$WIN_LOSE,data$HOME_TEAM),beside = T,legend=c("Lose","Win"),
col=c("#3C6688", "#45A778"), border="white",las=2,main="Team Analysis")
table(data$WIN_LOSE,data$HOME_TEAM)
##
## ATL BKN BOS CHA CHI CLE DAL DEN DET GSW HOU IND LAC LAL MEM
## L 868 753 928 849 931 883 850 838 881 743 857 722 901 808 906
## W 928 771 889 921 918 865 903 896 863 797 821 814 965 699 818
##
## MIA MIL MIN NOP NYK OKC ORL PHI PHX POR SAC SAS TOR UTA WAS
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
## L 752 666 816 847 733 737 797 667 897 903 1009 734 893 771 891
## W 715 709 809 802 737 701 839 791 868 904 1030 763 877 790 966
SAC has won the most matches at home,followed by WAS and LAC
##
## Call:
## glm(formula = WIN_LOSE ~ LOCATION + SEC_REMAIN + PLAYER_ID, family = "binomial",
## data = data)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.4095 -1.1645 0.9642 1.1070 1.3282
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -5.673e-02 2.685e-02 -2.113 0.03460 *
## LOCATIONH 5.005e-01 1.806e-02 27.712 < 2e-16 ***
## SEC_REMAIN 1.247e-04 4.360e-05 2.860 0.00424 **
## PLAYER_ID -1.428e-06 1.144e-07 -12.482 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 69312 on 49999 degrees of freedom
## Residual deviance: 68382 on 49996 degrees of freedom
## AIC: 68390
##
## Number of Fisher Scoring iterations: 4
Location and Player_id are very much statistically significant and sec_remain to predict the result of the match, as the p value is less than 0.05
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD