Hockey Rules

I am testing

head(data)
##   Rk                    X AvAge GP W L OL PTS  PTS. GF GA SOW SOL   SRS   SOS
## 1  1  Philadelphia Flyers  27.2  4 3 1  0   6 0.750 15 11   0   0  0.38 -0.63
## 2  2  Toronto Maple Leafs  29.0  4 3 1  0   6 0.750 14 12   0   0  1.85  1.35
## 3  3 Vegas Golden Knights  28.8  3 3 0  0   6 1.000 11  5   0   0  1.63 -0.38
## 4  4  Washington Capitals  30.2  4 2 0  2   6 0.750 15 13   0   1 -0.38 -0.63
## 5  5    New Jersey Devils  26.1  3 2 0  1   5 0.833  8  6   0   1  0.13 -0.21
## 6  6   Montreal Canadiens  28.6  3 2 0  1   5 0.833 12  7   0   0  0.83 -0.84
##   TG.G EVGF EVGA PP PPO   PP. PPA PPOA   PK. SH SHA PIM.G oPIM.G   S   S.  SA
## 1 6.50   12    7  3  12 25.00   4   15 73.33  0   0   7.5    6.0  99 15.2 144
## 2 6.50    8    9  6  14 42.86   3   17 82.35  0   0  13.3    9.3 135 10.4 103
## 3 5.33   10    3  0   7  0.00   1    8 87.50  1   1   5.3    4.7  90 12.2  76
## 4 7.00   13    9  2   8 25.00   3   16 81.25  0   1   9.3    5.3  98 15.3 114
## 5 4.67    7    1  1  10 10.00   4   13 69.23  0   1  11.0    9.0  81  9.9 115
## 6 6.33    6    4  4  10 40.00   2   14 85.71  2   1  11.0    8.3 102 11.8  95
##     SV. SO
## 1 0.924  1
## 2 0.883  0
## 3 0.934  0
## 4 0.886  0
## 5 0.948  0
## 6 0.926  0

Creating Project Part 0

  1. Exploratory Data Analysis of Quantitative
  2. Exploratory of One Categorical
  3. Exploratory of Two Categorical
  4. Hypothesis Test Comparing Mean to a Fixed Value
  5. Hypothesis Test Comparing Two Means
hist(data$PTS)

summary(data$PTS)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##     1.0     3.0     4.0     3.7     4.0     6.0       1
sd(data$PTS, na.rm = TRUE)
## [1] 1.368362
qqnorm(data$PTS)

boxplot(data$PTS)

Categorical Variables

table(data$X)/length(data$X)
## 
##         Anaheim Ducks       Arizona Coyotes         Boston Bruins 
##            0.03225806            0.03225806            0.03225806 
##        Buffalo Sabres        Calgary Flames   Carolina Hurricanes 
##            0.03225806            0.03225806            0.03225806 
##    Chicago Blackhawks    Colorado Avalanche Columbus Blue Jackets 
##            0.03225806            0.03225806            0.03225806 
##          Dallas Stars     Detroit Red Wings       Edmonton Oilers 
##            0.03225806            0.03225806            0.03225806 
##      Florida Panthers     Los Angeles Kings        Minnesota Wild 
##            0.03225806            0.03225806            0.03225806 
##    Montreal Canadiens   Nashville Predators     New Jersey Devils 
##            0.03225806            0.03225806            0.03225806 
##    New York Islanders      New York Rangers       Ottawa Senators 
##            0.03225806            0.03225806            0.03225806 
##   Philadelphia Flyers   Pittsburgh Penguins       San Jose Sharks 
##            0.03225806            0.03225806            0.03225806 
##       St. Louis Blues   Tampa Bay Lightning   Toronto Maple Leafs 
##            0.03225806            0.03225806            0.03225806 
##     Vancouver Canucks  Vegas Golden Knights   Washington Capitals 
##            0.03225806            0.03225806            0.03225806 
##         Winnipeg Jets 
##            0.03225806
table(data$X,data$GP)
##                        
##                         2 3 4
##   Anaheim Ducks         0 1 0
##   Arizona Coyotes       0 1 0
##   Boston Bruins         0 1 0
##   Buffalo Sabres        0 0 1
##   Calgary Flames        0 1 0
##   Carolina Hurricanes   0 1 0
##   Chicago Blackhawks    0 0 1
##   Colorado Avalanche    0 1 0
##   Columbus Blue Jackets 0 0 1
##   Dallas Stars          0 0 0
##   Detroit Red Wings     0 0 1
##   Edmonton Oilers       0 0 1
##   Florida Panthers      1 0 0
##   Los Angeles Kings     0 1 0
##   Minnesota Wild        0 1 0
##   Montreal Canadiens    0 1 0
##   Nashville Predators   0 1 0
##   New Jersey Devils     0 1 0
##   New York Islanders    0 1 0
##   New York Rangers      0 1 0
##   Ottawa Senators       0 1 0
##   Philadelphia Flyers   0 0 1
##   Pittsburgh Penguins   0 0 1
##   San Jose Sharks       0 1 0
##   St. Louis Blues       0 1 0
##   Tampa Bay Lightning   1 0 0
##   Toronto Maple Leafs   0 0 1
##   Vancouver Canucks     0 0 1
##   Vegas Golden Knights  0 1 0
##   Washington Capitals   0 0 1
##   Winnipeg Jets         0 1 0

Hypothesis Test

\[ H_0: \mu = 3\\ H_A: \mu\neq 3 \]

t.test(data$GP, mu = 3.25)
## 
##  One Sample t-test
## 
## data:  data$GP
## t = 0.1565, df = 29, p-value = 0.8767
## alternative hypothesis: true mean is not equal to 3.25
## 95 percent confidence interval:
##  3.048862 3.484472
## sample estimates:
## mean of x 
##  3.266667
lesspp = data[which(data$PPO <= data$PPOA),]
morepp = data[which(data$PPO > data$PPOA),]
t.test(lesspp$W,morepp$W)
## 
##  Welch Two Sample t-test
## 
## data:  lesspp$W and morepp$W
## t = -0.065226, df = 23.136, p-value = 0.9486
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.5840184  0.5483041
## sample estimates:
## mean of x mean of y 
##  1.625000  1.642857
t.test(data$GP, mu = 4)
## 
##  One Sample t-test
## 
## data:  data$GP
## t = -6.8861, df = 29, p-value = 1.448e-07
## alternative hypothesis: true mean is not equal to 4
## 95 percent confidence interval:
##  3.048862 3.484472
## sample estimates:
## mean of x 
##  3.266667

The entire project can be found at the following links. Note the number corresponds to the part of the project.

  1. Hypothesis Testing https://rpubs.com/nurfnick/715604
  2. Regression https://rpubs.com/nurfnick/720194
  3. Bootstrapping and Cross Validationhttps://rpubs.com/nurfnick/751598
  4. Contingency Tables and Goodness of Fit https://rpubs.com/nurfnick/730831
  5. ANOVA https://rpubs.com/nurfnick/733670
  6. NonParametric https://rpubs.com/nurfnick/743967