Professional Documents
Culture Documents
R Markdown
## Warning: package 'dplyr' was built under R version 3.4.2
##
## Attaching package: 'dplyr'
# total pass yards allowed on defense / total pass attempts by opposing team
nfl_df$defense_pass_yards_allowed_per_attempt<-
with(nfl_df,ifelse(nfl_df$DEF_Att>0,nfl_df$DEF_Yds.1/nfl_df$DEF_Att,0))
# total rush yards allowed on defense / total rush attempts by opposing team
nfl_df$defense_rush_yards_allowed_per_attempt<-
with(nfl_df,ifelse(nfl_df$DEF_Att.1>0,nfl_df$DEF_Yds.2/nfl_df$DEF_Att.1,0))
summary(reg1)
##
## Call:
## lm(formula = nfl_df$points_per_game ~ nfl_df$MVP_QB + nfl_df$NY.A +
## nfl_df$Y.A + nfl_df$TO. + nfl_df$DEF_TO. + nfl_df$X1stPy +
## nfl_df$pass_to_rush_ratio +
nfl_df$defense_pass_yards_allowed_per_attempt +
## nfl_df$defense_rush_yards_allowed_per_attempt)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.2956 -1.3269 0.0195 1.3111 6.1300
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) -10.67337 2.48437 -4.296
## nfl_df$MVP_QB 2.94253 0.79087 3.721
## nfl_df$NY.A 3.71910 0.17775 20.924
## nfl_df$Y.A 2.08226 0.32909 6.327
## nfl_df$TO. -0.16468 0.04342 -3.793
## nfl_df$DEF_TO. 0.31498 0.04420 7.126
## nfl_df$X1stPy 0.07722 0.01758 4.394
## nfl_df$pass_to_rush_ratio 2.04322 0.59440 3.437
## nfl_df$defense_pass_yards_allowed_per_attempt -0.50566 0.24095 -2.099
## nfl_df$defense_rush_yards_allowed_per_attempt -0.52165 0.33138 -1.574
## Pr(>|t|)
## (Intercept) 2.33e-05 ***
## nfl_df$MVP_QB 0.000236 ***
## nfl_df$NY.A < 2e-16 ***
## nfl_df$Y.A 8.72e-10 ***
## nfl_df$TO. 0.000179 ***
## nfl_df$DEF_TO. 7.27e-12 ***
## nfl_df$X1stPy 1.53e-05 ***
## nfl_df$pass_to_rush_ratio 0.000667 ***
## nfl_df$defense_pass_yards_allowed_per_attempt 0.036662 *
## nfl_df$defense_rush_yards_allowed_per_attempt 0.116466
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.191 on 310 degrees of freedom
## Multiple R-squared: 0.7704, Adjusted R-squared: 0.7637
## F-statistic: 115.6 on 9 and 310 DF, p-value: < 2.2e-16
library(car)
##
## Attaching package: 'car'
##
## Attaching package: 'MASS'
vif(reg1)
## nfl_df$MVP_QB
## 1.139182
## nfl_df$NY.A
## 1.276680
## nfl_df$Y.A
## 1.323041
## nfl_df$TO.
## 1.288935
## nfl_df$DEF_TO.
## 1.233192
## nfl_df$X1stPy
## 1.150195
## nfl_df$pass_to_rush_ratio
## 1.565779
## nfl_df$defense_pass_yards_allowed_per_attempt
## 1.474136
## nfl_df$defense_rush_yards_allowed_per_attempt
## 1.208867
vif(reg1)
## nfl_df$MVP_QB
## 1.139182
## nfl_df$NY.A
## 1.276680
## nfl_df$Y.A
## 1.323041
## nfl_df$TO.
## 1.288935
## nfl_df$DEF_TO.
## 1.233192
## nfl_df$X1stPy
## 1.150195
## nfl_df$pass_to_rush_ratio
## 1.565779
## nfl_df$defense_pass_yards_allowed_per_attempt
## 1.474136
## nfl_df$defense_rush_yards_allowed_per_attempt
## 1.208867
# VIF scores of 10 indicate high risk of multicollinearity, and scores of 4
indicate that further investigation is needed. If an independent variable has
a VIF score of 1, it has no correlation with the other independent variables
in the model. Each of our variables is close to 1, with 1.6 being the
highest
# Source: https://onlinecourses.science.psu.edu/stat501/node/347