Skip to content
Snippets Groups Projects
Commit 0009951e authored by Mario Garrido Tapias's avatar Mario Garrido Tapias
Browse files

Zero inflated analysis

parent 1b03206c
No related branches found
No related tags found
No related merge requests found
......@@ -348,21 +348,12 @@ playersR.1819 <- playersR.1819 %>% select(all_of(c("player", "squad.1819", varia
# 4, 8, 13, 66, 72, 84, 109
jugadoresRepes <- laLigaPlayers[rowsPIn2C[-c(1:4, 6:8),], ]
laLigaPlayerSplit <- laLigaPlayers[-rowsPIn2C[-c(1:4, 6:8),], ]
if (quitarPorteros == 1){
laLigaPlayerSplit <- laLigaPlayerSplit[laLigaPlayerSplit$position.1718 != "GK", ]
}
laLigaPlayers <- laLigaPlayers[-c(4, 8, 13, 66, 72, 109), ]
############################# ####################
# CONJUNTO de ENTRENAMIENTO # # CONJUNTO de TEST #
############################# ####################
set.seed(5682)
library(rsample)
laLiga_split <- initial_split(laLigaPlayerSplit, prop = 8/10, strata = "position.1920")
train <- training(laLiga_split)
train <- rbind(train, jugadoresRepes)
test <- testing(laLiga_split)
plotFor3SeasonsForPos(laLigaPlayers, "position")
plotFor3SeasonsForPos(train, "position")
plotFor3SeasonsForPos(test, "position")
# Tamaño: 1024x768
############################################################################
......@@ -410,10 +401,6 @@ for (variable in variables) {
}
variablesWithSeason <- c(paste(variables, "1718", sep = ""), paste(variables, "1819", sep = ""), paste(variables, "1920", sep = ""))
if (quitarPorteros == 1){
laLigaPlayers <- laLigaPlayers[laLigaPlayers$position.1718 != "GK", ]
}
laLigaPlayersStudyAux <- laLigaPlayers %>% select(all_of(c("player", variablesWithSeason)))
laLigaPlayersStudy <- NULL
......@@ -430,12 +417,15 @@ namePlayers <- laLigaPlayers %>% select(all_of(c("player")))
#laLigaPlayersStudy <- cbind(laLigaPlayers %>% select(all_of(c("player"))), laLigaPlayersStudy)
#names(laLigaPlayersStudy) <- c("player", globalColNames)
rownames(laLigaPlayersStudy) <- namePlayers$player
rownames(laLigaPlayersStudy) <- c(namePlayers$player)
laLigaPlayersStudy <- data.frame(laLigaPlayersStudy)
names(laLigaPlayersStudy) <- globalColNames
laLigaPlayersStudy$age <- laLigaPlayers$age.1920
laLigaPlayersStudy$height <- laLigaPlayers$height.1920
names(laLigaPlayersStudy)
# Zero inflated
laLigaPlayersStudy %>% apply(2, function(x) sum(x == 0))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment