This is a two-part series analyzing the recently released player data from EAFC 24. The first part will undertake a exploratory data analysis of the female only data. The second part will focus on building a linear regression model to predict player rating.
To perform the Linear Regression Model we need to install a range of different R packages to help manipulate and visual the data. If you have not already install the required packages, then delete the # to install.
The make the importing the data as seamless as possible, it is recommended to: 1. Create a new directory. 2. Create a “data” folder in the new directory. 3. Save the data in the “date” folder. 4. Follow the steps below.
The data can be found on Kaggle through this link: https://www.kaggle.com/datasets/nyagami/fc-24-players-database-and-stats-from-easports/code
# load the data and name it "eafc", na.strings turns any blank space to a NA value
eafc <- read.csv("Data/female_players.csv", na.strings = "NA")
In this step we will remove variables that are not required for our analysis. An important rule for Linear Regression models is that the variables are normally distributed. From our EDA in Part 1, we observed that 7 variables were skewed. We will log transform them to try and deal with this issue.
# Remove the missing values from the data set, remove GK
eafc_outfield <- eafc %>% select(-c("GK","URL","X","Gender","Name","Nation","Club")) %>% filter(Position !="GK")
# transformed the skew variables with a log function
eafc_outfield_log <- eafc_outfield %>%
mutate(
log_Standing = log(Standing),
log_Positioning = log(Positioning),
log_Interceptions = log(Interceptions),
log_vision = log(Vision),
log_Dribbling = log(Dribbling),
log_Acceleration = log(Acceleration),
log_Sprint = log(Sprint)
)
# analyse the skew values
describe(eafc_outfield_log[34:40])
## vars n mean sd median trimmed mad min max range skew
## Strength 1 1316 67.81 10.66 68.5 68.22 9.64 32 92 60 -0.43
## Aggression 2 1316 62.24 12.25 63.0 62.81 11.86 22 94 72 -0.40
## Att.work.rate* 3 1316 2.28 0.93 3.0 2.35 0.00 1 3 2 -0.58
## Def.work.rate* 4 1316 2.62 0.75 3.0 2.77 0.00 1 3 2 -1.56
## Preferred.foot* 5 1316 1.84 0.36 2.0 1.93 0.00 1 2 1 -1.87
## Weak.foot 6 1316 3.01 0.67 3.0 2.98 0.00 1 5 4 0.46
## Skill.moves 7 1316 2.82 0.69 3.0 2.76 0.00 2 5 3 0.43
## kurtosis se
## Strength 0.46 0.29
## Aggression 0.01 0.34
## Att.work.rate* -1.60 0.03
## Def.work.rate* 0.58 0.02
## Preferred.foot* 1.51 0.01
## Weak.foot 0.79 0.02
## Skill.moves -0.21 0.02
The skew actually worsened, so that original variables will be left instead of the new variables.
For this scenario we will use a cutoff of 0.8, for the correlations between variables.
#We need to first remove the target variable, in this case it is 'Overall'
target <- eafc_outfield$Overall
eafc_sub <- subset(eafc_outfield, select = -c(Overall))
# Explore the correlation between variables
ggcorr(eafc_sub,nbreaks = 4, palette = "RdGy", hjust = 0.75,label = TRUE, label_size = 2, label_color = "white", size = 2)
## Warning in ggcorr(eafc_sub, nbreaks = 4, palette = "RdGy", hjust = 0.75, : data
## in column(s) 'Position', 'Att.work.rate', 'Def.work.rate', 'Preferred.foot' are
## not numeric and were ignored
# convert the dataframe to a matrix
m <- data.matrix(eafc_sub)
corr_m <- cor(m)
# find highly correlated variables
highlyCorrM <- findCorrelation(corr_m, cutoff=0.9)
names(eafc_sub)[highlyCorrM]
## [1] "Shooting" "Acceleration" "Pace" "Defending"
## [5] "Sliding" "Interceptions"
eafc_sub <- eafc_sub %>%
select(-c("Defending", "Pace", "Shooting", "Sliding","Def","Interceptions"))
ggcorr(eafc_sub,nbreaks = 4, palette = "RdGy", hjust = 0.75,label = TRUE, label_size = 2, label_color = "white", size = 2)
## Warning in ggcorr(eafc_sub, nbreaks = 4, palette = "RdGy", hjust = 0.75, : data
## in column(s) 'Position', 'Att.work.rate', 'Def.work.rate', 'Preferred.foot' are
## not numeric and were ignored
# convert the dataframe to a matrix
m <- data.matrix(eafc_sub)
corr_m <- cor(m)
# find highly correlated variables
highlyCorrM <- findCorrelation(corr_m, cutoff=0.8)
names(eafc_sub)[highlyCorrM]
## [1] "Passing" "Dribbling" "Positioning" "Volleys" "Acceleration"
## [6] "Physicality" "Heading"
eafc_sub <- eafc_sub %>%
select(-c("Passing","Dribbling","Positioning","Volleys","Acceleration","Physicality","Heading"))
m <- data.matrix(eafc_sub)
corr_m <- cor(m)
# find highly correlated variables
highlyCorrM <- findCorrelation(corr_m, cutoff=0.8)
names(eafc_sub)[highlyCorrM]
## character(0)
eafc_sub$Overall <- target
# create the sample size for training set, we are going for 2/3 of the data.
sample_size <- floor(2/3 * nrow(eafc_sub))
set.seed(123)
# sample the data.
eafc_sub <- eafc_sub[sample(nrow(eafc_sub)),]
# create training and testing datasets.
train <- eafc_sub[1:sample_size, ]
test <- eafc_sub[(sample_size+1):nrow(eafc_sub), ]
# Linear Model ------------------------------------------------------------
# create the base lm
mod <- lm(Overall ~ ., data = train)
# try stepwise approach
modAIC <- MASS::stepAIC(mod,k =2)
## Start: AIC=1038.61
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Vision + Crossing + Free + Curve + Agility +
## Balance + Reactions + Ball + Composure + Standing + Jumping +
## Stamina + Strength + Aggression + Att.work.rate + Def.work.rate +
## Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Att.work.rate 2 2.96 2613.4 1035.6
## - Vision 1 0.05 2610.5 1036.6
## - Aggression 1 0.33 2610.8 1036.7
## - Crossing 1 0.40 2610.9 1036.7
## - Def.work.rate 2 7.84 2618.3 1037.2
## <none> 2610.5 1038.6
## - Skill.moves 1 8.20 2618.7 1039.4
## - Preferred.foot 1 9.34 2619.8 1039.7
## - Penalties 1 11.66 2622.1 1040.5
## - Finishing 1 12.43 2622.9 1040.8
## - Curve 1 13.01 2623.5 1041.0
## - Long 1 14.09 2624.5 1041.3
## - Standing 1 22.68 2633.1 1044.2
## - Free 1 22.80 2633.3 1044.2
## - Sprint 1 22.97 2633.4 1044.3
## - Agility 1 23.21 2633.7 1044.4
## - Strength 1 27.89 2638.3 1045.9
## - Age 1 28.25 2638.7 1046.0
## - Weak.foot 1 36.38 2646.8 1048.7
## - Jumping 1 79.41 2689.9 1062.9
## - Balance 1 83.73 2694.2 1064.3
## - Stamina 1 109.81 2720.3 1072.7
## - Position 13 231.63 2842.1 1087.2
## - Ball 1 195.38 2805.8 1099.9
## - Shot 1 209.19 2819.6 1104.2
## - Composure 1 226.55 2837.0 1109.6
## - Reactions 1 1045.79 3656.2 1332.1
##
## Step: AIC=1035.6
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Vision + Crossing + Free + Curve + Agility +
## Balance + Reactions + Ball + Composure + Standing + Jumping +
## Stamina + Strength + Aggression + Def.work.rate + Preferred.foot +
## Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Vision 1 0.07 2613.5 1033.6
## - Aggression 1 0.30 2613.7 1033.7
## - Crossing 1 0.39 2613.8 1033.7
## - Def.work.rate 2 7.46 2620.9 1034.1
## <none> 2613.4 1035.6
## - Preferred.foot 1 9.09 2622.5 1036.7
## - Skill.moves 1 9.41 2622.8 1036.8
## - Penalties 1 11.99 2625.4 1037.6
## - Finishing 1 12.80 2626.2 1037.9
## - Curve 1 13.38 2626.8 1038.1
## - Long 1 13.99 2627.4 1038.3
## - Free 1 22.13 2635.5 1041.0
## - Agility 1 23.51 2636.9 1041.5
## - Standing 1 23.71 2637.1 1041.5
## - Sprint 1 24.03 2637.4 1041.6
## - Age 1 27.17 2640.6 1042.7
## - Strength 1 28.20 2641.6 1043.0
## - Weak.foot 1 37.64 2651.1 1046.1
## - Jumping 1 80.06 2693.5 1060.1
## - Balance 1 86.35 2699.8 1062.1
## - Stamina 1 115.67 2729.1 1071.6
## - Position 13 233.43 2846.8 1084.6
## - Ball 1 196.72 2810.1 1097.2
## - Shot 1 210.37 2823.8 1101.5
## - Composure 1 228.71 2842.1 1107.2
## - Reactions 1 1059.63 3673.0 1332.1
##
## Step: AIC=1033.62
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Crossing + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Aggression + Def.work.rate + Preferred.foot +
## Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Aggression 1 0.29 2613.8 1031.7
## - Crossing 1 0.34 2613.8 1031.7
## - Def.work.rate 2 7.45 2620.9 1032.1
## <none> 2613.5 1033.6
## - Preferred.foot 1 9.11 2622.6 1034.7
## - Skill.moves 1 9.34 2622.8 1034.8
## - Penalties 1 12.04 2625.5 1035.7
## - Finishing 1 13.04 2626.5 1036.0
## - Curve 1 13.43 2626.9 1036.1
## - Long 1 14.22 2627.7 1036.4
## - Free 1 22.06 2635.5 1039.0
## - Standing 1 23.73 2637.2 1039.5
## - Agility 1 24.13 2637.6 1039.7
## - Sprint 1 24.13 2637.6 1039.7
## - Age 1 27.24 2640.7 1040.7
## - Strength 1 28.17 2641.6 1041.0
## - Weak.foot 1 37.57 2651.1 1044.1
## - Jumping 1 81.48 2695.0 1058.5
## - Balance 1 87.21 2700.7 1060.4
## - Stamina 1 115.61 2729.1 1069.6
## - Position 13 252.09 2865.6 1088.4
## - Ball 1 198.04 2811.5 1095.7
## - Shot 1 210.34 2823.8 1099.5
## - Composure 1 229.84 2843.3 1105.5
## - Reactions 1 1060.33 3673.8 1330.3
##
## Step: AIC=1031.72
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Crossing + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Def.work.rate + Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Crossing 1 0.33 2614.1 1029.8
## - Def.work.rate 2 7.58 2621.3 1030.3
## <none> 2613.8 1031.7
## - Preferred.foot 1 8.93 2622.7 1032.7
## - Skill.moves 1 9.10 2622.9 1032.8
## - Penalties 1 11.85 2625.6 1033.7
## - Finishing 1 12.75 2626.5 1034.0
## - Curve 1 13.58 2627.3 1034.3
## - Long 1 14.08 2627.8 1034.4
## - Free 1 21.99 2635.8 1037.1
## - Agility 1 23.87 2637.6 1037.7
## - Sprint 1 24.09 2637.9 1037.8
## - Standing 1 25.37 2639.1 1038.2
## - Age 1 27.68 2641.4 1039.0
## - Strength 1 29.50 2643.3 1039.6
## - Weak.foot 1 38.19 2652.0 1042.4
## - Jumping 1 81.19 2695.0 1056.5
## - Balance 1 86.96 2700.7 1058.4
## - Stamina 1 117.66 2731.4 1068.3
## - Position 13 255.85 2869.6 1087.6
## - Ball 1 197.86 2811.6 1093.7
## - Shot 1 213.06 2826.8 1098.4
## - Composure 1 232.32 2846.1 1104.4
## - Reactions 1 1084.03 3697.8 1334.0
##
## Step: AIC=1029.83
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Free + Curve + Agility + Balance + Reactions +
## Ball + Composure + Standing + Jumping + Stamina + Strength +
## Def.work.rate + Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Def.work.rate 2 7.75 2621.8 1028.4
## <none> 2614.1 1029.8
## - Preferred.foot 1 8.83 2622.9 1030.8
## - Skill.moves 1 8.98 2623.1 1030.8
## - Penalties 1 11.77 2625.9 1031.8
## - Finishing 1 12.77 2626.9 1032.1
## - Long 1 14.20 2628.3 1032.6
## - Curve 1 20.46 2634.6 1034.7
## - Free 1 21.91 2636.0 1035.2
## - Agility 1 23.73 2637.8 1035.8
## - Sprint 1 24.38 2638.5 1036.0
## - Standing 1 26.03 2640.1 1036.5
## - Age 1 28.10 2642.2 1037.2
## - Strength 1 29.24 2643.3 1037.6
## - Weak.foot 1 37.97 2652.1 1040.5
## - Jumping 1 82.00 2696.1 1054.9
## - Balance 1 86.69 2700.8 1056.4
## - Stamina 1 117.91 2732.0 1066.5
## - Position 13 260.99 2875.1 1087.3
## - Ball 1 202.35 2816.5 1093.2
## - Shot 1 214.75 2828.9 1097.1
## - Composure 1 232.08 2846.2 1102.4
## - Reactions 1 1083.70 3697.8 1332.0
##
## Step: AIC=1028.43
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Free + Curve + Agility + Balance + Reactions +
## Ball + Composure + Standing + Jumping + Stamina + Strength +
## Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## <none> 2621.8 1028.4
## - Preferred.foot 1 8.32 2630.2 1029.2
## - Skill.moves 1 9.52 2631.4 1029.6
## - Penalties 1 11.88 2633.7 1030.4
## - Long 1 13.75 2635.6 1031.0
## - Finishing 1 14.06 2635.9 1031.1
## - Free 1 21.02 2642.9 1033.4
## - Curve 1 21.20 2643.1 1033.5
## - Agility 1 22.53 2644.4 1033.9
## - Sprint 1 24.14 2646.0 1034.5
## - Age 1 28.66 2650.5 1036.0
## - Strength 1 30.43 2652.3 1036.5
## - Standing 1 30.62 2652.5 1036.6
## - Weak.foot 1 37.48 2659.3 1038.9
## - Jumping 1 81.25 2703.1 1053.2
## - Balance 1 89.50 2711.3 1055.9
## - Stamina 1 119.94 2741.8 1065.7
## - Position 13 270.64 2892.5 1088.6
## - Ball 1 201.64 2823.5 1091.4
## - Shot 1 215.18 2837.0 1095.6
## - Composure 1 234.27 2856.1 1101.5
## - Reactions 1 1096.40 3718.2 1332.8
extractAIC(modAIC)[2]
## [1] 1028.428
AIC(modAIC)
## [1] 3519.246
summary(modAIC)
##
## Call:
## lm(formula = Overall ~ Position + Age + Sprint + Finishing +
## Shot + Long + Penalties + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Preferred.foot + Weak.foot + Skill.moves, data = train)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.223 -1.050 0.026 1.123 6.166
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.723444 0.957338 5.978 3.32e-09 ***
## PositionCB 1.379044 0.433939 3.178 0.001537 **
## PositionCDM 0.076857 0.381563 0.201 0.840413
## PositionCF 0.031965 1.283835 0.025 0.980142
## PositionCM -1.170370 0.312250 -3.748 0.000190 ***
## PositionLB 0.738758 0.422400 1.749 0.080663 .
## PositionLM 0.234936 0.394938 0.595 0.552092
## PositionLW 0.397947 0.410546 0.969 0.332668
## PositionLWB -2.688872 1.829323 -1.470 0.141969
## PositionRB 0.512767 0.408367 1.256 0.209590
## PositionRM 0.490960 0.397781 1.234 0.217455
## PositionRW 0.617897 0.374715 1.649 0.099524 .
## PositionRWB 0.215038 1.081558 0.199 0.842450
## PositionST 0.212945 0.322309 0.661 0.508995
## Age 0.053444 0.017606 3.035 0.002475 **
## Sprint 0.025096 0.009007 2.786 0.005454 **
## Finishing 0.019655 0.009243 2.127 0.033748 *
## Shot 0.156379 0.018801 8.318 3.58e-16 ***
## Long 0.024564 0.011684 2.102 0.035813 *
## Penalties -0.018012 0.009214 -1.955 0.050935 .
## Free -0.022570 0.008683 -2.599 0.009501 **
## Curve 0.019503 0.007469 2.611 0.009185 **
## Agility -0.022489 0.008355 -2.692 0.007253 **
## Balance 0.035175 0.006557 5.364 1.05e-07 ***
## Reactions 0.259977 0.013847 18.776 < 2e-16 ***
## Ball 0.150608 0.018705 8.052 2.77e-15 ***
## Composure 0.101857 0.011736 8.679 < 2e-16 ***
## Standing 0.022996 0.007329 3.138 0.001763 **
## Jumping 0.064550 0.012629 5.111 3.97e-07 ***
## Stamina 0.052162 0.008400 6.210 8.31e-10 ***
## Strength 0.032593 0.010421 3.128 0.001822 **
## Preferred.footRight 0.310251 0.189673 1.636 0.102272
## Weak.foot 0.365067 0.105158 3.472 0.000544 ***
## Skill.moves 0.254800 0.145612 1.750 0.080508 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.764 on 843 degrees of freedom
## Multiple R-squared: 0.9216, Adjusted R-squared: 0.9185
## F-statistic: 300.1 on 33 and 843 DF, p-value: < 2.2e-16
# try backward stepwise approach
modAIC_back <-MASS::stepAIC(mod,direction = 'backward', k =2)
## Start: AIC=1038.61
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Vision + Crossing + Free + Curve + Agility +
## Balance + Reactions + Ball + Composure + Standing + Jumping +
## Stamina + Strength + Aggression + Att.work.rate + Def.work.rate +
## Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Att.work.rate 2 2.96 2613.4 1035.6
## - Vision 1 0.05 2610.5 1036.6
## - Aggression 1 0.33 2610.8 1036.7
## - Crossing 1 0.40 2610.9 1036.7
## - Def.work.rate 2 7.84 2618.3 1037.2
## <none> 2610.5 1038.6
## - Skill.moves 1 8.20 2618.7 1039.4
## - Preferred.foot 1 9.34 2619.8 1039.7
## - Penalties 1 11.66 2622.1 1040.5
## - Finishing 1 12.43 2622.9 1040.8
## - Curve 1 13.01 2623.5 1041.0
## - Long 1 14.09 2624.5 1041.3
## - Standing 1 22.68 2633.1 1044.2
## - Free 1 22.80 2633.3 1044.2
## - Sprint 1 22.97 2633.4 1044.3
## - Agility 1 23.21 2633.7 1044.4
## - Strength 1 27.89 2638.3 1045.9
## - Age 1 28.25 2638.7 1046.0
## - Weak.foot 1 36.38 2646.8 1048.7
## - Jumping 1 79.41 2689.9 1062.9
## - Balance 1 83.73 2694.2 1064.3
## - Stamina 1 109.81 2720.3 1072.7
## - Position 13 231.63 2842.1 1087.2
## - Ball 1 195.38 2805.8 1099.9
## - Shot 1 209.19 2819.6 1104.2
## - Composure 1 226.55 2837.0 1109.6
## - Reactions 1 1045.79 3656.2 1332.1
##
## Step: AIC=1035.6
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Vision + Crossing + Free + Curve + Agility +
## Balance + Reactions + Ball + Composure + Standing + Jumping +
## Stamina + Strength + Aggression + Def.work.rate + Preferred.foot +
## Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Vision 1 0.07 2613.5 1033.6
## - Aggression 1 0.30 2613.7 1033.7
## - Crossing 1 0.39 2613.8 1033.7
## - Def.work.rate 2 7.46 2620.9 1034.1
## <none> 2613.4 1035.6
## - Preferred.foot 1 9.09 2622.5 1036.7
## - Skill.moves 1 9.41 2622.8 1036.8
## - Penalties 1 11.99 2625.4 1037.6
## - Finishing 1 12.80 2626.2 1037.9
## - Curve 1 13.38 2626.8 1038.1
## - Long 1 13.99 2627.4 1038.3
## - Free 1 22.13 2635.5 1041.0
## - Agility 1 23.51 2636.9 1041.5
## - Standing 1 23.71 2637.1 1041.5
## - Sprint 1 24.03 2637.4 1041.6
## - Age 1 27.17 2640.6 1042.7
## - Strength 1 28.20 2641.6 1043.0
## - Weak.foot 1 37.64 2651.1 1046.1
## - Jumping 1 80.06 2693.5 1060.1
## - Balance 1 86.35 2699.8 1062.1
## - Stamina 1 115.67 2729.1 1071.6
## - Position 13 233.43 2846.8 1084.6
## - Ball 1 196.72 2810.1 1097.2
## - Shot 1 210.37 2823.8 1101.5
## - Composure 1 228.71 2842.1 1107.2
## - Reactions 1 1059.63 3673.0 1332.1
##
## Step: AIC=1033.62
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Crossing + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Aggression + Def.work.rate + Preferred.foot +
## Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Aggression 1 0.29 2613.8 1031.7
## - Crossing 1 0.34 2613.8 1031.7
## - Def.work.rate 2 7.45 2620.9 1032.1
## <none> 2613.5 1033.6
## - Preferred.foot 1 9.11 2622.6 1034.7
## - Skill.moves 1 9.34 2622.8 1034.8
## - Penalties 1 12.04 2625.5 1035.7
## - Finishing 1 13.04 2626.5 1036.0
## - Curve 1 13.43 2626.9 1036.1
## - Long 1 14.22 2627.7 1036.4
## - Free 1 22.06 2635.5 1039.0
## - Standing 1 23.73 2637.2 1039.5
## - Agility 1 24.13 2637.6 1039.7
## - Sprint 1 24.13 2637.6 1039.7
## - Age 1 27.24 2640.7 1040.7
## - Strength 1 28.17 2641.6 1041.0
## - Weak.foot 1 37.57 2651.1 1044.1
## - Jumping 1 81.48 2695.0 1058.5
## - Balance 1 87.21 2700.7 1060.4
## - Stamina 1 115.61 2729.1 1069.6
## - Position 13 252.09 2865.6 1088.4
## - Ball 1 198.04 2811.5 1095.7
## - Shot 1 210.34 2823.8 1099.5
## - Composure 1 229.84 2843.3 1105.5
## - Reactions 1 1060.33 3673.8 1330.3
##
## Step: AIC=1031.72
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Crossing + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Def.work.rate + Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Crossing 1 0.33 2614.1 1029.8
## - Def.work.rate 2 7.58 2621.3 1030.3
## <none> 2613.8 1031.7
## - Preferred.foot 1 8.93 2622.7 1032.7
## - Skill.moves 1 9.10 2622.9 1032.8
## - Penalties 1 11.85 2625.6 1033.7
## - Finishing 1 12.75 2626.5 1034.0
## - Curve 1 13.58 2627.3 1034.3
## - Long 1 14.08 2627.8 1034.4
## - Free 1 21.99 2635.8 1037.1
## - Agility 1 23.87 2637.6 1037.7
## - Sprint 1 24.09 2637.9 1037.8
## - Standing 1 25.37 2639.1 1038.2
## - Age 1 27.68 2641.4 1039.0
## - Strength 1 29.50 2643.3 1039.6
## - Weak.foot 1 38.19 2652.0 1042.4
## - Jumping 1 81.19 2695.0 1056.5
## - Balance 1 86.96 2700.7 1058.4
## - Stamina 1 117.66 2731.4 1068.3
## - Position 13 255.85 2869.6 1087.6
## - Ball 1 197.86 2811.6 1093.7
## - Shot 1 213.06 2826.8 1098.4
## - Composure 1 232.32 2846.1 1104.4
## - Reactions 1 1084.03 3697.8 1334.0
##
## Step: AIC=1029.83
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Free + Curve + Agility + Balance + Reactions +
## Ball + Composure + Standing + Jumping + Stamina + Strength +
## Def.work.rate + Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Def.work.rate 2 7.75 2621.8 1028.4
## <none> 2614.1 1029.8
## - Preferred.foot 1 8.83 2622.9 1030.8
## - Skill.moves 1 8.98 2623.1 1030.8
## - Penalties 1 11.77 2625.9 1031.8
## - Finishing 1 12.77 2626.9 1032.1
## - Long 1 14.20 2628.3 1032.6
## - Curve 1 20.46 2634.6 1034.7
## - Free 1 21.91 2636.0 1035.2
## - Agility 1 23.73 2637.8 1035.8
## - Sprint 1 24.38 2638.5 1036.0
## - Standing 1 26.03 2640.1 1036.5
## - Age 1 28.10 2642.2 1037.2
## - Strength 1 29.24 2643.3 1037.6
## - Weak.foot 1 37.97 2652.1 1040.5
## - Jumping 1 82.00 2696.1 1054.9
## - Balance 1 86.69 2700.8 1056.4
## - Stamina 1 117.91 2732.0 1066.5
## - Position 13 260.99 2875.1 1087.3
## - Ball 1 202.35 2816.5 1093.2
## - Shot 1 214.75 2828.9 1097.1
## - Composure 1 232.08 2846.2 1102.4
## - Reactions 1 1083.70 3697.8 1332.0
##
## Step: AIC=1028.43
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Free + Curve + Agility + Balance + Reactions +
## Ball + Composure + Standing + Jumping + Stamina + Strength +
## Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## <none> 2621.8 1028.4
## - Preferred.foot 1 8.32 2630.2 1029.2
## - Skill.moves 1 9.52 2631.4 1029.6
## - Penalties 1 11.88 2633.7 1030.4
## - Long 1 13.75 2635.6 1031.0
## - Finishing 1 14.06 2635.9 1031.1
## - Free 1 21.02 2642.9 1033.4
## - Curve 1 21.20 2643.1 1033.5
## - Agility 1 22.53 2644.4 1033.9
## - Sprint 1 24.14 2646.0 1034.5
## - Age 1 28.66 2650.5 1036.0
## - Strength 1 30.43 2652.3 1036.5
## - Standing 1 30.62 2652.5 1036.6
## - Weak.foot 1 37.48 2659.3 1038.9
## - Jumping 1 81.25 2703.1 1053.2
## - Balance 1 89.50 2711.3 1055.9
## - Stamina 1 119.94 2741.8 1065.7
## - Position 13 270.64 2892.5 1088.6
## - Ball 1 201.64 2823.5 1091.4
## - Shot 1 215.18 2837.0 1095.6
## - Composure 1 234.27 2856.1 1101.5
## - Reactions 1 1096.40 3718.2 1332.8
extractAIC(modAIC)[2]
## [1] 1028.428
AIC(modAIC_back)
## [1] 3519.246
summary(modAIC)
##
## Call:
## lm(formula = Overall ~ Position + Age + Sprint + Finishing +
## Shot + Long + Penalties + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Preferred.foot + Weak.foot + Skill.moves, data = train)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.223 -1.050 0.026 1.123 6.166
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.723444 0.957338 5.978 3.32e-09 ***
## PositionCB 1.379044 0.433939 3.178 0.001537 **
## PositionCDM 0.076857 0.381563 0.201 0.840413
## PositionCF 0.031965 1.283835 0.025 0.980142
## PositionCM -1.170370 0.312250 -3.748 0.000190 ***
## PositionLB 0.738758 0.422400 1.749 0.080663 .
## PositionLM 0.234936 0.394938 0.595 0.552092
## PositionLW 0.397947 0.410546 0.969 0.332668
## PositionLWB -2.688872 1.829323 -1.470 0.141969
## PositionRB 0.512767 0.408367 1.256 0.209590
## PositionRM 0.490960 0.397781 1.234 0.217455
## PositionRW 0.617897 0.374715 1.649 0.099524 .
## PositionRWB 0.215038 1.081558 0.199 0.842450
## PositionST 0.212945 0.322309 0.661 0.508995
## Age 0.053444 0.017606 3.035 0.002475 **
## Sprint 0.025096 0.009007 2.786 0.005454 **
## Finishing 0.019655 0.009243 2.127 0.033748 *
## Shot 0.156379 0.018801 8.318 3.58e-16 ***
## Long 0.024564 0.011684 2.102 0.035813 *
## Penalties -0.018012 0.009214 -1.955 0.050935 .
## Free -0.022570 0.008683 -2.599 0.009501 **
## Curve 0.019503 0.007469 2.611 0.009185 **
## Agility -0.022489 0.008355 -2.692 0.007253 **
## Balance 0.035175 0.006557 5.364 1.05e-07 ***
## Reactions 0.259977 0.013847 18.776 < 2e-16 ***
## Ball 0.150608 0.018705 8.052 2.77e-15 ***
## Composure 0.101857 0.011736 8.679 < 2e-16 ***
## Standing 0.022996 0.007329 3.138 0.001763 **
## Jumping 0.064550 0.012629 5.111 3.97e-07 ***
## Stamina 0.052162 0.008400 6.210 8.31e-10 ***
## Strength 0.032593 0.010421 3.128 0.001822 **
## Preferred.footRight 0.310251 0.189673 1.636 0.102272
## Weak.foot 0.365067 0.105158 3.472 0.000544 ***
## Skill.moves 0.254800 0.145612 1.750 0.080508 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.764 on 843 degrees of freedom
## Multiple R-squared: 0.9216, Adjusted R-squared: 0.9185
## F-statistic: 300.1 on 33 and 843 DF, p-value: < 2.2e-16
#try forward stepwise approach
modf <- lm(Overall ~ 1, data = train)
modAIC_forward <-MASS::stepAIC(modf,
direction = 'forward',
scope = list(lower = modf, upper = mod),
k =2)
## Start: AIC=3194.79
## Overall ~ 1
##
## Df Sum of Sq RSS AIC
## + Reactions 1 24956.6 8469 1992.8
## + Shot 1 20828.6 12597 2341.0
## + Composure 1 19708.0 13718 2415.7
## + Ball 1 18425.1 15001 2494.1
## + Stamina 1 15214.6 18211 2664.2
## + Jumping 1 12900.4 20525 2769.1
## + Long 1 11824.0 21602 2813.9
## + Age 1 9473.4 23952 2904.5
## + Curve 1 8383.5 25042 2943.5
## + Crossing 1 7813.6 25612 2963.3
## + Strength 1 7674.4 25751 2968.0
## + Att.work.rate 2 6879.3 26546 2996.7
## + Vision 1 6299.7 27126 3013.6
## + Free 1 6296.1 27130 3013.8
## + Sprint 1 5937.2 27489 3025.3
## + Agility 1 5826.0 27600 3028.8
## + Skill.moves 1 5627.2 27799 3035.1
## + Penalties 1 5333.2 28093 3044.3
## + Balance 1 5221.0 28205 3047.8
## + Weak.foot 1 4596.1 28830 3067.1
## + Aggression 1 4552.7 28873 3068.4
## + Def.work.rate 2 3195.5 30230 3110.7
## + Finishing 1 3106.7 30319 3111.2
## + Standing 1 1576.6 31849 3154.4
## + Position 13 1150.4 32275 3190.1
## + Preferred.foot 1 96.9 33329 3194.2
## <none> 33426 3194.8
##
## Step: AIC=1992.76
## Overall ~ Reactions
##
## Df Sum of Sq RSS AIC
## + Composure 1 2543.17 5926.0 1681.6
## + Shot 1 2262.96 6206.2 1722.1
## + Stamina 1 1849.25 6619.9 1778.7
## + Ball 1 1676.15 6793.0 1801.3
## + Jumping 1 1382.74 7086.4 1838.4
## + Long 1 1023.65 7445.5 1881.8
## + Curve 1 840.64 7628.5 1903.1
## + Sprint 1 796.55 7672.6 1908.1
## + Crossing 1 753.66 7715.5 1913.0
## + Strength 1 731.23 7737.9 1915.6
## + Balance 1 705.76 7763.4 1918.5
## + Skill.moves 1 681.33 7787.8 1921.2
## + Agility 1 553.30 7915.9 1935.5
## + Weak.foot 1 532.93 7936.2 1937.8
## + Att.work.rate 2 513.46 7955.7 1941.9
## + Vision 1 421.50 8047.7 1950.0
## + Age 1 364.30 8104.9 1956.2
## + Free 1 350.87 8118.3 1957.7
## + Position 13 483.10 7986.1 1967.2
## + Def.work.rate 2 233.95 8235.2 1972.2
## + Penalties 1 166.11 8303.1 1977.4
## + Aggression 1 161.12 8308.0 1977.9
## + Finishing 1 102.24 8366.9 1984.1
## + Standing 1 95.84 8373.3 1984.8
## <none> 8469.2 1992.8
## + Preferred.foot 1 0.46 8468.7 1994.7
##
## Step: AIC=1681.59
## Overall ~ Reactions + Composure
##
## Df Sum of Sq RSS AIC
## + Shot 1 1008.37 4917.6 1520.0
## + Stamina 1 827.33 5098.7 1551.7
## + Jumping 1 788.79 5137.2 1558.3
## + Ball 1 558.40 5367.6 1596.8
## + Sprint 1 417.06 5508.9 1619.6
## + Balance 1 395.35 5530.6 1623.0
## + Strength 1 365.45 5560.6 1627.8
## + Long 1 292.29 5633.7 1639.2
## + Crossing 1 263.24 5662.8 1643.7
## + Position 13 399.04 5527.0 1646.5
## + Weak.foot 1 199.41 5726.6 1653.6
## + Att.work.rate 2 182.37 5743.6 1658.2
## + Agility 1 154.31 5771.7 1660.5
## + Curve 1 143.41 5782.6 1662.1
## + Standing 1 98.36 5827.6 1668.9
## + Skill.moves 1 97.15 5828.8 1669.1
## + Def.work.rate 2 107.49 5818.5 1669.5
## + Aggression 1 68.17 5857.8 1673.5
## + Age 1 32.54 5893.5 1678.8
## + Vision 1 21.81 5904.2 1680.4
## <none> 5926.0 1681.6
## + Free 1 7.73 5918.3 1682.5
## + Finishing 1 2.32 5923.7 1683.2
## + Penalties 1 0.75 5925.2 1683.5
## + Preferred.foot 1 0.60 5925.4 1683.5
##
## Step: AIC=1520.01
## Overall ~ Reactions + Composure + Shot
##
## Df Sum of Sq RSS AIC
## + Jumping 1 1006.24 3911.4 1321.2
## + Strength 1 532.82 4384.8 1421.4
## + Stamina 1 465.67 4452.0 1434.8
## + Position 13 575.96 4341.7 1436.8
## + Sprint 1 396.89 4520.7 1448.2
## + Balance 1 267.92 4649.7 1472.9
## + Ball 1 182.37 4735.3 1488.9
## + Weak.foot 1 165.23 4752.4 1492.0
## + Crossing 1 116.66 4801.0 1501.0
## + Att.work.rate 2 111.71 4805.9 1503.9
## + Agility 1 76.32 4841.3 1508.3
## + Def.work.rate 2 69.42 4848.2 1511.5
## + Curve 1 50.84 4866.8 1512.9
## + Age 1 49.07 4868.6 1513.2
## + Skill.moves 1 42.87 4874.8 1514.3
## + Vision 1 32.18 4885.4 1516.2
## + Aggression 1 27.11 4890.5 1517.2
## + Long 1 14.59 4903.0 1519.4
## + Penalties 1 12.95 4904.7 1519.7
## <none> 4917.6 1520.0
## + Free 1 10.97 4906.7 1520.0
## + Standing 1 7.71 4909.9 1520.6
## + Finishing 1 1.30 4916.3 1521.8
## + Preferred.foot 1 0.01 4917.6 1522.0
##
## Step: AIC=1321.24
## Overall ~ Reactions + Composure + Shot + Jumping
##
## Df Sum of Sq RSS AIC
## + Balance 1 372.79 3538.6 1235.4
## + Stamina 1 343.06 3568.3 1242.7
## + Ball 1 210.62 3700.8 1274.7
## + Crossing 1 150.56 3760.8 1288.8
## + Position 13 237.40 3674.0 1292.3
## + Sprint 1 131.40 3780.0 1293.3
## + Curve 1 124.82 3786.6 1294.8
## + Weak.foot 1 118.58 3792.8 1296.2
## + Agility 1 71.79 3839.6 1307.0
## + Skill.moves 1 63.52 3847.9 1308.9
## + Att.work.rate 2 69.14 3842.2 1309.6
## + Def.work.rate 2 60.68 3850.7 1311.5
## + Age 1 31.18 3880.2 1316.2
## + Standing 1 23.21 3888.2 1318.0
## + Penalties 1 12.30 3899.1 1320.5
## <none> 3911.4 1321.2
## + Long 1 7.02 3904.4 1321.7
## + Aggression 1 6.75 3904.6 1321.7
## + Vision 1 6.59 3904.8 1321.8
## + Free 1 0.77 3910.6 1323.1
## + Finishing 1 0.26 3911.1 1323.2
## + Strength 1 0.21 3911.2 1323.2
## + Preferred.foot 1 0.01 3911.4 1323.2
##
## Step: AIC=1235.4
## Overall ~ Reactions + Composure + Shot + Jumping + Balance
##
## Df Sum of Sq RSS AIC
## + Stamina 1 211.299 3327.3 1183.4
## + Ball 1 96.894 3441.7 1213.0
## + Position 13 168.708 3369.9 1218.5
## + Crossing 1 59.894 3478.7 1222.4
## + Weak.foot 1 52.529 3486.1 1224.3
## + Standing 1 44.067 3494.5 1226.4
## + Curve 1 37.958 3500.6 1227.9
## + Def.work.rate 2 45.590 3493.0 1228.0
## + Age 1 26.879 3511.7 1230.7
## + Penalties 1 25.393 3513.2 1231.1
## + Sprint 1 25.021 3513.6 1231.2
## + Aggression 1 21.521 3517.1 1232.0
## + Free 1 19.648 3518.9 1232.5
## + Strength 1 19.438 3519.2 1232.6
## + Att.work.rate 2 17.423 3521.2 1235.1
## <none> 3538.6 1235.4
## + Long 1 7.378 3531.2 1235.6
## + Skill.moves 1 7.015 3531.6 1235.7
## + Finishing 1 5.253 3533.3 1236.1
## + Preferred.foot 1 2.867 3535.7 1236.7
## + Agility 1 1.582 3537.0 1237.0
## + Vision 1 0.034 3538.6 1237.4
##
## Step: AIC=1183.4
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina
##
## Df Sum of Sq RSS AIC
## + Position 13 204.252 3123.0 1153.8
## + Ball 1 65.236 3262.1 1168.0
## + Weak.foot 1 39.935 3287.4 1174.8
## + Age 1 29.018 3298.3 1177.7
## + Penalties 1 28.194 3299.1 1177.9
## + Free 1 27.639 3299.7 1178.1
## + Crossing 1 24.716 3302.6 1178.9
## + Strength 1 24.113 3303.2 1179.0
## + Standing 1 21.605 3305.7 1179.7
## + Def.work.rate 2 25.856 3301.4 1180.6
## + Agility 1 17.387 3309.9 1180.8
## + Curve 1 13.175 3314.1 1181.9
## + Aggression 1 11.580 3315.7 1182.3
## + Finishing 1 8.640 3318.7 1183.1
## <none> 3327.3 1183.4
## + Preferred.foot 1 5.576 3321.7 1183.9
## + Sprint 1 4.858 3322.4 1184.1
## + Vision 1 3.816 3323.5 1184.4
## + Skill.moves 1 1.840 3325.5 1184.9
## + Long 1 1.503 3325.8 1185.0
## + Att.work.rate 2 4.458 3322.8 1186.2
##
## Step: AIC=1153.84
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position
##
## Df Sum of Sq RSS AIC
## + Ball 1 214.528 2908.5 1093.4
## + Weak.foot 1 58.895 3064.2 1139.1
## + Skill.moves 1 38.335 3084.7 1145.0
## + Standing 1 32.611 3090.4 1146.6
## + Curve 1 26.378 3096.7 1148.4
## + Strength 1 25.757 3097.3 1148.6
## + Finishing 1 22.563 3100.5 1149.5
## + Vision 1 21.064 3102.0 1149.9
## + Crossing 1 20.908 3102.1 1150.0
## + Age 1 20.884 3102.2 1150.0
## + Agility 1 12.370 3110.7 1152.4
## + Long 1 9.013 3114.0 1153.3
## + Penalties 1 8.970 3114.1 1153.3
## <none> 3123.0 1153.8
## + Def.work.rate 2 14.162 3108.9 1153.8
## + Preferred.foot 1 6.917 3116.1 1153.9
## + Sprint 1 5.118 3117.9 1154.4
## + Free 1 5.095 3117.9 1154.4
## + Att.work.rate 2 11.179 3111.9 1154.7
## + Aggression 1 0.020 3123.0 1155.8
##
## Step: AIC=1093.43
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball
##
## Df Sum of Sq RSS AIC
## + Weak.foot 1 55.608 2852.9 1078.5
## + Standing 1 42.446 2866.1 1082.5
## + Strength 1 41.678 2866.8 1082.8
## + Age 1 35.130 2873.4 1084.8
## + Agility 1 34.048 2874.5 1085.1
## + Penalties 1 27.921 2880.6 1087.0
## + Skill.moves 1 13.029 2895.5 1091.5
## + Long 1 12.880 2895.6 1091.5
## + Free 1 10.906 2897.6 1092.1
## + Curve 1 10.276 2898.2 1092.3
## + Preferred.foot 1 6.933 2901.6 1093.3
## <none> 2908.5 1093.4
## + Def.work.rate 2 12.577 2895.9 1093.6
## + Crossing 1 4.288 2904.2 1094.1
## + Aggression 1 3.527 2905.0 1094.4
## + Vision 1 2.474 2906.0 1094.7
## + Finishing 1 1.252 2907.3 1095.0
## + Sprint 1 1.028 2907.5 1095.1
## + Att.work.rate 2 6.581 2901.9 1095.4
##
## Step: AIC=1078.5
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot
##
## Df Sum of Sq RSS AIC
## + Standing 1 56.620 2796.3 1062.9
## + Strength 1 38.493 2814.4 1068.6
## + Agility 1 30.674 2822.2 1071.0
## + Penalties 1 27.353 2825.6 1072.0
## + Age 1 26.369 2826.5 1072.3
## + Free 1 15.875 2837.0 1075.6
## + Long 1 10.890 2842.0 1077.1
## + Curve 1 9.306 2843.6 1077.6
## + Def.work.rate 2 13.808 2839.1 1078.2
## <none> 2852.9 1078.5
## + Crossing 1 5.580 2847.3 1078.8
## + Skill.moves 1 5.177 2847.7 1078.9
## + Preferred.foot 1 4.993 2847.9 1079.0
## + Aggression 1 2.954 2849.9 1079.6
## + Vision 1 1.431 2851.5 1080.1
## + Sprint 1 0.969 2851.9 1080.2
## + Finishing 1 0.502 2852.4 1080.3
## + Att.work.rate 2 4.093 2848.8 1081.2
##
## Step: AIC=1062.92
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot + Standing
##
## Df Sum of Sq RSS AIC
## + Strength 1 26.0909 2770.2 1056.7
## + Agility 1 23.1953 2773.1 1057.6
## + Age 1 21.9498 2774.3 1058.0
## + Penalties 1 14.5021 2781.8 1060.4
## + Free 1 12.9162 2783.4 1060.9
## + Curve 1 10.2828 2786.0 1061.7
## + Skill.moves 1 9.4071 2786.9 1062.0
## + Preferred.foot 1 6.6386 2789.7 1062.8
## <none> 2796.3 1062.9
## + Long 1 6.0005 2790.3 1063.0
## + Crossing 1 3.5808 2792.7 1063.8
## + Sprint 1 3.5655 2792.7 1063.8
## + Finishing 1 1.9639 2794.3 1064.3
## + Vision 1 1.1756 2795.1 1064.5
## + Def.work.rate 2 7.4990 2788.8 1064.6
## + Aggression 1 0.0353 2796.2 1064.9
## + Att.work.rate 2 3.2980 2793.0 1065.9
##
## Step: AIC=1056.69
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot + Standing + Strength
##
## Df Sum of Sq RSS AIC
## + Age 1 18.8673 2751.3 1052.7
## + Agility 1 15.7712 2754.4 1053.7
## + Penalties 1 15.6295 2754.6 1053.7
## + Free 1 13.0896 2757.1 1054.5
## + Sprint 1 12.3365 2757.9 1054.8
## + Curve 1 11.9312 2758.3 1054.9
## + Skill.moves 1 9.8048 2760.4 1055.6
## + Preferred.foot 1 7.7433 2762.4 1056.2
## <none> 2770.2 1056.7
## + Crossing 1 5.3537 2764.8 1057.0
## + Long 1 4.9077 2765.3 1057.1
## + Finishing 1 2.1680 2768.0 1058.0
## + Def.work.rate 2 6.9002 2763.3 1058.5
## + Vision 1 0.5619 2769.6 1058.5
## + Aggression 1 0.2836 2769.9 1058.6
## + Att.work.rate 2 3.4970 2766.7 1059.6
##
## Step: AIC=1052.7
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot + Standing + Strength +
## Age
##
## Df Sum of Sq RSS AIC
## + Sprint 1 19.6334 2731.7 1048.4
## + Penalties 1 17.5722 2733.8 1049.1
## + Free 1 14.1708 2737.2 1050.2
## + Agility 1 12.3228 2739.0 1050.8
## + Curve 1 11.6297 2739.7 1051.0
## + Skill.moves 1 10.3966 2740.9 1051.4
## + Preferred.foot 1 7.7971 2743.5 1052.2
## <none> 2751.3 1052.7
## + Long 1 5.5146 2745.8 1052.9
## + Crossing 1 4.4702 2746.9 1053.3
## + Finishing 1 2.7287 2748.6 1053.8
## + Vision 1 0.7796 2750.6 1054.5
## + Aggression 1 0.6927 2750.6 1054.5
## + Def.work.rate 2 6.6942 2744.6 1054.6
## + Att.work.rate 2 4.9731 2746.3 1055.1
##
## Step: AIC=1048.42
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot + Standing + Strength +
## Age + Sprint
##
## Df Sum of Sq RSS AIC
## + Agility 1 21.9235 2709.8 1043.3
## + Penalties 1 16.6258 2715.1 1045.1
## + Free 1 13.2981 2718.4 1046.1
## + Curve 1 10.5607 2721.1 1047.0
## + Skill.moves 1 9.4257 2722.3 1047.4
## + Preferred.foot 1 7.5364 2724.2 1048.0
## + Long 1 6.6945 2725.0 1048.3
## <none> 2731.7 1048.4
## + Crossing 1 3.4190 2728.3 1049.3
## + Finishing 1 2.2809 2729.4 1049.7
## + Aggression 1 0.7156 2731.0 1050.2
## + Vision 1 0.6799 2731.0 1050.2
## + Def.work.rate 2 6.6624 2725.0 1050.3
## + Att.work.rate 2 4.0319 2727.7 1051.1
##
## Step: AIC=1043.35
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot + Standing + Strength +
## Age + Sprint + Agility
##
## Df Sum of Sq RSS AIC
## + Curve 1 14.4445 2695.3 1040.7
## + Penalties 1 12.2912 2697.5 1041.4
## + Skill.moves 1 12.1842 2697.6 1041.4
## + Free 1 9.4856 2700.3 1042.3
## + Long 1 8.6367 2701.1 1042.5
## + Preferred.foot 1 8.0870 2701.7 1042.7
## <none> 2709.8 1043.3
## + Crossing 1 5.2450 2704.5 1043.7
## + Finishing 1 2.9321 2706.8 1044.4
## + Vision 1 2.5081 2707.3 1044.5
## + Def.work.rate 2 7.9990 2701.8 1044.8
## + Aggression 1 0.2409 2709.5 1045.3
## + Att.work.rate 2 3.7722 2706.0 1046.1
##
## Step: AIC=1040.67
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot + Standing + Strength +
## Age + Sprint + Agility + Curve
##
## Df Sum of Sq RSS AIC
## + Free 1 24.2353 2671.1 1034.8
## + Penalties 1 14.8776 2680.4 1037.8
## + Preferred.foot 1 10.0066 2685.3 1039.4
## + Skill.moves 1 7.9311 2687.4 1040.1
## + Long 1 6.2674 2689.1 1040.6
## <none> 2695.3 1040.7
## + Finishing 1 1.8531 2693.5 1042.1
## + Vision 1 1.1036 2694.2 1042.3
## + Def.work.rate 2 6.7876 2688.5 1042.5
## + Aggression 1 0.3160 2695.0 1042.6
## + Crossing 1 0.1294 2695.2 1042.6
## + Att.work.rate 2 3.0225 2692.3 1043.7
##
## Step: AIC=1034.75
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot + Standing + Strength +
## Age + Sprint + Agility + Curve + Free
##
## Df Sum of Sq RSS AIC
## + Long 1 12.3777 2658.7 1032.7
## + Skill.moves 1 10.1346 2660.9 1033.4
## + Preferred.foot 1 7.8842 2663.2 1034.2
## + Finishing 1 6.7893 2664.3 1034.5
## <none> 2671.1 1034.8
## + Penalties 1 4.4695 2666.6 1035.3
## + Def.work.rate 2 8.2842 2662.8 1036.0
## + Vision 1 1.9408 2669.2 1036.1
## + Aggression 1 0.3117 2670.8 1036.6
## + Crossing 1 0.3013 2670.8 1036.7
## + Att.work.rate 2 3.9082 2667.2 1037.5
##
## Step: AIC=1032.67
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot + Standing + Strength +
## Age + Sprint + Agility + Curve + Free + Long
##
## Df Sum of Sq RSS AIC
## + Skill.moves 1 10.1861 2648.5 1031.3
## + Finishing 1 8.3339 2650.4 1031.9
## + Preferred.foot 1 7.0236 2651.7 1032.3
## <none> 2658.7 1032.7
## + Penalties 1 4.5545 2654.2 1033.2
## + Def.work.rate 2 8.8888 2649.8 1033.7
## + Vision 1 0.5385 2658.2 1034.5
## + Crossing 1 0.2148 2658.5 1034.6
## + Aggression 1 0.1988 2658.5 1034.6
## + Att.work.rate 2 4.0875 2654.6 1035.3
##
## Step: AIC=1031.31
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot + Standing + Strength +
## Age + Sprint + Agility + Curve + Free + Long + Skill.moves
##
## Df Sum of Sq RSS AIC
## + Preferred.foot 1 7.1862 2641.3 1030.9
## + Finishing 1 7.1353 2641.4 1030.9
## <none> 2648.5 1031.3
## + Penalties 1 5.1498 2643.4 1031.6
## + Def.work.rate 2 8.3040 2640.2 1032.5
## + Crossing 1 0.3636 2648.2 1033.2
## + Vision 1 0.2103 2648.3 1033.2
## + Aggression 1 0.0124 2648.5 1033.3
## + Att.work.rate 2 2.7360 2645.8 1034.4
##
## Step: AIC=1030.92
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot + Standing + Strength +
## Age + Sprint + Agility + Curve + Free + Long + Skill.moves +
## Preferred.foot
##
## Df Sum of Sq RSS AIC
## + Finishing 1 7.6046 2633.7 1030.4
## <none> 2641.3 1030.9
## + Penalties 1 5.4248 2635.9 1031.1
## + Def.work.rate 2 8.8388 2632.5 1032.0
## + Crossing 1 0.4674 2640.9 1032.8
## + Vision 1 0.2663 2641.1 1032.8
## + Aggression 1 0.0028 2641.3 1032.9
## + Att.work.rate 2 2.9961 2638.3 1033.9
##
## Step: AIC=1030.39
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot + Standing + Strength +
## Age + Sprint + Agility + Curve + Free + Long + Skill.moves +
## Preferred.foot + Finishing
##
## Df Sum of Sq RSS AIC
## + Penalties 1 11.8848 2621.8 1028.4
## <none> 2633.7 1030.4
## + Def.work.rate 2 7.8643 2625.9 1031.8
## + Crossing 1 0.4094 2633.3 1032.3
## + Aggression 1 0.1757 2633.6 1032.3
## + Vision 1 0.0292 2633.7 1032.4
## + Att.work.rate 2 2.8194 2630.9 1033.5
##
## Step: AIC=1028.43
## Overall ~ Reactions + Composure + Shot + Jumping + Balance +
## Stamina + Position + Ball + Weak.foot + Standing + Strength +
## Age + Sprint + Agility + Curve + Free + Long + Skill.moves +
## Preferred.foot + Finishing + Penalties
##
## Df Sum of Sq RSS AIC
## <none> 2621.8 1028.4
## + Def.work.rate 2 7.7455 2614.1 1029.8
## + Crossing 1 0.5039 2621.3 1030.3
## + Aggression 1 0.4161 2621.4 1030.3
## + Vision 1 0.0044 2621.8 1030.4
## + Att.work.rate 2 2.5155 2619.3 1031.6
extractAIC(modAIC_forward)[2]
## [1] 1028.428
AIC(modAIC_forward)
## [1] 3519.246
summary(modAIC_forward)
##
## Call:
## lm(formula = Overall ~ Reactions + Composure + Shot + Jumping +
## Balance + Stamina + Position + Ball + Weak.foot + Standing +
## Strength + Age + Sprint + Agility + Curve + Free + Long +
## Skill.moves + Preferred.foot + Finishing + Penalties, data = train)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.223 -1.050 0.026 1.123 6.166
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.723444 0.957338 5.978 3.32e-09 ***
## Reactions 0.259977 0.013847 18.776 < 2e-16 ***
## Composure 0.101857 0.011736 8.679 < 2e-16 ***
## Shot 0.156379 0.018801 8.318 3.58e-16 ***
## Jumping 0.064550 0.012629 5.111 3.97e-07 ***
## Balance 0.035175 0.006557 5.364 1.05e-07 ***
## Stamina 0.052162 0.008400 6.210 8.31e-10 ***
## PositionCB 1.379044 0.433939 3.178 0.001537 **
## PositionCDM 0.076857 0.381563 0.201 0.840413
## PositionCF 0.031965 1.283835 0.025 0.980142
## PositionCM -1.170370 0.312250 -3.748 0.000190 ***
## PositionLB 0.738758 0.422400 1.749 0.080663 .
## PositionLM 0.234936 0.394938 0.595 0.552092
## PositionLW 0.397947 0.410546 0.969 0.332668
## PositionLWB -2.688872 1.829323 -1.470 0.141969
## PositionRB 0.512767 0.408367 1.256 0.209590
## PositionRM 0.490960 0.397781 1.234 0.217455
## PositionRW 0.617897 0.374715 1.649 0.099524 .
## PositionRWB 0.215038 1.081558 0.199 0.842450
## PositionST 0.212945 0.322309 0.661 0.508995
## Ball 0.150608 0.018705 8.052 2.77e-15 ***
## Weak.foot 0.365067 0.105158 3.472 0.000544 ***
## Standing 0.022996 0.007329 3.138 0.001763 **
## Strength 0.032593 0.010421 3.128 0.001822 **
## Age 0.053444 0.017606 3.035 0.002475 **
## Sprint 0.025096 0.009007 2.786 0.005454 **
## Agility -0.022489 0.008355 -2.692 0.007253 **
## Curve 0.019503 0.007469 2.611 0.009185 **
## Free -0.022570 0.008683 -2.599 0.009501 **
## Long 0.024564 0.011684 2.102 0.035813 *
## Skill.moves 0.254800 0.145612 1.750 0.080508 .
## Preferred.footRight 0.310251 0.189673 1.636 0.102272
## Finishing 0.019655 0.009243 2.127 0.033748 *
## Penalties -0.018012 0.009214 -1.955 0.050935 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.764 on 843 degrees of freedom
## Multiple R-squared: 0.9216, Adjusted R-squared: 0.9185
## F-statistic: 300.1 on 33 and 843 DF, p-value: < 2.2e-16
#try forward and backward stepwise approach
modAIC_both <- MASS::stepAIC(mod, direction = 'both', k =2)
## Start: AIC=1038.61
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Vision + Crossing + Free + Curve + Agility +
## Balance + Reactions + Ball + Composure + Standing + Jumping +
## Stamina + Strength + Aggression + Att.work.rate + Def.work.rate +
## Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Att.work.rate 2 2.96 2613.4 1035.6
## - Vision 1 0.05 2610.5 1036.6
## - Aggression 1 0.33 2610.8 1036.7
## - Crossing 1 0.40 2610.9 1036.7
## - Def.work.rate 2 7.84 2618.3 1037.2
## <none> 2610.5 1038.6
## - Skill.moves 1 8.20 2618.7 1039.4
## - Preferred.foot 1 9.34 2619.8 1039.7
## - Penalties 1 11.66 2622.1 1040.5
## - Finishing 1 12.43 2622.9 1040.8
## - Curve 1 13.01 2623.5 1041.0
## - Long 1 14.09 2624.5 1041.3
## - Standing 1 22.68 2633.1 1044.2
## - Free 1 22.80 2633.3 1044.2
## - Sprint 1 22.97 2633.4 1044.3
## - Agility 1 23.21 2633.7 1044.4
## - Strength 1 27.89 2638.3 1045.9
## - Age 1 28.25 2638.7 1046.0
## - Weak.foot 1 36.38 2646.8 1048.7
## - Jumping 1 79.41 2689.9 1062.9
## - Balance 1 83.73 2694.2 1064.3
## - Stamina 1 109.81 2720.3 1072.7
## - Position 13 231.63 2842.1 1087.2
## - Ball 1 195.38 2805.8 1099.9
## - Shot 1 209.19 2819.6 1104.2
## - Composure 1 226.55 2837.0 1109.6
## - Reactions 1 1045.79 3656.2 1332.1
##
## Step: AIC=1035.6
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Vision + Crossing + Free + Curve + Agility +
## Balance + Reactions + Ball + Composure + Standing + Jumping +
## Stamina + Strength + Aggression + Def.work.rate + Preferred.foot +
## Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Vision 1 0.07 2613.5 1033.6
## - Aggression 1 0.30 2613.7 1033.7
## - Crossing 1 0.39 2613.8 1033.7
## - Def.work.rate 2 7.46 2620.9 1034.1
## <none> 2613.4 1035.6
## - Preferred.foot 1 9.09 2622.5 1036.7
## - Skill.moves 1 9.41 2622.8 1036.8
## - Penalties 1 11.99 2625.4 1037.6
## - Finishing 1 12.80 2626.2 1037.9
## - Curve 1 13.38 2626.8 1038.1
## - Long 1 13.99 2627.4 1038.3
## + Att.work.rate 2 2.96 2610.5 1038.6
## - Free 1 22.13 2635.5 1041.0
## - Agility 1 23.51 2636.9 1041.5
## - Standing 1 23.71 2637.1 1041.5
## - Sprint 1 24.03 2637.4 1041.6
## - Age 1 27.17 2640.6 1042.7
## - Strength 1 28.20 2641.6 1043.0
## - Weak.foot 1 37.64 2651.1 1046.1
## - Jumping 1 80.06 2693.5 1060.1
## - Balance 1 86.35 2699.8 1062.1
## - Stamina 1 115.67 2729.1 1071.6
## - Position 13 233.43 2846.8 1084.6
## - Ball 1 196.72 2810.1 1097.2
## - Shot 1 210.37 2823.8 1101.5
## - Composure 1 228.71 2842.1 1107.2
## - Reactions 1 1059.63 3673.0 1332.1
##
## Step: AIC=1033.62
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Crossing + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Aggression + Def.work.rate + Preferred.foot +
## Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Aggression 1 0.29 2613.8 1031.7
## - Crossing 1 0.34 2613.8 1031.7
## - Def.work.rate 2 7.45 2620.9 1032.1
## <none> 2613.5 1033.6
## - Preferred.foot 1 9.11 2622.6 1034.7
## - Skill.moves 1 9.34 2622.8 1034.8
## + Vision 1 0.07 2613.4 1035.6
## - Penalties 1 12.04 2625.5 1035.7
## - Finishing 1 13.04 2626.5 1036.0
## - Curve 1 13.43 2626.9 1036.1
## - Long 1 14.22 2627.7 1036.4
## + Att.work.rate 2 2.97 2610.5 1036.6
## - Free 1 22.06 2635.5 1039.0
## - Standing 1 23.73 2637.2 1039.5
## - Agility 1 24.13 2637.6 1039.7
## - Sprint 1 24.13 2637.6 1039.7
## - Age 1 27.24 2640.7 1040.7
## - Strength 1 28.17 2641.6 1041.0
## - Weak.foot 1 37.57 2651.1 1044.1
## - Jumping 1 81.48 2695.0 1058.5
## - Balance 1 87.21 2700.7 1060.4
## - Stamina 1 115.61 2729.1 1069.6
## - Position 13 252.09 2865.6 1088.4
## - Ball 1 198.04 2811.5 1095.7
## - Shot 1 210.34 2823.8 1099.5
## - Composure 1 229.84 2843.3 1105.5
## - Reactions 1 1060.33 3673.8 1330.3
##
## Step: AIC=1031.72
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Crossing + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Def.work.rate + Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Crossing 1 0.33 2614.1 1029.8
## - Def.work.rate 2 7.58 2621.3 1030.3
## <none> 2613.8 1031.7
## - Preferred.foot 1 8.93 2622.7 1032.7
## - Skill.moves 1 9.10 2622.9 1032.8
## + Aggression 1 0.29 2613.5 1033.6
## - Penalties 1 11.85 2625.6 1033.7
## + Vision 1 0.06 2613.7 1033.7
## - Finishing 1 12.75 2626.5 1034.0
## - Curve 1 13.58 2627.3 1034.3
## - Long 1 14.08 2627.8 1034.4
## + Att.work.rate 2 2.94 2610.8 1034.7
## - Free 1 21.99 2635.8 1037.1
## - Agility 1 23.87 2637.6 1037.7
## - Sprint 1 24.09 2637.9 1037.8
## - Standing 1 25.37 2639.1 1038.2
## - Age 1 27.68 2641.4 1039.0
## - Strength 1 29.50 2643.3 1039.6
## - Weak.foot 1 38.19 2652.0 1042.4
## - Jumping 1 81.19 2695.0 1056.5
## - Balance 1 86.96 2700.7 1058.4
## - Stamina 1 117.66 2731.4 1068.3
## - Position 13 255.85 2869.6 1087.6
## - Ball 1 197.86 2811.6 1093.7
## - Shot 1 213.06 2826.8 1098.4
## - Composure 1 232.32 2846.1 1104.4
## - Reactions 1 1084.03 3697.8 1334.0
##
## Step: AIC=1029.83
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Free + Curve + Agility + Balance + Reactions +
## Ball + Composure + Standing + Jumping + Stamina + Strength +
## Def.work.rate + Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Def.work.rate 2 7.75 2621.8 1028.4
## <none> 2614.1 1029.8
## - Preferred.foot 1 8.83 2622.9 1030.8
## - Skill.moves 1 8.98 2623.1 1030.8
## + Crossing 1 0.33 2613.8 1031.7
## + Aggression 1 0.29 2613.8 1031.7
## - Penalties 1 11.77 2625.9 1031.8
## + Vision 1 0.01 2614.1 1031.8
## - Finishing 1 12.77 2626.9 1032.1
## - Long 1 14.20 2628.3 1032.6
## + Att.work.rate 2 2.93 2611.2 1032.8
## - Curve 1 20.46 2634.6 1034.7
## - Free 1 21.91 2636.0 1035.2
## - Agility 1 23.73 2637.8 1035.8
## - Sprint 1 24.38 2638.5 1036.0
## - Standing 1 26.03 2640.1 1036.5
## - Age 1 28.10 2642.2 1037.2
## - Strength 1 29.24 2643.3 1037.6
## - Weak.foot 1 37.97 2652.1 1040.5
## - Jumping 1 82.00 2696.1 1054.9
## - Balance 1 86.69 2700.8 1056.4
## - Stamina 1 117.91 2732.0 1066.5
## - Position 13 260.99 2875.1 1087.3
## - Ball 1 202.35 2816.5 1093.2
## - Shot 1 214.75 2828.9 1097.1
## - Composure 1 232.08 2846.2 1102.4
## - Reactions 1 1083.70 3697.8 1332.0
##
## Step: AIC=1028.43
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Free + Curve + Agility + Balance + Reactions +
## Ball + Composure + Standing + Jumping + Stamina + Strength +
## Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## <none> 2621.8 1028.4
## - Preferred.foot 1 8.32 2630.2 1029.2
## - Skill.moves 1 9.52 2631.4 1029.6
## + Def.work.rate 2 7.75 2614.1 1029.8
## + Crossing 1 0.50 2621.3 1030.3
## + Aggression 1 0.42 2621.4 1030.3
## - Penalties 1 11.88 2633.7 1030.4
## + Vision 1 0.00 2621.8 1030.4
## - Long 1 13.75 2635.6 1031.0
## - Finishing 1 14.06 2635.9 1031.1
## + Att.work.rate 2 2.52 2619.3 1031.6
## - Free 1 21.02 2642.9 1033.4
## - Curve 1 21.20 2643.1 1033.5
## - Agility 1 22.53 2644.4 1033.9
## - Sprint 1 24.14 2646.0 1034.5
## - Age 1 28.66 2650.5 1036.0
## - Strength 1 30.43 2652.3 1036.5
## - Standing 1 30.62 2652.5 1036.6
## - Weak.foot 1 37.48 2659.3 1038.9
## - Jumping 1 81.25 2703.1 1053.2
## - Balance 1 89.50 2711.3 1055.9
## - Stamina 1 119.94 2741.8 1065.7
## - Position 13 270.64 2892.5 1088.6
## - Ball 1 201.64 2823.5 1091.4
## - Shot 1 215.18 2837.0 1095.6
## - Composure 1 234.27 2856.1 1101.5
## - Reactions 1 1096.40 3718.2 1332.8
extractAIC(modAIC_both)[2]
## [1] 1028.428
AIC(modAIC_both)
## [1] 3519.246
summary(modAIC_both)
##
## Call:
## lm(formula = Overall ~ Position + Age + Sprint + Finishing +
## Shot + Long + Penalties + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Preferred.foot + Weak.foot + Skill.moves, data = train)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.223 -1.050 0.026 1.123 6.166
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.723444 0.957338 5.978 3.32e-09 ***
## PositionCB 1.379044 0.433939 3.178 0.001537 **
## PositionCDM 0.076857 0.381563 0.201 0.840413
## PositionCF 0.031965 1.283835 0.025 0.980142
## PositionCM -1.170370 0.312250 -3.748 0.000190 ***
## PositionLB 0.738758 0.422400 1.749 0.080663 .
## PositionLM 0.234936 0.394938 0.595 0.552092
## PositionLW 0.397947 0.410546 0.969 0.332668
## PositionLWB -2.688872 1.829323 -1.470 0.141969
## PositionRB 0.512767 0.408367 1.256 0.209590
## PositionRM 0.490960 0.397781 1.234 0.217455
## PositionRW 0.617897 0.374715 1.649 0.099524 .
## PositionRWB 0.215038 1.081558 0.199 0.842450
## PositionST 0.212945 0.322309 0.661 0.508995
## Age 0.053444 0.017606 3.035 0.002475 **
## Sprint 0.025096 0.009007 2.786 0.005454 **
## Finishing 0.019655 0.009243 2.127 0.033748 *
## Shot 0.156379 0.018801 8.318 3.58e-16 ***
## Long 0.024564 0.011684 2.102 0.035813 *
## Penalties -0.018012 0.009214 -1.955 0.050935 .
## Free -0.022570 0.008683 -2.599 0.009501 **
## Curve 0.019503 0.007469 2.611 0.009185 **
## Agility -0.022489 0.008355 -2.692 0.007253 **
## Balance 0.035175 0.006557 5.364 1.05e-07 ***
## Reactions 0.259977 0.013847 18.776 < 2e-16 ***
## Ball 0.150608 0.018705 8.052 2.77e-15 ***
## Composure 0.101857 0.011736 8.679 < 2e-16 ***
## Standing 0.022996 0.007329 3.138 0.001763 **
## Jumping 0.064550 0.012629 5.111 3.97e-07 ***
## Stamina 0.052162 0.008400 6.210 8.31e-10 ***
## Strength 0.032593 0.010421 3.128 0.001822 **
## Preferred.footRight 0.310251 0.189673 1.636 0.102272
## Weak.foot 0.365067 0.105158 3.472 0.000544 ***
## Skill.moves 0.254800 0.145612 1.750 0.080508 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.764 on 843 degrees of freedom
## Multiple R-squared: 0.9216, Adjusted R-squared: 0.9185
## F-statistic: 300.1 on 33 and 843 DF, p-value: < 2.2e-16
#try forward and backward stepwise approach
modAIC_both <- MASS::stepAIC(mod, direction = 'both', k =2)
## Start: AIC=1038.61
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Vision + Crossing + Free + Curve + Agility +
## Balance + Reactions + Ball + Composure + Standing + Jumping +
## Stamina + Strength + Aggression + Att.work.rate + Def.work.rate +
## Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Att.work.rate 2 2.96 2613.4 1035.6
## - Vision 1 0.05 2610.5 1036.6
## - Aggression 1 0.33 2610.8 1036.7
## - Crossing 1 0.40 2610.9 1036.7
## - Def.work.rate 2 7.84 2618.3 1037.2
## <none> 2610.5 1038.6
## - Skill.moves 1 8.20 2618.7 1039.4
## - Preferred.foot 1 9.34 2619.8 1039.7
## - Penalties 1 11.66 2622.1 1040.5
## - Finishing 1 12.43 2622.9 1040.8
## - Curve 1 13.01 2623.5 1041.0
## - Long 1 14.09 2624.5 1041.3
## - Standing 1 22.68 2633.1 1044.2
## - Free 1 22.80 2633.3 1044.2
## - Sprint 1 22.97 2633.4 1044.3
## - Agility 1 23.21 2633.7 1044.4
## - Strength 1 27.89 2638.3 1045.9
## - Age 1 28.25 2638.7 1046.0
## - Weak.foot 1 36.38 2646.8 1048.7
## - Jumping 1 79.41 2689.9 1062.9
## - Balance 1 83.73 2694.2 1064.3
## - Stamina 1 109.81 2720.3 1072.7
## - Position 13 231.63 2842.1 1087.2
## - Ball 1 195.38 2805.8 1099.9
## - Shot 1 209.19 2819.6 1104.2
## - Composure 1 226.55 2837.0 1109.6
## - Reactions 1 1045.79 3656.2 1332.1
##
## Step: AIC=1035.6
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Vision + Crossing + Free + Curve + Agility +
## Balance + Reactions + Ball + Composure + Standing + Jumping +
## Stamina + Strength + Aggression + Def.work.rate + Preferred.foot +
## Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Vision 1 0.07 2613.5 1033.6
## - Aggression 1 0.30 2613.7 1033.7
## - Crossing 1 0.39 2613.8 1033.7
## - Def.work.rate 2 7.46 2620.9 1034.1
## <none> 2613.4 1035.6
## - Preferred.foot 1 9.09 2622.5 1036.7
## - Skill.moves 1 9.41 2622.8 1036.8
## - Penalties 1 11.99 2625.4 1037.6
## - Finishing 1 12.80 2626.2 1037.9
## - Curve 1 13.38 2626.8 1038.1
## - Long 1 13.99 2627.4 1038.3
## + Att.work.rate 2 2.96 2610.5 1038.6
## - Free 1 22.13 2635.5 1041.0
## - Agility 1 23.51 2636.9 1041.5
## - Standing 1 23.71 2637.1 1041.5
## - Sprint 1 24.03 2637.4 1041.6
## - Age 1 27.17 2640.6 1042.7
## - Strength 1 28.20 2641.6 1043.0
## - Weak.foot 1 37.64 2651.1 1046.1
## - Jumping 1 80.06 2693.5 1060.1
## - Balance 1 86.35 2699.8 1062.1
## - Stamina 1 115.67 2729.1 1071.6
## - Position 13 233.43 2846.8 1084.6
## - Ball 1 196.72 2810.1 1097.2
## - Shot 1 210.37 2823.8 1101.5
## - Composure 1 228.71 2842.1 1107.2
## - Reactions 1 1059.63 3673.0 1332.1
##
## Step: AIC=1033.62
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Crossing + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Aggression + Def.work.rate + Preferred.foot +
## Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Aggression 1 0.29 2613.8 1031.7
## - Crossing 1 0.34 2613.8 1031.7
## - Def.work.rate 2 7.45 2620.9 1032.1
## <none> 2613.5 1033.6
## - Preferred.foot 1 9.11 2622.6 1034.7
## - Skill.moves 1 9.34 2622.8 1034.8
## + Vision 1 0.07 2613.4 1035.6
## - Penalties 1 12.04 2625.5 1035.7
## - Finishing 1 13.04 2626.5 1036.0
## - Curve 1 13.43 2626.9 1036.1
## - Long 1 14.22 2627.7 1036.4
## + Att.work.rate 2 2.97 2610.5 1036.6
## - Free 1 22.06 2635.5 1039.0
## - Standing 1 23.73 2637.2 1039.5
## - Agility 1 24.13 2637.6 1039.7
## - Sprint 1 24.13 2637.6 1039.7
## - Age 1 27.24 2640.7 1040.7
## - Strength 1 28.17 2641.6 1041.0
## - Weak.foot 1 37.57 2651.1 1044.1
## - Jumping 1 81.48 2695.0 1058.5
## - Balance 1 87.21 2700.7 1060.4
## - Stamina 1 115.61 2729.1 1069.6
## - Position 13 252.09 2865.6 1088.4
## - Ball 1 198.04 2811.5 1095.7
## - Shot 1 210.34 2823.8 1099.5
## - Composure 1 229.84 2843.3 1105.5
## - Reactions 1 1060.33 3673.8 1330.3
##
## Step: AIC=1031.72
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Crossing + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Def.work.rate + Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Crossing 1 0.33 2614.1 1029.8
## - Def.work.rate 2 7.58 2621.3 1030.3
## <none> 2613.8 1031.7
## - Preferred.foot 1 8.93 2622.7 1032.7
## - Skill.moves 1 9.10 2622.9 1032.8
## + Aggression 1 0.29 2613.5 1033.6
## - Penalties 1 11.85 2625.6 1033.7
## + Vision 1 0.06 2613.7 1033.7
## - Finishing 1 12.75 2626.5 1034.0
## - Curve 1 13.58 2627.3 1034.3
## - Long 1 14.08 2627.8 1034.4
## + Att.work.rate 2 2.94 2610.8 1034.7
## - Free 1 21.99 2635.8 1037.1
## - Agility 1 23.87 2637.6 1037.7
## - Sprint 1 24.09 2637.9 1037.8
## - Standing 1 25.37 2639.1 1038.2
## - Age 1 27.68 2641.4 1039.0
## - Strength 1 29.50 2643.3 1039.6
## - Weak.foot 1 38.19 2652.0 1042.4
## - Jumping 1 81.19 2695.0 1056.5
## - Balance 1 86.96 2700.7 1058.4
## - Stamina 1 117.66 2731.4 1068.3
## - Position 13 255.85 2869.6 1087.6
## - Ball 1 197.86 2811.6 1093.7
## - Shot 1 213.06 2826.8 1098.4
## - Composure 1 232.32 2846.1 1104.4
## - Reactions 1 1084.03 3697.8 1334.0
##
## Step: AIC=1029.83
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Free + Curve + Agility + Balance + Reactions +
## Ball + Composure + Standing + Jumping + Stamina + Strength +
## Def.work.rate + Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## - Def.work.rate 2 7.75 2621.8 1028.4
## <none> 2614.1 1029.8
## - Preferred.foot 1 8.83 2622.9 1030.8
## - Skill.moves 1 8.98 2623.1 1030.8
## + Crossing 1 0.33 2613.8 1031.7
## + Aggression 1 0.29 2613.8 1031.7
## - Penalties 1 11.77 2625.9 1031.8
## + Vision 1 0.01 2614.1 1031.8
## - Finishing 1 12.77 2626.9 1032.1
## - Long 1 14.20 2628.3 1032.6
## + Att.work.rate 2 2.93 2611.2 1032.8
## - Curve 1 20.46 2634.6 1034.7
## - Free 1 21.91 2636.0 1035.2
## - Agility 1 23.73 2637.8 1035.8
## - Sprint 1 24.38 2638.5 1036.0
## - Standing 1 26.03 2640.1 1036.5
## - Age 1 28.10 2642.2 1037.2
## - Strength 1 29.24 2643.3 1037.6
## - Weak.foot 1 37.97 2652.1 1040.5
## - Jumping 1 82.00 2696.1 1054.9
## - Balance 1 86.69 2700.8 1056.4
## - Stamina 1 117.91 2732.0 1066.5
## - Position 13 260.99 2875.1 1087.3
## - Ball 1 202.35 2816.5 1093.2
## - Shot 1 214.75 2828.9 1097.1
## - Composure 1 232.08 2846.2 1102.4
## - Reactions 1 1083.70 3697.8 1332.0
##
## Step: AIC=1028.43
## Overall ~ Position + Age + Sprint + Finishing + Shot + Long +
## Penalties + Free + Curve + Agility + Balance + Reactions +
## Ball + Composure + Standing + Jumping + Stamina + Strength +
## Preferred.foot + Weak.foot + Skill.moves
##
## Df Sum of Sq RSS AIC
## <none> 2621.8 1028.4
## - Preferred.foot 1 8.32 2630.2 1029.2
## - Skill.moves 1 9.52 2631.4 1029.6
## + Def.work.rate 2 7.75 2614.1 1029.8
## + Crossing 1 0.50 2621.3 1030.3
## + Aggression 1 0.42 2621.4 1030.3
## - Penalties 1 11.88 2633.7 1030.4
## + Vision 1 0.00 2621.8 1030.4
## - Long 1 13.75 2635.6 1031.0
## - Finishing 1 14.06 2635.9 1031.1
## + Att.work.rate 2 2.52 2619.3 1031.6
## - Free 1 21.02 2642.9 1033.4
## - Curve 1 21.20 2643.1 1033.5
## - Agility 1 22.53 2644.4 1033.9
## - Sprint 1 24.14 2646.0 1034.5
## - Age 1 28.66 2650.5 1036.0
## - Strength 1 30.43 2652.3 1036.5
## - Standing 1 30.62 2652.5 1036.6
## - Weak.foot 1 37.48 2659.3 1038.9
## - Jumping 1 81.25 2703.1 1053.2
## - Balance 1 89.50 2711.3 1055.9
## - Stamina 1 119.94 2741.8 1065.7
## - Position 13 270.64 2892.5 1088.6
## - Ball 1 201.64 2823.5 1091.4
## - Shot 1 215.18 2837.0 1095.6
## - Composure 1 234.27 2856.1 1101.5
## - Reactions 1 1096.40 3718.2 1332.8
extractAIC(modAIC_both)[2]
## [1] 1028.428
AIC(modAIC_both)
## [1] 3519.246
summary(modAIC_both)
##
## Call:
## lm(formula = Overall ~ Position + Age + Sprint + Finishing +
## Shot + Long + Penalties + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Preferred.foot + Weak.foot + Skill.moves, data = train)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.223 -1.050 0.026 1.123 6.166
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.723444 0.957338 5.978 3.32e-09 ***
## PositionCB 1.379044 0.433939 3.178 0.001537 **
## PositionCDM 0.076857 0.381563 0.201 0.840413
## PositionCF 0.031965 1.283835 0.025 0.980142
## PositionCM -1.170370 0.312250 -3.748 0.000190 ***
## PositionLB 0.738758 0.422400 1.749 0.080663 .
## PositionLM 0.234936 0.394938 0.595 0.552092
## PositionLW 0.397947 0.410546 0.969 0.332668
## PositionLWB -2.688872 1.829323 -1.470 0.141969
## PositionRB 0.512767 0.408367 1.256 0.209590
## PositionRM 0.490960 0.397781 1.234 0.217455
## PositionRW 0.617897 0.374715 1.649 0.099524 .
## PositionRWB 0.215038 1.081558 0.199 0.842450
## PositionST 0.212945 0.322309 0.661 0.508995
## Age 0.053444 0.017606 3.035 0.002475 **
## Sprint 0.025096 0.009007 2.786 0.005454 **
## Finishing 0.019655 0.009243 2.127 0.033748 *
## Shot 0.156379 0.018801 8.318 3.58e-16 ***
## Long 0.024564 0.011684 2.102 0.035813 *
## Penalties -0.018012 0.009214 -1.955 0.050935 .
## Free -0.022570 0.008683 -2.599 0.009501 **
## Curve 0.019503 0.007469 2.611 0.009185 **
## Agility -0.022489 0.008355 -2.692 0.007253 **
## Balance 0.035175 0.006557 5.364 1.05e-07 ***
## Reactions 0.259977 0.013847 18.776 < 2e-16 ***
## Ball 0.150608 0.018705 8.052 2.77e-15 ***
## Composure 0.101857 0.011736 8.679 < 2e-16 ***
## Standing 0.022996 0.007329 3.138 0.001763 **
## Jumping 0.064550 0.012629 5.111 3.97e-07 ***
## Stamina 0.052162 0.008400 6.210 8.31e-10 ***
## Strength 0.032593 0.010421 3.128 0.001822 **
## Preferred.footRight 0.310251 0.189673 1.636 0.102272
## Weak.foot 0.365067 0.105158 3.472 0.000544 ***
## Skill.moves 0.254800 0.145612 1.750 0.080508 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.764 on 843 degrees of freedom
## Multiple R-squared: 0.9216, Adjusted R-squared: 0.9185
## F-statistic: 300.1 on 33 and 843 DF, p-value: < 2.2e-16
The four models we will evaluate are:
modAIC
modAIC_back
modAIC_forward
modAIC_both
# modAIC
train$predicted.overall <- predict(modAIC, train)
test$predicted.overall <- predict(modAIC, test)
#modAIC_back
train$predicted.overall_b <- predict(modAIC, train)
test$predicted.overall_b <- predict(modAIC, test)
#modAIC_forward
train$predicted.overall_f <- predict(modAIC, train)
test$predicted.overall_f <- predict(modAIC, test)
#modAIC_both
train$predicted.overall_bo <- predict(modAIC, train)
test$predicted.overall_bo <- predict(modAIC, test)
pl1 <-test %>%
ggplot(aes(Overall,predicted.overall)) +
geom_point(alpha=0.5) +
stat_smooth(aes(colour='red')) +
xlab('Actual value of Overall') +
ylab('Predicted value of Overall')+
theme_bw()
ggplotly(pl1)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
pl1 <-test %>%
ggplot(aes(Overall,predicted.overall_b)) +
geom_point(alpha=0.5) +
stat_smooth(aes(colour='red')) +
xlab('Actual value of Overall') +
ylab('Predicted value of Overall')+
theme_bw()
ggplotly(pl1)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
pl1 <-test %>%
ggplot(aes(Overall,predicted.overall_f)) +
geom_point(alpha=0.5) +
stat_smooth(aes(colour='red')) +
xlab('Actual value of Overall') +
ylab('Predicted value of Overall')+
theme_bw()
ggplotly(pl1)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
pl1 <-test %>%
ggplot(aes(Overall,predicted.overall_bo)) +
geom_point(alpha=0.5) +
stat_smooth(aes(colour='red')) +
xlab('Actual value of Overall') +
ylab('Predicted value of Overall')+
theme_bw()
ggplotly(pl1)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
AIC is used for evaluating linear models because it provides a trade-off between model goodness of fit and model complexity. It penalizes models with excessive complexity, encouraging the selection of a more parsimonious model that balances predictive accuracy and overfitting.
aic1 <- AIC(modAIC)
aic2 <- AIC(modAIC_back)
aic3 <- AIC(modAIC_forward)
aic4 <- AIC(modAIC_both)
data.frame(aic1,aic2,aic3,aic4)
## aic1 aic2 aic3 aic4
## 1 3519.246 3519.246 3519.246 3519.246
R-squared is employed in linear model evaluation as it quantifies the proportion of variance in the dependent variable explained by the independent variables. It offers a straightforward measure of model fit, indicating how well the model captures the variability in the data.
# Retrun the R-Squared for each model.
r1 <- summary(modAIC)$r.squared
r2 <-summary(modAIC_back)$r.squared
r3 <-summary(modAIC_forward)$r.squared
r4 <-summary(modAIC_both)$r.squared
data.frame(r1, r2,r3,r4)
## r1 r2 r3 r4
## 1 0.9215621 0.9215621 0.9215621 0.9215621
RMSE is utilized to evaluate linear models because it measures the average prediction error in the same units as the dependent variable. It provides a clear and interpretable way to assess the model’s accuracy in predicting the actual values, making it suitable for comparing different models or assessing predictive performance.
# Retrun the R-Squared for each model.
error1 <- test$Overall - test$predicted.overall
rmse1 <- sqrt(mean(error1^2))
error2 <- test$Overall - test$predicted.overall_b
rmse2 <- sqrt(mean(error1^2))
error3 <- test$Overall - test$predicted.overall_f
rmse3 <- sqrt(mean(error1^2))
error4 <- test$Overall - test$predicted.overall_bo
rmse4 <- sqrt(mean(error1^2))
data.frame(rmse1,rmse2,rmse3,rmse4)
## rmse1 rmse2 rmse3 rmse4
## 1 1.815687 1.815687 1.815687 1.815687
All of the models created show very similar evaluation metrics. modAIC, modAIC_back or modAIC_both could all be chosen to use as a model to predict the Overall rating for women football players in the EAFC game.
summary(modAIC)
##
## Call:
## lm(formula = Overall ~ Position + Age + Sprint + Finishing +
## Shot + Long + Penalties + Free + Curve + Agility + Balance +
## Reactions + Ball + Composure + Standing + Jumping + Stamina +
## Strength + Preferred.foot + Weak.foot + Skill.moves, data = train)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.223 -1.050 0.026 1.123 6.166
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.723444 0.957338 5.978 3.32e-09 ***
## PositionCB 1.379044 0.433939 3.178 0.001537 **
## PositionCDM 0.076857 0.381563 0.201 0.840413
## PositionCF 0.031965 1.283835 0.025 0.980142
## PositionCM -1.170370 0.312250 -3.748 0.000190 ***
## PositionLB 0.738758 0.422400 1.749 0.080663 .
## PositionLM 0.234936 0.394938 0.595 0.552092
## PositionLW 0.397947 0.410546 0.969 0.332668
## PositionLWB -2.688872 1.829323 -1.470 0.141969
## PositionRB 0.512767 0.408367 1.256 0.209590
## PositionRM 0.490960 0.397781 1.234 0.217455
## PositionRW 0.617897 0.374715 1.649 0.099524 .
## PositionRWB 0.215038 1.081558 0.199 0.842450
## PositionST 0.212945 0.322309 0.661 0.508995
## Age 0.053444 0.017606 3.035 0.002475 **
## Sprint 0.025096 0.009007 2.786 0.005454 **
## Finishing 0.019655 0.009243 2.127 0.033748 *
## Shot 0.156379 0.018801 8.318 3.58e-16 ***
## Long 0.024564 0.011684 2.102 0.035813 *
## Penalties -0.018012 0.009214 -1.955 0.050935 .
## Free -0.022570 0.008683 -2.599 0.009501 **
## Curve 0.019503 0.007469 2.611 0.009185 **
## Agility -0.022489 0.008355 -2.692 0.007253 **
## Balance 0.035175 0.006557 5.364 1.05e-07 ***
## Reactions 0.259977 0.013847 18.776 < 2e-16 ***
## Ball 0.150608 0.018705 8.052 2.77e-15 ***
## Composure 0.101857 0.011736 8.679 < 2e-16 ***
## Standing 0.022996 0.007329 3.138 0.001763 **
## Jumping 0.064550 0.012629 5.111 3.97e-07 ***
## Stamina 0.052162 0.008400 6.210 8.31e-10 ***
## Strength 0.032593 0.010421 3.128 0.001822 **
## Preferred.footRight 0.310251 0.189673 1.636 0.102272
## Weak.foot 0.365067 0.105158 3.472 0.000544 ***
## Skill.moves 0.254800 0.145612 1.750 0.080508 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.764 on 843 degrees of freedom
## Multiple R-squared: 0.9216, Adjusted R-squared: 0.9185
## F-statistic: 300.1 on 33 and 843 DF, p-value: < 2.2e-16
We can plot the model to see whether it passes the four assumptions of Linear Models.
The model a reasonable job meeting the four assumption as seen in the plots below.
plot(modAIC)
## Warning: not plotting observations with leverage one:
## 823