Librerias correspondientes
library(ggplot2)
library(VIM)
## Loading required package: colorspace
## Loading required package: grid
## Loading required package: data.table
## VIM is ready to use.
## Since version 4.0.0 the GUI is in its own package VIMGUI.
##
## Please use the package to use the new (and old) GUI.
## Suggestions and bug-reports can be submitted at: https://github.com/alexkowa/VIM/issues
##
## Attaching package: 'VIM'
## The following object is masked from 'package:datasets':
##
## sleep
library(Amelia)
## Loading required package: Rcpp
## ##
## ## Amelia II: Multiple Imputation
## ## (Version 1.7.5, built: 2018-05-07)
## ## Copyright (C) 2005-2019 James Honaker, Gary King and Matthew Blackwell
## ## Refer to http://gking.harvard.edu/amelia/ for more information
## ##
library(DMwR)
## Loading required package: lattice
##
## Attaching package: 'DMwR'
## The following object is masked from 'package:VIM':
##
## kNN
library(rpart)
library(caret)
library(rpart.plot)
library(nnet)
a) COMPRESIÓN DE LOS DATOS
Cargamos la Data
juegosOlimpicos<-read.csv("C:/Users/user/Documents/DataMining/DATA/dataMineria.csv",sep=";")
Describimos las variables
names(juegosOlimpicos)
## [1] "id" "name" "nationality" "sex" "dob"
## [6] "height" "weight" "sport" "gold" "silver"
## [11] "bronze"
id = Identificador de los jugadores
name = Nombre del jugador
nationality = Nacionalidad del jugador
sex = Sexo del jugador
dob = Fecha de nacimiento
height = Altura
weight = Peso
sport = Deporte
gol,silver,bronze = Medallas
b)Exploración de los datos
Vemos un rápido vistaso a los datos
head(juegosOlimpicos)
## id name nationality sex dob height weight
## 1 736041664 A Jesus Garcia ESP male 17/10/1969 1.72 64
## 2 532037425 A Lam Shin KOR female 23/09/1986 1.68 56
## 3 435962603 Aaron Brown CAN male 27/05/1992 1.98 79
## 4 521041435 Aaron Cook MDA male 2/01/1991 1.83 80
## 5 33922579 Aaron Gate NZL male 26/11/1990 1.81 71
## 6 173071782 Aaron Royle AUS male 26/01/1990 1.80 67
## sport gold silver bronze
## 1 athletics 0 0 0
## 2 fencing 0 0 0
## 3 athletics 0 0 1
## 4 taekwondo 0 0 0
## 5 cycling 0 0 0
## 6 triathlon 0 0 0
Resumen de los datos
summary(juegosOlimpicos)
## id name nationality sex
## 10/03/5386: 1 Ahmed Mohamed : 2 USA : 567 female:5205
## 10/07/2667: 1 Ben Saxton : 2 BRA : 485 male :6333
## 10/08/3714: 1 Carli Lloyd : 2 GER : 441
## 100107881 : 1 Daniel Vargas : 2 AUS : 431
## 100145266 : 1 David Graf : 2 FRA : 410
## 100190722 : 1 Felipe Aguilar: 2 CHN : 404
## (Other) :11532 (Other) :11526 (Other):8800
## dob height weight sport
## 18/02/1993: 9 Min. :1.210 Min. : 31.00 athletics:2363
## 20/12/1990: 9 1st Qu.:1.690 1st Qu.: 60.00 aquatics :1445
## 5/03/1988 : 9 Median :1.760 Median : 70.00 football : 611
## 1/03/1989 : 8 Mean :1.766 Mean : 72.07 rowing : 547
## 14/12/1989: 8 3rd Qu.:1.840 3rd Qu.: 81.00 cycling : 525
## 19/06/1991: 8 Max. :2.210 Max. :170.00 hockey : 432
## (Other) :11487 NA's :330 NA's :659 (Other) :5615
## gold silver bronze
## Min. :0.00000 Min. :0.00000 Min. :0.00000
## 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000
## Median :0.00000 Median :0.00000 Median :0.00000
## Mean :0.05772 Mean :0.05677 Mean :0.06102
## 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000
## Max. :5.00000 Max. :2.00000 Max. :2.00000
##
Esctructura de los datos
str(juegosOlimpicos)
## 'data.frame': 11538 obs. of 11 variables:
## $ id : Factor w/ 11538 levels "10/03/5386","10/07/2667",..: 8119 5528 4298 5384 3100 983 2160 3624 9942 11509 ...
## $ name : Factor w/ 11517 levels "A Jesus Garcia",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ nationality: Factor w/ 207 levels "AFG","ALB","ALG",..: 60 103 34 120 142 11 199 11 60 62 ...
## $ sex : Factor w/ 2 levels "female","male": 2 1 2 2 2 2 2 2 1 1 ...
## $ dob : Factor w/ 5595 levels "1/01/1969","1/01/1973",..: 1602 2893 3574 2028 3486 3334 4584 3280 1093 2687 ...
## $ height : num 1.72 1.68 1.98 1.83 1.81 1.8 2.05 1.93 1.8 1.65 ...
## $ weight : int 64 56 79 80 71 67 98 100 62 54 ...
## $ sport : Factor w/ 28 levels "aquatics","archery",..: 3 10 3 23 8 25 26 1 3 3 ...
## $ gold : int 0 0 0 0 0 0 0 0 0 0 ...
## $ silver : int 0 0 0 0 0 0 0 0 0 0 ...
## $ bronze : int 0 0 1 0 0 0 1 0 0 0 ...
Este gráfico de barras nos da una referencia a la cantidad de deportistas según su género
target<-table(juegosOlimpicos$sex)
barplot(target)

Observamos que el 55% de jugadores son hombres y 45% mujeres.
table(juegosOlimpicos$sex)
##
## female male
## 5205 6333
ggplot(data=juegosOlimpicos)+
geom_bar(mapping=aes(x=gold, color=sex))

ggplot(data=juegosOlimpicos)+
geom_bar(mapping=aes(x=silver, color=sex))

ggplot(data=juegosOlimpicos)+
geom_bar(mapping=aes(x=bronze, color=sex))

c)Verificación de calidad de datos
str(juegosOlimpicos)
## 'data.frame': 11538 obs. of 11 variables:
## $ id : Factor w/ 11538 levels "10/03/5386","10/07/2667",..: 8119 5528 4298 5384 3100 983 2160 3624 9942 11509 ...
## $ name : Factor w/ 11517 levels "A Jesus Garcia",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ nationality: Factor w/ 207 levels "AFG","ALB","ALG",..: 60 103 34 120 142 11 199 11 60 62 ...
## $ sex : Factor w/ 2 levels "female","male": 2 1 2 2 2 2 2 2 1 1 ...
## $ dob : Factor w/ 5595 levels "1/01/1969","1/01/1973",..: 1602 2893 3574 2028 3486 3334 4584 3280 1093 2687 ...
## $ height : num 1.72 1.68 1.98 1.83 1.81 1.8 2.05 1.93 1.8 1.65 ...
## $ weight : int 64 56 79 80 71 67 98 100 62 54 ...
## $ sport : Factor w/ 28 levels "aquatics","archery",..: 3 10 3 23 8 25 26 1 3 3 ...
## $ gold : int 0 0 0 0 0 0 0 0 0 0 ...
## $ silver : int 0 0 0 0 0 0 0 0 0 0 ...
## $ bronze : int 0 0 1 0 0 0 1 0 0 0 ...
Segun las variables que se muestran, podemos observar que la $dbo no nos sirviria asi como el $id
Observamos que hay valores NA’s
summary(juegosOlimpicos)
## id name nationality sex
## 10/03/5386: 1 Ahmed Mohamed : 2 USA : 567 female:5205
## 10/07/2667: 1 Ben Saxton : 2 BRA : 485 male :6333
## 10/08/3714: 1 Carli Lloyd : 2 GER : 441
## 100107881 : 1 Daniel Vargas : 2 AUS : 431
## 100145266 : 1 David Graf : 2 FRA : 410
## 100190722 : 1 Felipe Aguilar: 2 CHN : 404
## (Other) :11532 (Other) :11526 (Other):8800
## dob height weight sport
## 18/02/1993: 9 Min. :1.210 Min. : 31.00 athletics:2363
## 20/12/1990: 9 1st Qu.:1.690 1st Qu.: 60.00 aquatics :1445
## 5/03/1988 : 9 Median :1.760 Median : 70.00 football : 611
## 1/03/1989 : 8 Mean :1.766 Mean : 72.07 rowing : 547
## 14/12/1989: 8 3rd Qu.:1.840 3rd Qu.: 81.00 cycling : 525
## 19/06/1991: 8 Max. :2.210 Max. :170.00 hockey : 432
## (Other) :11487 NA's :330 NA's :659 (Other) :5615
## gold silver bronze
## Min. :0.00000 Min. :0.00000 Min. :0.00000
## 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000
## Median :0.00000 Median :0.00000 Median :0.00000
## Mean :0.05772 Mean :0.05677 Mean :0.06102
## 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000
## Max. :5.00000 Max. :2.00000 Max. :2.00000
##
Vemos el gráfico de missin
missingraf=aggr(juegosOlimpicos,numbers=T)

Mapa de perdida
missmap(juegosOlimpicos)

Valores fuera de rango
boxplot(juegosOlimpicos$height,col="skyblue",main="Diagrama de Caja (Altura)")

boxplot(juegosOlimpicos$weight,col="skyblue",main="Diagrama de Caja (Peso)")

III. Preparación de datos
a) Selección de datos
str(juegosOlimpicos)
## 'data.frame': 11538 obs. of 11 variables:
## $ id : Factor w/ 11538 levels "10/03/5386","10/07/2667",..: 8119 5528 4298 5384 3100 983 2160 3624 9942 11509 ...
## $ name : Factor w/ 11517 levels "A Jesus Garcia",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ nationality: Factor w/ 207 levels "AFG","ALB","ALG",..: 60 103 34 120 142 11 199 11 60 62 ...
## $ sex : Factor w/ 2 levels "female","male": 2 1 2 2 2 2 2 2 1 1 ...
## $ dob : Factor w/ 5595 levels "1/01/1969","1/01/1973",..: 1602 2893 3574 2028 3486 3334 4584 3280 1093 2687 ...
## $ height : num 1.72 1.68 1.98 1.83 1.81 1.8 2.05 1.93 1.8 1.65 ...
## $ weight : int 64 56 79 80 71 67 98 100 62 54 ...
## $ sport : Factor w/ 28 levels "aquatics","archery",..: 3 10 3 23 8 25 26 1 3 3 ...
## $ gold : int 0 0 0 0 0 0 0 0 0 0 ...
## $ silver : int 0 0 0 0 0 0 0 0 0 0 ...
## $ bronze : int 0 0 1 0 0 0 1 0 0 0 ...
En nuestro caso no nos ayudaria con nuestro modelo de predicción las variables $id, $name, $dob
Redifinimos las variables a utilizar
juegosOlimpicos<-juegosOlimpicos[,3:11]
juegosOlimpicos$dob<-NULL
juegosOlimpicos$silver<-NULL
juegosOlimpicos$bronze<-NULL
b) Limpieza de datos
K-Vecinos más cercanos
juegosOlimpicos2<-knnImputation(juegosOlimpicos)
summary(juegosOlimpicos2)
## nationality sex height weight
## USA : 567 female:5205 Min. :1.210 Min. : 31.00
## BRA : 485 male :6333 1st Qu.:1.690 1st Qu.: 60.00
## GER : 441 Median :1.760 Median : 70.00
## AUS : 431 Mean :1.766 Mean : 72.06
## FRA : 410 3rd Qu.:1.840 3rd Qu.: 80.62
## CHN : 404 Max. :2.210 Max. :170.00
## (Other):8800
## sport gold
## athletics:2363 Min. :0.00000
## aquatics :1445 1st Qu.:0.00000
## football : 611 Median :0.00000
## rowing : 547 Mean :0.05772
## cycling : 525 3rd Qu.:0.00000
## hockey : 432 Max. :5.00000
## (Other) :5615
Observamos que ya no hay datos NA’s
b) Construcción de nuevos datos
d) Integración de datos
IV. Modelamiento
a) Descripción de técnicas de modelado
Utilizaremos árbol de decisión
b) Generación de un diseño de comprobación (train y test)
Asignaremos un 70% para la data de entrenamiento y el 30% para las pruebas.
muestra<-sample(8076,3462)
train<-juegosOlimpicos2[-muestra,]
test<-juegosOlimpicos2[muestra,]
Dimensiones del train y test
dim(train)
## [1] 8076 6
dim(test)
## [1] 3462 6
modeloArbol<-rpart(sex~.,data =train,method = "class", cp=.0001)
modeloArbol
## n= 8076
##
## node), split, n, loss, yval, (yprob)
## * denotes terminal node
##
## 1) root 8076 3633 2 (0.44985141 0.55014859)
## 2) weight< 68.44921 3733 929 1 (0.75113849 0.24886151)
## 4) weight< 59.60603 1795 214 1 (0.88077994 0.11922006)
## 8) height< 1.745 1678 166 1 (0.90107271 0.09892729)
## 16) sport< 26.5 1584 136 1 (0.91414141 0.08585859)
## 32) height< 1.709 1399 98 1 (0.92994996 0.07005004)
## 64) weight< 51.5 436 9 1 (0.97935780 0.02064220) *
## 65) weight>=51.5 963 89 1 (0.90758048 0.09241952)
## 130) sport>=13.5 256 9 1 (0.96484375 0.03515625) *
## 131) sport< 13.5 707 80 1 (0.88684583 0.11315417)
## 262) sport< 12.5 657 63 1 (0.90410959 0.09589041)
## 524) sport>=9.5 99 0 1 (1.00000000 0.00000000) *
## 525) sport< 9.5 558 63 1 (0.88709677 0.11290323)
## 1050) nationality< 199.5 546 58 1 (0.89377289 0.10622711)
## 2100) nationality>=167 75 2 1 (0.97333333 0.02666667) *
## 2101) nationality< 167 471 56 1 (0.88110403 0.11889597)
## 4202) nationality< 90.5 299 25 1 (0.91638796 0.08361204) *
## 4203) nationality>=90.5 172 31 1 (0.81976744 0.18023256)
## 8406) sport< 2.5 47 3 1 (0.93617021 0.06382979) *
## 8407) sport>=2.5 125 28 1 (0.77600000 0.22400000)
## 16814) nationality>=100.5 86 14 1 (0.83720930 0.16279070) *
## 16815) nationality< 100.5 39 14 1 (0.64102564 0.35897436)
## 33630) height< 1.63 14 0 1 (1.00000000 0.00000000) *
## 33631) height>=1.63 25 11 2 (0.44000000 0.56000000)
## 67262) weight>=57.5 8 2 1 (0.75000000 0.25000000) *
## 67263) weight< 57.5 17 5 2 (0.29411765 0.70588235) *
## 1051) nationality>=199.5 12 5 1 (0.58333333 0.41666667) *
## 263) sport>=12.5 50 17 1 (0.66000000 0.34000000)
## 526) weight< 56.5 37 9 1 (0.75675676 0.24324324)
## 1052) height>=1.64 12 0 1 (1.00000000 0.00000000) *
## 1053) height< 1.64 25 9 1 (0.64000000 0.36000000)
## 2106) height< 1.59 11 1 1 (0.90909091 0.09090909) *
## 2107) height>=1.59 14 6 2 (0.42857143 0.57142857) *
## 527) weight>=56.5 13 5 2 (0.38461538 0.61538462) *
## 33) height>=1.709 185 38 1 (0.79459459 0.20540541)
## 66) sport>=3.5 83 6 1 (0.92771084 0.07228916) *
## 67) sport< 3.5 102 32 1 (0.68627451 0.31372549)
## 134) sport< 2.5 22 2 1 (0.90909091 0.09090909) *
## 135) sport>=2.5 80 30 1 (0.62500000 0.37500000)
## 270) weight< 53.5 16 3 1 (0.81250000 0.18750000) *
## 271) weight>=53.5 64 27 1 (0.57812500 0.42187500)
## 542) nationality>=151.5 17 4 1 (0.76470588 0.23529412) *
## 543) nationality< 151.5 47 23 1 (0.51063830 0.48936170)
## 1086) nationality< 97 35 13 1 (0.62857143 0.37142857)
## 2172) weight>=58.5 8 1 1 (0.87500000 0.12500000) *
## 2173) weight< 58.5 27 12 1 (0.55555556 0.44444444)
## 4346) height>=1.725 11 3 1 (0.72727273 0.27272727) *
## 4347) height< 1.725 16 7 2 (0.43750000 0.56250000) *
## 1087) nationality>=97 12 2 2 (0.16666667 0.83333333) *
## 17) sport>=26.5 94 30 1 (0.68085106 0.31914894)
## 34) weight< 55.5 43 1 1 (0.97674419 0.02325581) *
## 35) weight>=55.5 51 22 2 (0.43137255 0.56862745)
## 70) weight>=56.5 35 15 1 (0.57142857 0.42857143)
## 140) sport< 27.5 11 0 1 (1.00000000 0.00000000) *
## 141) sport>=27.5 24 9 2 (0.37500000 0.62500000)
## 282) weight< 58.5 17 8 1 (0.52941176 0.47058824) *
## 283) weight>=58.5 7 0 2 (0.00000000 1.00000000) *
## 71) weight< 56.5 16 2 2 (0.12500000 0.87500000) *
## 9) height>=1.745 117 48 1 (0.58974359 0.41025641)
## 18) height< 1.795 91 32 1 (0.64835165 0.35164835)
## 36) sport>=8.5 33 6 1 (0.81818182 0.18181818) *
## 37) sport< 8.5 58 26 1 (0.55172414 0.44827586)
## 74) nationality>=106.5 28 8 1 (0.71428571 0.28571429)
## 148) height>=1.755 19 2 1 (0.89473684 0.10526316) *
## 149) height< 1.755 9 3 2 (0.33333333 0.66666667) *
## 75) nationality< 106.5 30 12 2 (0.40000000 0.60000000)
## 150) nationality< 87.5 22 11 1 (0.50000000 0.50000000)
## 300) nationality>=63.5 7 2 1 (0.71428571 0.28571429) *
## 301) nationality< 63.5 15 6 2 (0.40000000 0.60000000) *
## 151) nationality>=87.5 8 1 2 (0.12500000 0.87500000) *
## 19) height>=1.795 26 10 2 (0.38461538 0.61538462)
## 38) sport< 5.5 14 6 1 (0.57142857 0.42857143) *
## 39) sport>=5.5 12 2 2 (0.16666667 0.83333333) *
## 5) weight>=59.60603 1938 715 1 (0.63106295 0.36893705)
## 10) sport< 2.5 287 48 1 (0.83275261 0.16724739)
## 20) weight< 67.95 256 33 1 (0.87109375 0.12890625) *
## 21) weight>=67.95 31 15 1 (0.51612903 0.48387097)
## 42) height>=1.755 18 5 1 (0.72222222 0.27777778) *
## 43) height< 1.755 13 3 2 (0.23076923 0.76923077) *
## 11) sport>=2.5 1651 667 1 (0.59600242 0.40399758)
## 22) sport>=13.5 675 200 1 (0.70370370 0.29629630)
## 44) sport< 15.5 119 8 1 (0.93277311 0.06722689)
## 88) nationality>=93.5 55 0 1 (1.00000000 0.00000000) *
## 89) nationality< 93.5 64 8 1 (0.87500000 0.12500000)
## 178) nationality< 79.5 57 3 1 (0.94736842 0.05263158) *
## 179) nationality>=79.5 7 2 2 (0.28571429 0.71428571) *
## 45) sport>=15.5 556 192 1 (0.65467626 0.34532374)
## 90) sport>=16.5 499 150 1 (0.69939880 0.30060120)
## 180) sport< 26.5 417 105 1 (0.74820144 0.25179856)
## 360) height< 1.695 122 13 1 (0.89344262 0.10655738) *
## 361) height>=1.695 295 92 1 (0.68813559 0.31186441)
## 722) sport>=25.5 43 1 1 (0.97674419 0.02325581) *
## 723) sport< 25.5 252 91 1 (0.63888889 0.36111111)
## 1446) sport< 20.5 105 22 1 (0.79047619 0.20952381)
## 2892) weight< 62.5 20 0 1 (1.00000000 0.00000000) *
## 2893) weight>=62.5 85 22 1 (0.74117647 0.25882353)
## 5786) sport>=17.5 76 16 1 (0.78947368 0.21052632)
## 11572) sport< 19.5 27 1 1 (0.96296296 0.03703704) *
## 11573) sport>=19.5 49 15 1 (0.69387755 0.30612245)
## 23146) weight>=65.5 30 5 1 (0.83333333 0.16666667) *
## 23147) weight< 65.5 19 9 2 (0.47368421 0.52631579) *
## 5787) sport< 17.5 9 3 2 (0.33333333 0.66666667) *
## 1447) sport>=20.5 147 69 1 (0.53061224 0.46938776)
## 2894) sport>=22.5 87 31 1 (0.64367816 0.35632184)
## 5788) sport< 24.5 66 15 1 (0.77272727 0.22727273)
## 11576) sport>=23.5 36 2 1 (0.94444444 0.05555556) *
## 11577) sport< 23.5 30 13 1 (0.56666667 0.43333333)
## 23154) height< 1.775 18 5 1 (0.72222222 0.27777778) *
## 23155) height>=1.775 12 4 2 (0.33333333 0.66666667) *
## 5789) sport>=24.5 21 5 2 (0.23809524 0.76190476)
## 11578) height< 1.745 7 3 1 (0.57142857 0.42857143) *
## 11579) height>=1.745 14 1 2 (0.07142857 0.92857143) *
## 2895) sport< 22.5 60 22 2 (0.36666667 0.63333333)
## 5790) weight< 67.5 50 22 2 (0.44000000 0.56000000)
## 11580) height< 1.755 33 15 1 (0.54545455 0.45454545)
## 23160) height>=1.705 24 8 1 (0.66666667 0.33333333)
## 46320) nationality< 128 15 3 1 (0.80000000 0.20000000) *
## 46321) nationality>=128 9 4 2 (0.44444444 0.55555556) *
## 23161) height< 1.705 9 2 2 (0.22222222 0.77777778) *
## 11581) height>=1.755 17 4 2 (0.23529412 0.76470588) *
## 5791) weight>=67.5 10 0 2 (0.00000000 1.00000000) *
## 181) sport>=26.5 82 37 2 (0.45121951 0.54878049)
## 362) height< 1.645 43 18 1 (0.58139535 0.41860465)
## 724) weight>=62.5 22 4 1 (0.81818182 0.18181818) *
## 725) weight< 62.5 21 7 2 (0.33333333 0.66666667) *
## 363) height>=1.645 39 12 2 (0.30769231 0.69230769)
## 726) weight< 64 10 3 1 (0.70000000 0.30000000) *
## 727) weight>=64 29 5 2 (0.17241379 0.82758621) *
## 91) sport< 16.5 57 15 2 (0.26315789 0.73684211)
## 182) weight>=60.5 36 14 2 (0.38888889 0.61111111)
## 364) weight< 63.5 14 2 1 (0.85714286 0.14285714) *
## 365) weight>=63.5 22 2 2 (0.09090909 0.90909091) *
## 183) weight< 60.5 21 1 2 (0.04761905 0.95238095) *
## 23) sport< 13.5 976 467 1 (0.52151639 0.47848361)
## 46) height< 1.766708 736 304 1 (0.58695652 0.41304348)
## 92) sport< 12.5 692 263 1 (0.61994220 0.38005780)
## 184) nationality>=7.5 671 244 1 (0.63636364 0.36363636)
## 368) weight< 66.06178 562 182 1 (0.67615658 0.32384342)
## 736) sport>=9.5 128 20 1 (0.84375000 0.15625000)
## 1472) nationality< 50.5 41 2 1 (0.95121951 0.04878049) *
## 1473) nationality>=50.5 87 18 1 (0.79310345 0.20689655)
## 2946) nationality>=159.5 34 3 1 (0.91176471 0.08823529) *
## 2947) nationality< 159.5 53 15 1 (0.71698113 0.28301887)
## 5894) sport< 10.5 12 1 1 (0.91666667 0.08333333) *
## 5895) sport>=10.5 41 14 1 (0.65853659 0.34146341)
## 11790) nationality< 89.5 15 2 1 (0.86666667 0.13333333) *
## 11791) nationality>=89.5 26 12 1 (0.53846154 0.46153846)
## 23582) nationality>=131 17 5 1 (0.70588235 0.29411765) *
## 23583) nationality< 131 9 2 2 (0.22222222 0.77777778) *
## 737) sport< 9.5 434 162 1 (0.62672811 0.37327189)
## 1474) nationality>=161.5 89 15 1 (0.83146067 0.16853933)
## 2948) nationality< 199.5 81 10 1 (0.87654321 0.12345679) *
## 2949) nationality>=199.5 8 3 2 (0.37500000 0.62500000) *
## 1475) nationality< 161.5 345 147 1 (0.57391304 0.42608696)
## 2950) sport>=3.5 168 57 1 (0.66071429 0.33928571)
## 5900) sport< 5.5 35 3 1 (0.91428571 0.08571429) *
## 5901) sport>=5.5 133 54 1 (0.59398496 0.40601504)
## 11802) sport>=6.5 106 34 1 (0.67924528 0.32075472)
## 23604) height< 1.685 39 5 1 (0.87179487 0.12820513) *
## 23605) height>=1.685 67 29 1 (0.56716418 0.43283582)
## 47210) nationality< 86.5 45 15 1 (0.66666667 0.33333333)
## 94420) nationality>=67 12 2 1 (0.83333333 0.16666667) *
## 94421) nationality< 67 33 13 1 (0.60606061 0.39393939)
## 188842) nationality< 57 25 8 1 (0.68000000 0.32000000) *
## 188843) nationality>=57 8 3 2 (0.37500000 0.62500000) *
## 47211) nationality>=86.5 22 8 2 (0.36363636 0.63636364)
## 94422) nationality>=126.5 12 4 1 (0.66666667 0.33333333) *
## 94423) nationality< 126.5 10 0 2 (0.00000000 1.00000000) *
## 11803) sport< 6.5 27 7 2 (0.25925926 0.74074074) *
## 2951) sport< 3.5 177 87 2 (0.49152542 0.50847458)
## 5902) height< 1.73 101 45 1 (0.55445545 0.44554455)
## 11804) nationality>=129.5 17 4 1 (0.76470588 0.23529412) *
## 11805) nationality< 129.5 84 41 1 (0.51190476 0.48809524)
## 23610) nationality< 99.5 73 33 1 (0.54794521 0.45205479)
## 47220) nationality>=62.5 22 6 1 (0.72727273 0.27272727) *
## 47221) nationality< 62.5 51 24 2 (0.47058824 0.52941176)
## 94442) nationality< 51.5 37 15 1 (0.59459459 0.40540541)
## 188884) weight>=62.5 16 4 1 (0.75000000 0.25000000) *
## 188885) weight< 62.5 21 10 2 (0.47619048 0.52380952)
## 377770) nationality< 27.5 11 3 1 (0.72727273 0.27272727) *
## 377771) nationality>=27.5 10 2 2 (0.20000000 0.80000000) *
## 94443) nationality>=51.5 14 2 2 (0.14285714 0.85714286) *
## 23611) nationality>=99.5 11 3 2 (0.27272727 0.72727273) *
## 5903) height>=1.73 76 31 2 (0.40789474 0.59210526)
## 11806) nationality>=91.5 27 12 1 (0.55555556 0.44444444)
## 23612) nationality< 140 20 6 1 (0.70000000 0.30000000) *
## 23613) nationality>=140 7 1 2 (0.14285714 0.85714286) *
## 11807) nationality< 91.5 49 16 2 (0.32653061 0.67346939)
## 23614) weight>=62.65 28 12 2 (0.42857143 0.57142857)
## 47228) weight< 65.05 20 9 1 (0.55000000 0.45000000)
## 94456) weight< 63.75 7 2 1 (0.71428571 0.28571429) *
## 94457) weight>=63.75 13 6 2 (0.46153846 0.53846154) *
## 47229) weight>=65.05 8 1 2 (0.12500000 0.87500000) *
## 23615) weight< 62.65 21 4 2 (0.19047619 0.80952381) *
## 369) weight>=66.06178 109 47 2 (0.43119266 0.56880734)
## 738) nationality< 54 28 8 1 (0.71428571 0.28571429) *
## 739) nationality>=54 81 27 2 (0.33333333 0.66666667)
## 1478) sport< 5 23 11 1 (0.52173913 0.47826087)
## 2956) nationality>=130.5 7 2 1 (0.71428571 0.28571429) *
## 2957) nationality< 130.5 16 7 2 (0.43750000 0.56250000) *
## 1479) sport>=5 58 15 2 (0.25862069 0.74137931)
## 2958) sport>=6.5 47 15 2 (0.31914894 0.68085106)
## 5916) height< 1.725 29 12 2 (0.41379310 0.58620690)
## 11832) nationality>=98.5 16 7 1 (0.56250000 0.43750000) *
## 11833) nationality< 98.5 13 3 2 (0.23076923 0.76923077) *
## 5917) height>=1.725 18 3 2 (0.16666667 0.83333333) *
## 2959) sport< 6.5 11 0 2 (0.00000000 1.00000000) *
## 185) nationality< 7.5 21 2 2 (0.09523810 0.90476190) *
## 93) sport>=12.5 44 3 2 (0.06818182 0.93181818) *
## 47) height>=1.766708 240 77 2 (0.32083333 0.67916667)
## 94) sport>=8.5 29 13 1 (0.55172414 0.44827586)
## 188) weight< 64.5 8 0 1 (1.00000000 0.00000000) *
## 189) weight>=64.5 21 8 2 (0.38095238 0.61904762)
## 378) sport< 10.5 11 5 1 (0.54545455 0.45454545) *
## 379) sport>=10.5 10 2 2 (0.20000000 0.80000000) *
## 95) sport< 8.5 211 61 2 (0.28909953 0.71090047)
## 190) sport< 7.5 173 57 2 (0.32947977 0.67052023)
## 380) sport>=4.5 11 0 1 (1.00000000 0.00000000) *
## 381) sport< 4.5 162 46 2 (0.28395062 0.71604938)
## 762) nationality>=67 98 34 2 (0.34693878 0.65306122)
## 1524) weight< 63.5 32 15 2 (0.46875000 0.53125000)
## 3048) height>=1.825 8 2 1 (0.75000000 0.25000000) *
## 3049) height< 1.825 24 9 2 (0.37500000 0.62500000) *
## 1525) weight>=63.5 66 19 2 (0.28787879 0.71212121) *
## 763) nationality< 67 64 12 2 (0.18750000 0.81250000)
## 1526) height< 1.795 27 8 2 (0.29629630 0.70370370)
## 3052) weight>=64.5 14 6 1 (0.57142857 0.42857143) *
## 3053) weight< 64.5 13 0 2 (0.00000000 1.00000000) *
## 1527) height>=1.795 37 4 2 (0.10810811 0.89189189) *
## 191) sport>=7.5 38 4 2 (0.10526316 0.89473684) *
## 3) weight>=68.44921 4343 829 2 (0.19088188 0.80911812)
## 6) weight< 76.00098 1637 541 2 (0.33048259 0.66951741)
## 12) sport>=13.5 691 317 2 (0.45875543 0.54124457)
## 24) sport< 14.5 45 2 1 (0.95555556 0.04444444) *
## 25) sport>=14.5 646 274 2 (0.42414861 0.57585139)
## 50) sport>=25.5 138 48 1 (0.65217391 0.34782609)
## 100) sport< 26.5 66 9 1 (0.86363636 0.13636364) *
## 101) sport>=26.5 72 33 2 (0.45833333 0.54166667)
## 202) height< 1.64 18 4 1 (0.77777778 0.22222222) *
## 203) height>=1.64 54 19 2 (0.35185185 0.64814815)
## 406) nationality>=118.5 21 10 1 (0.52380952 0.47619048)
## 812) height< 1.685 9 2 1 (0.77777778 0.22222222) *
## 813) height>=1.685 12 4 2 (0.33333333 0.66666667) *
## 407) nationality< 118.5 33 8 2 (0.24242424 0.75757576)
## 814) nationality< 77 21 7 2 (0.33333333 0.66666667)
## 1628) nationality>=52.5 9 4 1 (0.55555556 0.44444444) *
## 1629) nationality< 52.5 12 2 2 (0.16666667 0.83333333) *
## 815) nationality>=77 12 1 2 (0.08333333 0.91666667) *
## 51) sport< 25.5 508 184 2 (0.36220472 0.63779528)
## 102) height< 1.685 43 10 1 (0.76744186 0.23255814) *
## 103) height>=1.685 465 151 2 (0.32473118 0.67526882)
## 206) height< 1.845 390 143 2 (0.36666667 0.63333333)
## 412) sport< 19.5 229 105 2 (0.45851528 0.54148472)
## 824) sport>=17.5 119 42 1 (0.64705882 0.35294118)
## 1648) height< 1.8055 84 24 1 (0.71428571 0.28571429)
## 3296) height>=1.781717 26 4 1 (0.84615385 0.15384615) *
## 3297) height< 1.781717 58 20 1 (0.65517241 0.34482759)
## 6594) nationality>=100.5 13 1 1 (0.92307692 0.07692308) *
## 6595) nationality< 100.5 45 19 1 (0.57777778 0.42222222)
## 13190) height< 1.725 15 3 1 (0.80000000 0.20000000) *
## 13191) height>=1.725 30 14 2 (0.46666667 0.53333333)
## 26382) weight< 70.5 8 2 1 (0.75000000 0.25000000) *
## 26383) weight>=70.5 22 8 2 (0.36363636 0.63636364)
## 52766) nationality< 45.5 7 3 1 (0.57142857 0.42857143) *
## 52767) nationality>=45.5 15 4 2 (0.26666667 0.73333333) *
## 1649) height>=1.8055 35 17 2 (0.48571429 0.51428571)
## 3298) nationality>=104 13 3 1 (0.76923077 0.23076923) *
## 3299) nationality< 104 22 7 2 (0.31818182 0.68181818) *
## 825) sport< 17.5 110 28 2 (0.25454545 0.74545455)
## 1650) weight< 71.5 46 21 2 (0.45652174 0.54347826)
## 3300) sport>=15.5 18 7 1 (0.61111111 0.38888889) *
## 3301) sport< 15.5 28 10 2 (0.35714286 0.64285714) *
## 1651) weight>=71.5 64 7 2 (0.10937500 0.89062500) *
## 413) sport>=19.5 161 38 2 (0.23602484 0.76397516)
## 826) sport>=22.5 40 16 2 (0.40000000 0.60000000)
## 1652) sport< 24.5 29 13 1 (0.55172414 0.44827586)
## 3304) height>=1.76 21 7 1 (0.66666667 0.33333333)
## 6608) nationality>=67 13 2 1 (0.84615385 0.15384615) *
## 6609) nationality< 67 8 3 2 (0.37500000 0.62500000) *
## 3305) height< 1.76 8 2 2 (0.25000000 0.75000000) *
## 1653) sport>=24.5 11 0 2 (0.00000000 1.00000000) *
## 827) sport< 22.5 121 22 2 (0.18181818 0.81818182)
## 1654) weight< 71.99744 44 18 2 (0.40909091 0.59090909)
## 3308) sport< 20.5 25 9 1 (0.64000000 0.36000000)
## 6616) weight< 70.5 18 4 1 (0.77777778 0.22222222) *
## 6617) weight>=70.5 7 2 2 (0.28571429 0.71428571) *
## 3309) sport>=20.5 19 2 2 (0.10526316 0.89473684) *
## 1655) weight>=71.99744 77 4 2 (0.05194805 0.94805195) *
## 207) height>=1.845 75 8 2 (0.10666667 0.89333333) *
## 13) sport< 13.5 946 224 2 (0.23678647 0.76321353)
## 26) sport< 5.5 507 152 2 (0.29980276 0.70019724)
## 52) sport>=4.5 32 0 1 (1.00000000 0.00000000) *
## 53) sport< 4.5 475 120 2 (0.25263158 0.74736842)
## 106) gold>=0.5 28 10 1 (0.64285714 0.35714286)
## 212) sport< 2 13 2 1 (0.84615385 0.15384615) *
## 213) sport>=2 15 7 2 (0.46666667 0.53333333) *
## 107) gold< 0.5 447 102 2 (0.22818792 0.77181208)
## 214) height< 1.78 180 63 2 (0.35000000 0.65000000)
## 428) nationality< 96 104 47 2 (0.45192308 0.54807692)
## 856) nationality>=90 9 0 1 (1.00000000 0.00000000) *
## 857) nationality< 90 95 38 2 (0.40000000 0.60000000)
## 1714) nationality< 78.5 81 37 2 (0.45679012 0.54320988)
## 3428) height< 1.705 14 4 1 (0.71428571 0.28571429) *
## 3429) height>=1.705 67 27 2 (0.40298507 0.59701493)
## 6858) height>=1.745 49 23 2 (0.46938776 0.53061224)
## 13716) height< 1.755 16 6 1 (0.62500000 0.37500000) *
## 13717) height>=1.755 33 13 2 (0.39393939 0.60606061)
## 27434) nationality< 55.5 19 9 1 (0.52631579 0.47368421) *
## 27435) nationality>=55.5 14 3 2 (0.21428571 0.78571429) *
## 6859) height< 1.745 18 4 2 (0.22222222 0.77777778) *
## 1715) nationality>=78.5 14 1 2 (0.07142857 0.92857143) *
## 429) nationality>=96 76 16 2 (0.21052632 0.78947368) *
## 215) height>=1.78 267 39 2 (0.14606742 0.85393258)
## 430) sport< 2.5 100 26 2 (0.26000000 0.74000000)
## 860) weight< 69.5 10 3 1 (0.70000000 0.30000000) *
## 861) weight>=69.5 90 19 2 (0.21111111 0.78888889)
## 1722) weight< 74.5 53 16 2 (0.30188679 0.69811321)
## 3444) nationality>=36.5 46 16 2 (0.34782609 0.65217391)
## 6888) nationality< 96 22 10 2 (0.45454545 0.54545455)
## 13776) height< 1.835 12 4 1 (0.66666667 0.33333333) *
## 13777) height>=1.835 10 2 2 (0.20000000 0.80000000) *
## 6889) nationality>=96 24 6 2 (0.25000000 0.75000000)
## 13778) height>=1.855 8 3 1 (0.62500000 0.37500000) *
## 13779) height< 1.855 16 1 2 (0.06250000 0.93750000) *
## 3445) nationality< 36.5 7 0 2 (0.00000000 1.00000000) *
## 1723) weight>=74.5 37 3 2 (0.08108108 0.91891892) *
## 431) sport>=2.5 167 13 2 (0.07784431 0.92215569) *
## 27) sport>=5.5 439 72 2 (0.16400911 0.83599089)
## 54) weight< 74.05124 326 64 2 (0.19631902 0.80368098)
## 108) nationality< 77 140 37 2 (0.26428571 0.73571429)
## 216) nationality>=64 38 19 1 (0.50000000 0.50000000)
## 432) sport< 7.5 14 3 1 (0.78571429 0.21428571) *
## 433) sport>=7.5 24 8 2 (0.33333333 0.66666667)
## 866) sport>=9.5 7 1 1 (0.85714286 0.14285714) *
## 867) sport< 9.5 17 2 2 (0.11764706 0.88235294) *
## 217) nationality< 64 102 18 2 (0.17647059 0.82352941)
## 434) nationality< 35 50 14 2 (0.28000000 0.72000000)
## 868) gold< 0.5 43 14 2 (0.32558140 0.67441860)
## 1736) nationality>=9 31 13 2 (0.41935484 0.58064516)
## 3472) sport>=10.5 8 2 1 (0.75000000 0.25000000) *
## 3473) sport< 10.5 23 7 2 (0.30434783 0.69565217)
## 6946) height< 1.735 7 3 1 (0.57142857 0.42857143) *
## 6947) height>=1.735 16 3 2 (0.18750000 0.81250000) *
## 1737) nationality< 9 12 1 2 (0.08333333 0.91666667) *
## 869) gold>=0.5 7 0 2 (0.00000000 1.00000000) *
## 435) nationality>=35 52 4 2 (0.07692308 0.92307692) *
## 109) nationality>=77 186 27 2 (0.14516129 0.85483871)
## 218) nationality>=178.5 47 15 2 (0.31914894 0.68085106)
## 436) sport>=6.5 29 14 2 (0.48275862 0.51724138)
## 872) weight>=73.95 10 3 1 (0.70000000 0.30000000) *
## 873) weight< 73.95 19 7 2 (0.36842105 0.63157895) *
## 437) sport< 6.5 18 1 2 (0.05555556 0.94444444) *
## 219) nationality< 178.5 139 12 2 (0.08633094 0.91366906) *
## 55) weight>=74.05124 113 8 2 (0.07079646 0.92920354) *
## 7) weight>=76.00098 2706 288 2 (0.10643016 0.89356984)
## 14) height< 1.801 640 144 2 (0.22500000 0.77500000)
## 28) sport< 3.5 125 60 2 (0.48000000 0.52000000)
## 56) weight>=89.5 42 9 1 (0.78571429 0.21428571)
## 112) sport>=2.5 35 5 1 (0.85714286 0.14285714) *
## 113) sport< 2.5 7 3 2 (0.42857143 0.57142857) *
## 57) weight< 89.5 83 27 2 (0.32530120 0.67469880)
## 114) nationality< 121 54 25 2 (0.46296296 0.53703704)
## 228) height< 1.7805 38 16 1 (0.57894737 0.42105263)
## 456) sport>=1.5 26 8 1 (0.69230769 0.30769231) *
## 457) sport< 1.5 12 4 2 (0.33333333 0.66666667) *
## 229) height>=1.7805 16 3 2 (0.18750000 0.81250000) *
## 115) nationality>=121 29 2 2 (0.06896552 0.93103448) *
## 29) sport>=3.5 515 84 2 (0.16310680 0.83689320)
## 58) height< 1.695 34 17 1 (0.50000000 0.50000000)
## 116) sport< 24 18 4 1 (0.77777778 0.22222222) *
## 117) sport>=24 16 3 2 (0.18750000 0.81250000) *
## 59) height>=1.695 481 67 2 (0.13929314 0.86070686)
## 118) weight>=107 17 7 1 (0.58823529 0.41176471) *
## 119) weight< 107 464 57 2 (0.12284483 0.87715517)
## 238) weight< 78.00875 109 25 2 (0.22935780 0.77064220)
## 476) sport< 18.5 83 23 2 (0.27710843 0.72289157)
## 952) sport>=15.5 13 3 1 (0.76923077 0.23076923) *
## 953) sport< 15.5 70 13 2 (0.18571429 0.81428571) *
## 477) sport>=18.5 26 2 2 (0.07692308 0.92307692) *
## 239) weight>=78.00875 355 32 2 (0.09014085 0.90985915) *
## 15) height>=1.801 2066 144 2 (0.06969990 0.93030010)
## 30) weight< 79.2 254 38 2 (0.14960630 0.85039370)
## 60) sport>=25.5 20 9 1 (0.55000000 0.45000000)
## 120) nationality< 45 9 3 1 (0.66666667 0.33333333) *
## 121) nationality>=45 11 5 2 (0.45454545 0.54545455) *
## 61) sport< 25.5 234 27 2 (0.11538462 0.88461538)
## 122) nationality>=198 26 8 2 (0.30769231 0.69230769) *
## 123) nationality< 198 208 19 2 (0.09134615 0.90865385)
## 246) sport>=4.5 127 18 2 (0.14173228 0.85826772)
## 492) sport< 5.5 7 0 1 (1.00000000 0.00000000) *
## 493) sport>=5.5 120 11 2 (0.09166667 0.90833333)
## 986) sport>=13 56 9 2 (0.16071429 0.83928571)
## 1972) sport< 19.5 29 9 2 (0.31034483 0.68965517)
## 3944) sport>=16 8 3 1 (0.62500000 0.37500000) *
## 3945) sport< 16 21 4 2 (0.19047619 0.80952381) *
## 1973) sport>=19.5 27 0 2 (0.00000000 1.00000000) *
## 987) sport< 13 64 2 2 (0.03125000 0.96875000) *
## 247) sport< 4.5 81 1 2 (0.01234568 0.98765432) *
## 31) weight>=79.2 1812 106 2 (0.05849890 0.94150110)
## 62) sport< 5.5 718 68 2 (0.09470752 0.90529248)
## 124) height< 1.833 71 23 2 (0.32394366 0.67605634)
## 248) weight>=98.5 10 2 1 (0.80000000 0.20000000) *
## 249) weight< 98.5 61 15 2 (0.24590164 0.75409836)
## 498) nationality< 66.5 23 10 2 (0.43478261 0.56521739)
## 996) height< 1.824 10 3 1 (0.70000000 0.30000000) *
## 997) height>=1.824 13 3 2 (0.23076923 0.76923077) *
## 499) nationality>=66.5 38 5 2 (0.13157895 0.86842105) *
## 125) height>=1.833 647 45 2 (0.06955178 0.93044822)
## 250) sport>=4.5 126 30 2 (0.23809524 0.76190476)
## 500) height< 1.985 64 28 2 (0.43750000 0.56250000)
## 1000) nationality>=150.5 17 5 1 (0.70588235 0.29411765) *
## 1001) nationality< 150.5 47 16 2 (0.34042553 0.65957447) *
## 501) height>=1.985 62 2 2 (0.03225806 0.96774194) *
## 251) sport< 4.5 521 15 2 (0.02879079 0.97120921) *
## 63) sport>=5.5 1094 38 2 (0.03473492 0.96526508)
## 126) weight< 84.02505 277 24 2 (0.08664260 0.91335740)
## 252) nationality>=155.5 60 15 2 (0.25000000 0.75000000)
## 504) sport>=13 41 15 2 (0.36585366 0.63414634)
## 1008) sport< 19.5 15 6 1 (0.60000000 0.40000000) *
## 1009) sport>=19.5 26 6 2 (0.23076923 0.76923077)
## 2018) sport>=25 10 4 1 (0.60000000 0.40000000) *
## 2019) sport< 25 16 0 2 (0.00000000 1.00000000) *
## 505) sport< 13 19 0 2 (0.00000000 1.00000000) *
## 253) nationality< 155.5 217 9 2 (0.04147465 0.95852535) *
## 127) weight>=84.02505 817 14 2 (0.01713586 0.98286414) *
prp(modeloArbol, type = 2, extra = 2)
## Warning: labs do not fit even at cex 0.15, there may be some overplotting
