rm(list=ls())
mydata <- read.delim("/Users/feder/Desktop/km_project/aprender_cordoba_dataset.txt")
names(mydata)
## [1] "ID1" "cod_provincia"
## [3] "sector" "ambito"
## [5] "claveseccion" "idalumno"
## [7] "ap01_01" "ap01_02"
## [9] "ap02" "gender"
## [11] "female" "ap03"
## [13] "ap04" "ap05"
## [15] "ap06" "ap07"
## [17] "ap08_a" "ap08_b"
## [19] "ap08_c" "ap08_d"
## [21] "ap08_e" "ap08_f"
## [23] "ap08_g" "ap08_h"
## [25] "ap08_i" "ap09"
## [27] "ap10" "ap11_01"
## [29] "ap11_02" "ap11_03"
## [31] "ap11_04" "ap11_05"
## [33] "ap11_06" "ap11_07"
## [35] "ap11_08" "ap12"
## [37] "ap13" "ap14_01"
## [39] "ap14_02" "ap15"
## [41] "ap16" "ap17"
## [43] "ap18_01" "ap18_02"
## [45] "ap18_03" "ap19"
## [47] "ap21" "ap22"
## [49] "ap23_01" "ap23_02"
## [51] "ap23_03" "ap23_04"
## [53] "ap23_05" "ap23_06"
## [55] "ap24" "ap25_01"
## [57] "ap25_02" "ap25_03"
## [59] "ap26" "ap27_a"
## [61] "ap27_b" "ap27_c"
## [63] "ap27_d" "ap27_e"
## [65] "ap27_f" "ap28_01"
## [67] "ap28_02" "ap28_03"
## [69] "ap28_04" "ap29_01"
## [71] "ap29_02" "ap29_03"
## [73] "ap29_04" "ap29_05"
## [75] "ap29_06" "ap29_07"
## [77] "ap30" "ap31_01"
## [79] "ap31_02" "ap31_03"
## [81] "ap31_04" "ap31_05"
## [83] "ap31_06" "ap32_a"
## [85] "ap32_b" "ap32_c"
## [87] "ap32_d" "ap32_e"
## [89] "ap32_f" "ap33_01_a"
## [91] "ap33_02_a" "ap33_03_a"
## [93] "ap33_04_a" "ap33_01_b"
## [95] "ap33_02_b" "ap33_03_b"
## [97] "ap33_04_b" "ap33_01bis"
## [99] "ap33_02bis" "ap33_03bis"
## [101] "ap33_04bis" "ap33_05bis"
## [103] "ap33_06bis" "ap33_07bis"
## [105] "ap33_08bis" "ap33_09bis"
## [107] "ap33_10bis" "ap33_11bis"
## [109] "ap34" "ap35_01"
## [111] "ap35_02" "ap35_03"
## [113] "ap35_04" "ap35_05"
## [115] "ap36_a" "ap36_b"
## [117] "ap36_c" "ap36_d"
## [119] "ap36_e" "ap36_f"
## [121] "ap37_a" "ap37_b"
## [123] "ap37_c" "ap37_d"
## [125] "ap37_e" "ap37_f"
## [127] "ap37_g" "ap37_h"
## [129] "ap37_i" "ap37_j"
## [131] "ap37_k" "ap37_l"
## [133] "ap37_m" "ap37_n"
## [135] "ap38_a" "ap38_b"
## [137] "ap38_c" "ap38_d"
## [139] "ap38_e" "ap38_f"
## [141] "ap38_g" "ap38_h"
## [143] "ap38_i" "ap38_j"
## [145] "ap38_k" "ap38_l"
## [147] "ap38_m" "ap38_n"
## [149] "ap39_01" "ap39_02"
## [151] "ap39_03" "ap39_04"
## [153] "ap40_01" "ap40_02"
## [155] "ap40_03" "ap40_04"
## [157] "ap40_05" "ap40_06"
## [159] "ap41_01" "ap41_02"
## [161] "ap41_03" "ap41_04"
## [163] "ap41_05" "ap41_06"
## [165] "ap41_07" "ap41_08"
## [167] "ap41_09" "ap41_10"
## [169] "ap41_11" "ap42_01"
## [171] "ap42_02" "ap42_03"
## [173] "ap42_04" "ap43_a"
## [175] "ap43_b" "ap43_c"
## [177] "ap43_d" "ap43_e"
## [179] "ap43_f" "ap43_g"
## [181] "ap43_h" "ap44_01"
## [183] "ap44_02" "ap44_03"
## [185] "ap44_04" "ap44_05"
## [187] "ap45" "ap46_01"
## [189] "ap46_02" "ap46_03"
## [191] "ap46_04" "ap46_05"
## [193] "ap47_01" "ap47_02"
## [195] "ap47_03" "ap47_04"
## [197] "ap47_05" "ap47_06"
## [199] "ap47_07" "ap47_08"
## [201] "ap47_09" "ap47_10"
## [203] "ap47_11" "ap47_12"
## [205] "ap48_a" "ap48_b"
## [207] "ap48_c" "ap48_d"
## [209] "ap48_e" "ap48_f"
## [211] "ap48_g" "ap48_h"
## [213] "ap48_i" "ap49_01"
## [215] "ap49_02" "ap50_01"
## [217] "ap50_02" "ap50_03"
## [219] "ap50_04" "ap50_05"
## [221] "ap51_01" "ap51_02"
## [223] "ap51_03" "ap51_04"
## [225] "ap51_05" "ap51_06"
## [227] "ap51_07" "ap51_08"
## [229] "ap51_09" "ap51_10"
## [231] "ponder" "lpondera"
## [233] "mpondera" "ldesemp"
## [235] "mdesemp" "TEL"
## [237] "TEM" "modelo"
## [239] "isocioa_puntaje" "isocioa"
## [241] "isocioal_puntaje" "isocioal"
## [243] "isocioam_puntaje" "isocioam"
## [245] "repitencia_dicotomica" "jardín"
## [247] "ap37_dicotomica" "ap29_01.dico"
## [249] "ap29_02.dico" "ap29_03.dico"
## [251] "ap29_04.dico" "ap29_05.dico"
## [253] "ap29_06.dico" "ap29_07.dico"
## [255] "ap26_rec" "trabaja_fuera_hogar"
## [257] "trabaja_fuera_hogar_remunerado" "migración"
## [259] "edadA_junio2019" "sobreedad"
## [261] "infraestructura" "iinfraestructura"
## [263] "ap42_01rec" "ap42_02rec"
## [265] "ap42_03rec" "ap42_04rec"
library("car")
## Warning: package 'car' was built under R version 4.0.3
## Loading required package: carData
scatterplot(ldesemp ~ mdesemp, data=mydata,
xlab="Math Performance", ylab="Language Performance",
main="Language Performance by Math Performance")
par(mfrow=c(2, 2))
boxplot(ldesemp~sector,data=mydata, main="Language Performance by Sector", sub="1= Public 2= Private",
xlab="Sector", ylab="Language Performance", col="orange")
boxplot(ldesemp~ambito,data=mydata, main="Language Performance by Ambit", sub="1= Urban 2= Rural",
xlab="Ambit", ylab="Language Performance", col="orange")
boxplot(mdesemp~sector,data=mydata, main="Math Performance by Sector", sub="1= Public 2= Private",
xlab="Sector", ylab="Math Performance", col="lightblue")
boxplot(mdesemp~ambito,data=mydata, main="Math Performance by Ambit", sub="1= Urban 2= Rural",
xlab="Ambit", ylab="Math Performance", col="lightblue")
par(mfrow=c(1, 2))
counts1 <- table(mydata$ldesemp, mydata$gender)
barplot(counts1, main="Language Performance Level by Gender", sub="1= Male 2= Female 3= Other",
xlab="Gender", col=c("red","orange","lightblue","forestgreen"), ylim=c(0,20000))
counts2 <- table(mydata$mdesemp, mydata$gender)
barplot(counts2, main="Math Performance Level by Gender", sub="1= Male 2= Female 3= Other",
xlab="Gender", col=c("red","orange","lightblue","forestgreen"),
legend.text = c("Low", "Basic", "Satisf.", "Adv."), ylim=c(0,20000))
par(mfrow=c(2, 2))
boxplot(ldesemp~repitencia_dicotomica,data=mydata, main="Language Performance by School Repetition", sub="1= Repeated School Grade 2= Non Repeated School Grade 3= No answer",
xlab="School Repetition", ylab="Language Performance", col="pink")
boxplot(mdesemp~repitencia_dicotomica,data=mydata, main="Math Performance by School Repetition", sub="1= Repeated School Grade 2= Non Repeated School Grade 3= No answer",
xlab="School Repetition", ylab="Math Performance", col="pink")
boxplot(ldesemp~trabaja_fuera_hogar,data=mydata, main="Language Performance by Students Who Work", sub="1= Yes 2= No 3= No answer",
xlab="Students Who Work", ylab="Language Performance", col="darkkhaki")
boxplot(mdesemp~trabaja_fuera_hogar,data=mydata, main="Math Performance by Students Who Work", sub="1= Yes 2= No 3= No answer",
xlab="Students Who Work", ylab="Math Performance", col="darkkhaki")
par(mfrow=c(1, 2))
counts1 <- table(mydata$ldesemp, mydata$isocioa)
barplot(counts1, main="Language Performance by Socioeconomic Level", sub="-1=Non Answer, 1= Low 2= Medium 3= High",
xlab="Socioeconomic Level", col=c("red","orange","lightblue","forestgreen"), ylim=c(0,20000))
counts2 <- table(mydata$mdesemp, mydata$isocioa)
barplot(counts2, main="Math Performance by Socioeconomic Level", sub="-1=Non Answer, 1= Low 2= Medium 3= High",
xlab="Socioeconomic Level", col=c("red","orange","lightblue","forestgreen"),
legend.text = c("Low", "Basic", "Satisf.", "Adv."), ylim=c(0,20000))
mydata <- read.delim("/Users/feder/Desktop/km_project/aprender_cordoba_dataset_to_subset.txt")
library(leaps)
## Warning: package 'leaps' was built under R version 4.0.5
leaps1<- regsubsets(ldesemp ~., data= mydata, nbest=1, method = "backward")
summary(leaps1)
## Subset selection object
## Call: regsubsets.formula(ldesemp ~ ., data = mydata, nbest = 1, method = "backward")
## 247 Variables (and intercept)
## Forced in Forced out
## mdesemp FALSE FALSE
## sector FALSE FALSE
## ambito FALSE FALSE
## ap01_01 FALSE FALSE
## ap01_02 FALSE FALSE
## gender FALSE FALSE
## ap03 FALSE FALSE
## ap04 FALSE FALSE
## ap05 FALSE FALSE
## ap06 FALSE FALSE
## ap07 FALSE FALSE
## ap08_a FALSE FALSE
## ap08_b FALSE FALSE
## ap08_c FALSE FALSE
## ap08_d FALSE FALSE
## ap08_e FALSE FALSE
## ap08_f FALSE FALSE
## ap08_g FALSE FALSE
## ap08_h FALSE FALSE
## ap08_i FALSE FALSE
## ap09 FALSE FALSE
## ap10 FALSE FALSE
## ap11_01 FALSE FALSE
## ap11_02 FALSE FALSE
## ap11_03 FALSE FALSE
## ap11_04 FALSE FALSE
## ap11_05 FALSE FALSE
## ap11_06 FALSE FALSE
## ap11_07 FALSE FALSE
## ap11_08 FALSE FALSE
## ap12 FALSE FALSE
## ap13 FALSE FALSE
## ap14_01 FALSE FALSE
## ap14_02 FALSE FALSE
## ap15 FALSE FALSE
## ap16 FALSE FALSE
## ap17 FALSE FALSE
## ap18_01 FALSE FALSE
## ap18_02 FALSE FALSE
## ap18_03 FALSE FALSE
## ap19 FALSE FALSE
## ap21 FALSE FALSE
## ap22 FALSE FALSE
## ap23_01 FALSE FALSE
## ap23_02 FALSE FALSE
## ap23_03 FALSE FALSE
## ap23_04 FALSE FALSE
## ap23_05 FALSE FALSE
## ap23_06 FALSE FALSE
## ap24 FALSE FALSE
## ap25_01 FALSE FALSE
## ap25_02 FALSE FALSE
## ap25_03 FALSE FALSE
## ap26 FALSE FALSE
## ap27_a FALSE FALSE
## ap27_b FALSE FALSE
## ap27_c FALSE FALSE
## ap27_d FALSE FALSE
## ap27_e FALSE FALSE
## ap27_f FALSE FALSE
## ap28_01 FALSE FALSE
## ap28_02 FALSE FALSE
## ap28_03 FALSE FALSE
## ap28_04 FALSE FALSE
## ap29_01 FALSE FALSE
## ap29_02 FALSE FALSE
## ap29_03 FALSE FALSE
## ap29_04 FALSE FALSE
## ap29_05 FALSE FALSE
## ap29_06 FALSE FALSE
## ap29_07 FALSE FALSE
## ap30 FALSE FALSE
## ap31_01 FALSE FALSE
## ap31_02 FALSE FALSE
## ap31_03 FALSE FALSE
## ap31_04 FALSE FALSE
## ap31_05 FALSE FALSE
## ap31_06 FALSE FALSE
## ap32_a FALSE FALSE
## ap32_b FALSE FALSE
## ap32_c FALSE FALSE
## ap32_d FALSE FALSE
## ap32_e FALSE FALSE
## ap32_f FALSE FALSE
## ap33_01_a FALSE FALSE
## ap33_02_a FALSE FALSE
## ap33_03_a FALSE FALSE
## ap33_04_a FALSE FALSE
## ap33_01_b FALSE FALSE
## ap33_02_b FALSE FALSE
## ap33_03_b FALSE FALSE
## ap33_04_b FALSE FALSE
## ap33_01bis FALSE FALSE
## ap33_02bis FALSE FALSE
## ap33_03bis FALSE FALSE
## ap33_04bis FALSE FALSE
## ap33_05bis FALSE FALSE
## ap33_06bis FALSE FALSE
## ap33_07bis FALSE FALSE
## ap33_08bis FALSE FALSE
## ap33_09bis FALSE FALSE
## ap33_10bis FALSE FALSE
## ap33_11bis FALSE FALSE
## ap34 FALSE FALSE
## ap35_01 FALSE FALSE
## ap35_02 FALSE FALSE
## ap35_03 FALSE FALSE
## ap35_04 FALSE FALSE
## ap35_05 FALSE FALSE
## ap36_a FALSE FALSE
## ap36_b FALSE FALSE
## ap36_c FALSE FALSE
## ap36_d FALSE FALSE
## ap36_e FALSE FALSE
## ap36_f FALSE FALSE
## ap37_a FALSE FALSE
## ap37_b FALSE FALSE
## ap37_c FALSE FALSE
## ap37_d FALSE FALSE
## ap37_e FALSE FALSE
## ap37_f FALSE FALSE
## ap37_g FALSE FALSE
## ap37_h FALSE FALSE
## ap37_i FALSE FALSE
## ap37_j FALSE FALSE
## ap37_k FALSE FALSE
## ap37_l FALSE FALSE
## ap37_m FALSE FALSE
## ap37_n FALSE FALSE
## ap38_a FALSE FALSE
## ap38_b FALSE FALSE
## ap38_c FALSE FALSE
## ap38_d FALSE FALSE
## ap38_e FALSE FALSE
## ap38_f FALSE FALSE
## ap38_g FALSE FALSE
## ap38_h FALSE FALSE
## ap38_i FALSE FALSE
## ap38_j FALSE FALSE
## ap38_k FALSE FALSE
## ap38_l FALSE FALSE
## ap38_m FALSE FALSE
## ap38_n FALSE FALSE
## ap39_01 FALSE FALSE
## ap39_02 FALSE FALSE
## ap39_03 FALSE FALSE
## ap39_04 FALSE FALSE
## ap40_01 FALSE FALSE
## ap40_02 FALSE FALSE
## ap40_03 FALSE FALSE
## ap40_04 FALSE FALSE
## ap40_05 FALSE FALSE
## ap40_06 FALSE FALSE
## ap41_01 FALSE FALSE
## ap41_02 FALSE FALSE
## ap41_03 FALSE FALSE
## ap41_04 FALSE FALSE
## ap41_05 FALSE FALSE
## ap41_06 FALSE FALSE
## ap41_07 FALSE FALSE
## ap41_08 FALSE FALSE
## ap41_09 FALSE FALSE
## ap41_10 FALSE FALSE
## ap41_11 FALSE FALSE
## ap42_01 FALSE FALSE
## ap42_02 FALSE FALSE
## ap42_03 FALSE FALSE
## ap42_04 FALSE FALSE
## ap43_a FALSE FALSE
## ap43_b FALSE FALSE
## ap43_c FALSE FALSE
## ap43_d FALSE FALSE
## ap43_e FALSE FALSE
## ap43_f FALSE FALSE
## ap43_g FALSE FALSE
## ap43_h FALSE FALSE
## ap44_01 FALSE FALSE
## ap44_02 FALSE FALSE
## ap44_03 FALSE FALSE
## ap44_04 FALSE FALSE
## ap44_05 FALSE FALSE
## ap45 FALSE FALSE
## ap46_01 FALSE FALSE
## ap46_02 FALSE FALSE
## ap46_03 FALSE FALSE
## ap46_04 FALSE FALSE
## ap46_05 FALSE FALSE
## ap47_01 FALSE FALSE
## ap47_02 FALSE FALSE
## ap47_03 FALSE FALSE
## ap47_04 FALSE FALSE
## ap47_05 FALSE FALSE
## ap47_06 FALSE FALSE
## ap47_07 FALSE FALSE
## ap47_08 FALSE FALSE
## ap47_09 FALSE FALSE
## ap47_10 FALSE FALSE
## ap47_11 FALSE FALSE
## ap47_12 FALSE FALSE
## ap48_a FALSE FALSE
## ap48_b FALSE FALSE
## ap48_c FALSE FALSE
## ap48_d FALSE FALSE
## ap48_e FALSE FALSE
## ap48_f FALSE FALSE
## ap48_g FALSE FALSE
## ap48_h FALSE FALSE
## ap48_i FALSE FALSE
## ap49_01 FALSE FALSE
## ap49_02 FALSE FALSE
## ap50_01 FALSE FALSE
## ap50_02 FALSE FALSE
## ap50_03 FALSE FALSE
## ap50_04 FALSE FALSE
## ap50_05 FALSE FALSE
## ap51_01 FALSE FALSE
## ap51_02 FALSE FALSE
## ap51_03 FALSE FALSE
## ap51_04 FALSE FALSE
## ap51_05 FALSE FALSE
## ap51_06 FALSE FALSE
## ap51_07 FALSE FALSE
## ap51_08 FALSE FALSE
## ap51_09 FALSE FALSE
## ap51_10 FALSE FALSE
## isocioa FALSE FALSE
## repitencia_dicotomica FALSE FALSE
## jardín FALSE FALSE
## ap37_dicotomica FALSE FALSE
## ap29_01.dico FALSE FALSE
## ap29_02.dico FALSE FALSE
## ap29_03.dico FALSE FALSE
## ap29_04.dico FALSE FALSE
## ap29_05.dico FALSE FALSE
## ap29_06.dico FALSE FALSE
## ap29_07.dico FALSE FALSE
## ap26_rec FALSE FALSE
## trabaja_fuera_hogar FALSE FALSE
## trabaja_fuera_hogar_remunerado FALSE FALSE
## migración FALSE FALSE
## edadA_junio2019 FALSE FALSE
## sobreedad FALSE FALSE
## iinfraestructura FALSE FALSE
## ap42_01rec FALSE FALSE
## ap42_02rec FALSE FALSE
## ap42_03rec FALSE FALSE
## ap42_04rec FALSE FALSE
## 1 subsets of each size up to 8
## Selection Algorithm: backward
## mdesemp sector ambito ap01_01 ap01_02 gender ap03 ap04 ap05 ap06 ap07
## 1 ( 1 ) "*" " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) "*" " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) "*" " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) "*" " " " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) "*" " " " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) "*" " " " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) "*" " " " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) "*" " " " " " " " " " " " " " " " " " " " "
## ap08_a ap08_b ap08_c ap08_d ap08_e ap08_f ap08_g ap08_h ap08_i ap09
## 1 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## ap10 ap11_01 ap11_02 ap11_03 ap11_04 ap11_05 ap11_06 ap11_07 ap11_08
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap12 ap13 ap14_01 ap14_02 ap15 ap16 ap17 ap18_01 ap18_02 ap18_03 ap19
## 1 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## ap21 ap22 ap23_01 ap23_02 ap23_03 ap23_04 ap23_05 ap23_06 ap24 ap25_01
## 1 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " "*" " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " "*" " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " "*" " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " "*" " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " "*" " " " " " " " " " " " " " " " "
## ap25_02 ap25_03 ap26 ap27_a ap27_b ap27_c ap27_d ap27_e ap27_f ap28_01
## 1 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## ap28_02 ap28_03 ap28_04 ap29_01 ap29_02 ap29_03 ap29_04 ap29_05
## 1 ( 1 ) " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " "
## ap29_06 ap29_07 ap30 ap31_01 ap31_02 ap31_03 ap31_04 ap31_05 ap31_06
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap32_a ap32_b ap32_c ap32_d ap32_e ap32_f ap33_01_a ap33_02_a
## 1 ( 1 ) " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " "
## ap33_03_a ap33_04_a ap33_01_b ap33_02_b ap33_03_b ap33_04_b ap33_01bis
## 1 ( 1 ) " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " "
## ap33_02bis ap33_03bis ap33_04bis ap33_05bis ap33_06bis ap33_07bis
## 1 ( 1 ) " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " "
## ap33_08bis ap33_09bis ap33_10bis ap33_11bis ap34 ap35_01 ap35_02
## 1 ( 1 ) " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " "
## ap35_03 ap35_04 ap35_05 ap36_a ap36_b ap36_c ap36_d ap36_e ap36_f
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap37_a ap37_b ap37_c ap37_d ap37_e ap37_f ap37_g ap37_h ap37_i ap37_j
## 1 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) "*" " " " " " " " " " " " " " " " " " "
## ap37_k ap37_l ap37_m ap37_n ap38_a ap38_b ap38_c ap38_d ap38_e ap38_f
## 1 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## ap38_g ap38_h ap38_i ap38_j ap38_k ap38_l ap38_m ap38_n ap39_01
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " "*" " " " " " " " "
## 3 ( 1 ) " " " " " " " " "*" " " " " " " " "
## 4 ( 1 ) " " " " " " " " "*" " " " " " " " "
## 5 ( 1 ) " " " " " " " " "*" " " " " " " " "
## 6 ( 1 ) " " " " " " " " "*" " " " " " " " "
## 7 ( 1 ) " " " " " " " " "*" " " " " " " "*"
## 8 ( 1 ) " " " " " " " " "*" " " " " " " "*"
## ap39_02 ap39_03 ap39_04 ap40_01 ap40_02 ap40_03 ap40_04 ap40_05
## 1 ( 1 ) " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " "
## ap40_06 ap41_01 ap41_02 ap41_03 ap41_04 ap41_05 ap41_06 ap41_07
## 1 ( 1 ) " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " "
## ap41_08 ap41_09 ap41_10 ap41_11 ap42_01 ap42_02 ap42_03 ap42_04 ap43_a
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap43_b ap43_c ap43_d ap43_e ap43_f ap43_g ap43_h ap44_01 ap44_02
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap44_03 ap44_04 ap44_05 ap45 ap46_01 ap46_02 ap46_03 ap46_04 ap46_05
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap47_01 ap47_02 ap47_03 ap47_04 ap47_05 ap47_06 ap47_07 ap47_08
## 1 ( 1 ) " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " "
## ap47_09 ap47_10 ap47_11 ap47_12 ap48_a ap48_b ap48_c ap48_d ap48_e
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap48_f ap48_g ap48_h ap48_i ap49_01 ap49_02 ap50_01 ap50_02 ap50_03
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap50_04 ap50_05 ap51_01 ap51_02 ap51_03 ap51_04 ap51_05 ap51_06
## 1 ( 1 ) " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " "
## ap51_07 ap51_08 ap51_09 ap51_10 isocioa repitencia_dicotomica jardín
## 1 ( 1 ) " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " "*" " " " "
## 4 ( 1 ) " " " " " " " " "*" " " " "
## 5 ( 1 ) " " " " " " " " "*" " " " "
## 6 ( 1 ) " " " " " " " " "*" " " " "
## 7 ( 1 ) " " " " " " " " "*" " " " "
## 8 ( 1 ) " " " " " " " " "*" " " " "
## ap37_dicotomica ap29_01.dico ap29_02.dico ap29_03.dico ap29_04.dico
## 1 ( 1 ) " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " "
## ap29_05.dico ap29_06.dico ap29_07.dico ap26_rec trabaja_fuera_hogar
## 1 ( 1 ) " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " "
## trabaja_fuera_hogar_remunerado migración edadA_junio2019 sobreedad
## 1 ( 1 ) " " " " " " " "
## 2 ( 1 ) " " " " " " " "
## 3 ( 1 ) " " " " " " " "
## 4 ( 1 ) " " " " " " " "
## 5 ( 1 ) " " " " " " "*"
## 6 ( 1 ) " " " " "*" "*"
## 7 ( 1 ) " " " " "*" "*"
## 8 ( 1 ) " " " " "*" "*"
## iinfraestructura ap42_01rec ap42_02rec ap42_03rec ap42_04rec
## 1 ( 1 ) " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " "
leaps2<- regsubsets(mdesemp ~., data= mydata, nbest=1, method = "forward")
summary(leaps2)
## Subset selection object
## Call: regsubsets.formula(mdesemp ~ ., data = mydata, nbest = 1, method = "forward")
## 247 Variables (and intercept)
## Forced in Forced out
## ldesemp FALSE FALSE
## sector FALSE FALSE
## ambito FALSE FALSE
## ap01_01 FALSE FALSE
## ap01_02 FALSE FALSE
## gender FALSE FALSE
## ap03 FALSE FALSE
## ap04 FALSE FALSE
## ap05 FALSE FALSE
## ap06 FALSE FALSE
## ap07 FALSE FALSE
## ap08_a FALSE FALSE
## ap08_b FALSE FALSE
## ap08_c FALSE FALSE
## ap08_d FALSE FALSE
## ap08_e FALSE FALSE
## ap08_f FALSE FALSE
## ap08_g FALSE FALSE
## ap08_h FALSE FALSE
## ap08_i FALSE FALSE
## ap09 FALSE FALSE
## ap10 FALSE FALSE
## ap11_01 FALSE FALSE
## ap11_02 FALSE FALSE
## ap11_03 FALSE FALSE
## ap11_04 FALSE FALSE
## ap11_05 FALSE FALSE
## ap11_06 FALSE FALSE
## ap11_07 FALSE FALSE
## ap11_08 FALSE FALSE
## ap12 FALSE FALSE
## ap13 FALSE FALSE
## ap14_01 FALSE FALSE
## ap14_02 FALSE FALSE
## ap15 FALSE FALSE
## ap16 FALSE FALSE
## ap17 FALSE FALSE
## ap18_01 FALSE FALSE
## ap18_02 FALSE FALSE
## ap18_03 FALSE FALSE
## ap19 FALSE FALSE
## ap21 FALSE FALSE
## ap22 FALSE FALSE
## ap23_01 FALSE FALSE
## ap23_02 FALSE FALSE
## ap23_03 FALSE FALSE
## ap23_04 FALSE FALSE
## ap23_05 FALSE FALSE
## ap23_06 FALSE FALSE
## ap24 FALSE FALSE
## ap25_01 FALSE FALSE
## ap25_02 FALSE FALSE
## ap25_03 FALSE FALSE
## ap26 FALSE FALSE
## ap27_a FALSE FALSE
## ap27_b FALSE FALSE
## ap27_c FALSE FALSE
## ap27_d FALSE FALSE
## ap27_e FALSE FALSE
## ap27_f FALSE FALSE
## ap28_01 FALSE FALSE
## ap28_02 FALSE FALSE
## ap28_03 FALSE FALSE
## ap28_04 FALSE FALSE
## ap29_01 FALSE FALSE
## ap29_02 FALSE FALSE
## ap29_03 FALSE FALSE
## ap29_04 FALSE FALSE
## ap29_05 FALSE FALSE
## ap29_06 FALSE FALSE
## ap29_07 FALSE FALSE
## ap30 FALSE FALSE
## ap31_01 FALSE FALSE
## ap31_02 FALSE FALSE
## ap31_03 FALSE FALSE
## ap31_04 FALSE FALSE
## ap31_05 FALSE FALSE
## ap31_06 FALSE FALSE
## ap32_a FALSE FALSE
## ap32_b FALSE FALSE
## ap32_c FALSE FALSE
## ap32_d FALSE FALSE
## ap32_e FALSE FALSE
## ap32_f FALSE FALSE
## ap33_01_a FALSE FALSE
## ap33_02_a FALSE FALSE
## ap33_03_a FALSE FALSE
## ap33_04_a FALSE FALSE
## ap33_01_b FALSE FALSE
## ap33_02_b FALSE FALSE
## ap33_03_b FALSE FALSE
## ap33_04_b FALSE FALSE
## ap33_01bis FALSE FALSE
## ap33_02bis FALSE FALSE
## ap33_03bis FALSE FALSE
## ap33_04bis FALSE FALSE
## ap33_05bis FALSE FALSE
## ap33_06bis FALSE FALSE
## ap33_07bis FALSE FALSE
## ap33_08bis FALSE FALSE
## ap33_09bis FALSE FALSE
## ap33_10bis FALSE FALSE
## ap33_11bis FALSE FALSE
## ap34 FALSE FALSE
## ap35_01 FALSE FALSE
## ap35_02 FALSE FALSE
## ap35_03 FALSE FALSE
## ap35_04 FALSE FALSE
## ap35_05 FALSE FALSE
## ap36_a FALSE FALSE
## ap36_b FALSE FALSE
## ap36_c FALSE FALSE
## ap36_d FALSE FALSE
## ap36_e FALSE FALSE
## ap36_f FALSE FALSE
## ap37_a FALSE FALSE
## ap37_b FALSE FALSE
## ap37_c FALSE FALSE
## ap37_d FALSE FALSE
## ap37_e FALSE FALSE
## ap37_f FALSE FALSE
## ap37_g FALSE FALSE
## ap37_h FALSE FALSE
## ap37_i FALSE FALSE
## ap37_j FALSE FALSE
## ap37_k FALSE FALSE
## ap37_l FALSE FALSE
## ap37_m FALSE FALSE
## ap37_n FALSE FALSE
## ap38_a FALSE FALSE
## ap38_b FALSE FALSE
## ap38_c FALSE FALSE
## ap38_d FALSE FALSE
## ap38_e FALSE FALSE
## ap38_f FALSE FALSE
## ap38_g FALSE FALSE
## ap38_h FALSE FALSE
## ap38_i FALSE FALSE
## ap38_j FALSE FALSE
## ap38_k FALSE FALSE
## ap38_l FALSE FALSE
## ap38_m FALSE FALSE
## ap38_n FALSE FALSE
## ap39_01 FALSE FALSE
## ap39_02 FALSE FALSE
## ap39_03 FALSE FALSE
## ap39_04 FALSE FALSE
## ap40_01 FALSE FALSE
## ap40_02 FALSE FALSE
## ap40_03 FALSE FALSE
## ap40_04 FALSE FALSE
## ap40_05 FALSE FALSE
## ap40_06 FALSE FALSE
## ap41_01 FALSE FALSE
## ap41_02 FALSE FALSE
## ap41_03 FALSE FALSE
## ap41_04 FALSE FALSE
## ap41_05 FALSE FALSE
## ap41_06 FALSE FALSE
## ap41_07 FALSE FALSE
## ap41_08 FALSE FALSE
## ap41_09 FALSE FALSE
## ap41_10 FALSE FALSE
## ap41_11 FALSE FALSE
## ap42_01 FALSE FALSE
## ap42_02 FALSE FALSE
## ap42_03 FALSE FALSE
## ap42_04 FALSE FALSE
## ap43_a FALSE FALSE
## ap43_b FALSE FALSE
## ap43_c FALSE FALSE
## ap43_d FALSE FALSE
## ap43_e FALSE FALSE
## ap43_f FALSE FALSE
## ap43_g FALSE FALSE
## ap43_h FALSE FALSE
## ap44_01 FALSE FALSE
## ap44_02 FALSE FALSE
## ap44_03 FALSE FALSE
## ap44_04 FALSE FALSE
## ap44_05 FALSE FALSE
## ap45 FALSE FALSE
## ap46_01 FALSE FALSE
## ap46_02 FALSE FALSE
## ap46_03 FALSE FALSE
## ap46_04 FALSE FALSE
## ap46_05 FALSE FALSE
## ap47_01 FALSE FALSE
## ap47_02 FALSE FALSE
## ap47_03 FALSE FALSE
## ap47_04 FALSE FALSE
## ap47_05 FALSE FALSE
## ap47_06 FALSE FALSE
## ap47_07 FALSE FALSE
## ap47_08 FALSE FALSE
## ap47_09 FALSE FALSE
## ap47_10 FALSE FALSE
## ap47_11 FALSE FALSE
## ap47_12 FALSE FALSE
## ap48_a FALSE FALSE
## ap48_b FALSE FALSE
## ap48_c FALSE FALSE
## ap48_d FALSE FALSE
## ap48_e FALSE FALSE
## ap48_f FALSE FALSE
## ap48_g FALSE FALSE
## ap48_h FALSE FALSE
## ap48_i FALSE FALSE
## ap49_01 FALSE FALSE
## ap49_02 FALSE FALSE
## ap50_01 FALSE FALSE
## ap50_02 FALSE FALSE
## ap50_03 FALSE FALSE
## ap50_04 FALSE FALSE
## ap50_05 FALSE FALSE
## ap51_01 FALSE FALSE
## ap51_02 FALSE FALSE
## ap51_03 FALSE FALSE
## ap51_04 FALSE FALSE
## ap51_05 FALSE FALSE
## ap51_06 FALSE FALSE
## ap51_07 FALSE FALSE
## ap51_08 FALSE FALSE
## ap51_09 FALSE FALSE
## ap51_10 FALSE FALSE
## isocioa FALSE FALSE
## repitencia_dicotomica FALSE FALSE
## jardín FALSE FALSE
## ap37_dicotomica FALSE FALSE
## ap29_01.dico FALSE FALSE
## ap29_02.dico FALSE FALSE
## ap29_03.dico FALSE FALSE
## ap29_04.dico FALSE FALSE
## ap29_05.dico FALSE FALSE
## ap29_06.dico FALSE FALSE
## ap29_07.dico FALSE FALSE
## ap26_rec FALSE FALSE
## trabaja_fuera_hogar FALSE FALSE
## trabaja_fuera_hogar_remunerado FALSE FALSE
## migración FALSE FALSE
## edadA_junio2019 FALSE FALSE
## sobreedad FALSE FALSE
## iinfraestructura FALSE FALSE
## ap42_01rec FALSE FALSE
## ap42_02rec FALSE FALSE
## ap42_03rec FALSE FALSE
## ap42_04rec FALSE FALSE
## 1 subsets of each size up to 8
## Selection Algorithm: forward
## ldesemp sector ambito ap01_01 ap01_02 gender ap03 ap04 ap05 ap06 ap07
## 1 ( 1 ) "*" " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) "*" "*" " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) "*" "*" " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) "*" "*" " " " " " " "*" " " " " " " " " " "
## 5 ( 1 ) "*" "*" " " " " " " "*" " " " " " " " " " "
## 6 ( 1 ) "*" "*" " " " " " " "*" " " " " " " " " " "
## 7 ( 1 ) "*" "*" " " " " " " "*" " " " " " " " " " "
## 8 ( 1 ) "*" "*" " " " " " " "*" " " " " " " " " " "
## ap08_a ap08_b ap08_c ap08_d ap08_e ap08_f ap08_g ap08_h ap08_i ap09
## 1 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## ap10 ap11_01 ap11_02 ap11_03 ap11_04 ap11_05 ap11_06 ap11_07 ap11_08
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap12 ap13 ap14_01 ap14_02 ap15 ap16 ap17 ap18_01 ap18_02 ap18_03 ap19
## 1 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " " " " " "
## ap21 ap22 ap23_01 ap23_02 ap23_03 ap23_04 ap23_05 ap23_06 ap24 ap25_01
## 1 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## ap25_02 ap25_03 ap26 ap27_a ap27_b ap27_c ap27_d ap27_e ap27_f ap28_01
## 1 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " "*" " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " "*" " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " "*" " " " " " " " " " " " " " "
## ap28_02 ap28_03 ap28_04 ap29_01 ap29_02 ap29_03 ap29_04 ap29_05
## 1 ( 1 ) " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " "
## ap29_06 ap29_07 ap30 ap31_01 ap31_02 ap31_03 ap31_04 ap31_05 ap31_06
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap32_a ap32_b ap32_c ap32_d ap32_e ap32_f ap33_01_a ap33_02_a
## 1 ( 1 ) " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " "
## ap33_03_a ap33_04_a ap33_01_b ap33_02_b ap33_03_b ap33_04_b ap33_01bis
## 1 ( 1 ) " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " "
## 7 ( 1 ) "*" " " " " " " " " " " " "
## 8 ( 1 ) "*" " " " " " " " " " " " "
## ap33_02bis ap33_03bis ap33_04bis ap33_05bis ap33_06bis ap33_07bis
## 1 ( 1 ) " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " "
## ap33_08bis ap33_09bis ap33_10bis ap33_11bis ap34 ap35_01 ap35_02
## 1 ( 1 ) " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " "
## ap35_03 ap35_04 ap35_05 ap36_a ap36_b ap36_c ap36_d ap36_e ap36_f
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap37_a ap37_b ap37_c ap37_d ap37_e ap37_f ap37_g ap37_h ap37_i ap37_j
## 1 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## ap37_k ap37_l ap37_m ap37_n ap38_a ap38_b ap38_c ap38_d ap38_e ap38_f
## 1 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " " " "
## ap38_g ap38_h ap38_i ap38_j ap38_k ap38_l ap38_m ap38_n ap39_01
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap39_02 ap39_03 ap39_04 ap40_01 ap40_02 ap40_03 ap40_04 ap40_05
## 1 ( 1 ) " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " "*" " " " " " " " "
## 4 ( 1 ) " " " " " " "*" " " " " " " " "
## 5 ( 1 ) " " " " " " "*" " " " " " " " "
## 6 ( 1 ) " " " " " " "*" " " " " " " " "
## 7 ( 1 ) " " " " " " "*" " " " " " " " "
## 8 ( 1 ) "*" " " " " "*" " " " " " " " "
## ap40_06 ap41_01 ap41_02 ap41_03 ap41_04 ap41_05 ap41_06 ap41_07
## 1 ( 1 ) " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " "
## ap41_08 ap41_09 ap41_10 ap41_11 ap42_01 ap42_02 ap42_03 ap42_04 ap43_a
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap43_b ap43_c ap43_d ap43_e ap43_f ap43_g ap43_h ap44_01 ap44_02
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap44_03 ap44_04 ap44_05 ap45 ap46_01 ap46_02 ap46_03 ap46_04 ap46_05
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap47_01 ap47_02 ap47_03 ap47_04 ap47_05 ap47_06 ap47_07 ap47_08
## 1 ( 1 ) " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " "
## ap47_09 ap47_10 ap47_11 ap47_12 ap48_a ap48_b ap48_c ap48_d ap48_e
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap48_f ap48_g ap48_h ap48_i ap49_01 ap49_02 ap50_01 ap50_02 ap50_03
## 1 ( 1 ) " " " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " " " "
## ap50_04 ap50_05 ap51_01 ap51_02 ap51_03 ap51_04 ap51_05 ap51_06
## 1 ( 1 ) " " " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " " " " " " " "
## ap51_07 ap51_08 ap51_09 ap51_10 isocioa repitencia_dicotomica jardín
## 1 ( 1 ) " " " " " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " "*" " " " "
## 6 ( 1 ) " " " " " " " " "*" " " " "
## 7 ( 1 ) " " " " " " " " "*" " " " "
## 8 ( 1 ) " " " " " " " " "*" " " " "
## ap37_dicotomica ap29_01.dico ap29_02.dico ap29_03.dico ap29_04.dico
## 1 ( 1 ) " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " "
## ap29_05.dico ap29_06.dico ap29_07.dico ap26_rec trabaja_fuera_hogar
## 1 ( 1 ) " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " "
## trabaja_fuera_hogar_remunerado migración edadA_junio2019 sobreedad
## 1 ( 1 ) " " " " " " " "
## 2 ( 1 ) " " " " " " " "
## 3 ( 1 ) " " " " " " " "
## 4 ( 1 ) " " " " " " " "
## 5 ( 1 ) " " " " " " " "
## 6 ( 1 ) " " " " " " " "
## 7 ( 1 ) " " " " " " " "
## 8 ( 1 ) " " " " " " " "
## iinfraestructura ap42_01rec ap42_02rec ap42_03rec ap42_04rec
## 1 ( 1 ) " " " " " " " " " "
## 2 ( 1 ) " " " " " " " " " "
## 3 ( 1 ) " " " " " " " " " "
## 4 ( 1 ) " " " " " " " " " "
## 5 ( 1 ) " " " " " " " " " "
## 6 ( 1 ) " " " " " " " " " "
## 7 ( 1 ) " " " " " " " " " "
## 8 ( 1 ) " " " " " " " " " "
leaps_summary1 <- summary(leaps1)
require(tidyverse);require(ggplot2);require(ggthemes);
## Loading required package: tidyverse
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.3 v purrr 0.3.4
## v tibble 3.1.1 v dplyr 1.0.5
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## Warning: package 'ggplot2' was built under R version 4.0.5
## Warning: package 'tibble' was built under R version 4.0.5
## Warning: package 'tidyr' was built under R version 4.0.4
## Warning: package 'readr' was built under R version 4.0.3
## Warning: package 'dplyr' was built under R version 4.0.4
## Warning: package 'forcats' was built under R version 4.0.3
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
## x dplyr::recode() masks car::recode()
## x purrr::some() masks car::some()
## Loading required package: ggthemes
## Warning: package 'ggthemes' was built under R version 4.0.5
data_frame(Cp = leaps_summary1$cp,
BIC = leaps_summary1$bic,
AdjR2 = leaps_summary1$adjr2) %>%
mutate(id = row_number()) %>%
gather(value_type, value, -id) %>%
ggplot(aes(id, value, col = value_type)) +
geom_line() + geom_point() + ylab('') + xlab('Number of Variables Used') +
facet_wrap(~ value_type, scales = 'free') + scale_x_continuous(breaks = 1:10)
## Warning: `data_frame()` was deprecated in tibble 1.1.0.
## Please use `tibble()` instead.
library(car)
subsets(leaps1, statistic="bic", xlim=c(-100,120), legend = FALSE)
## Warning in abbreviate(object$xnames, minlength = abbrev): abbreviate used with
## non-ASCII chars
## Warning in abbreviate(object$xnames, minlength = abbrev): abbreviate used with
## non-ASCII chars
## Abbreviation
## mdesemp md
## sector sc
## ambito am
## ap01_01 a01_01
## ap01_02 a01_02
## gender g
## ap03 a03
## ap04 a04
## ap05 a05
## ap06 a06
## ap07 a07
## ap08_a ap08_a
## ap08_b ap08_b
## ap08_c ap08_c
## ap08_d ap08_d
## ap08_e ap08_e
## ap08_f ap08_f
## ap08_g ap08_g
## ap08_h ap08_h
## ap08_i ap08_i
## ap09 a09
## ap10 a10
## ap11_01 a11_01
## ap11_02 a11_02
## ap11_03 a11_03
## ap11_04 a11_04
## ap11_05 a11_05
## ap11_06 a11_06
## ap11_07 a11_07
## ap11_08 a11_08
## ap12 a12
## ap13 a13
## ap14_01 a14_01
## ap14_02 a14_02
## ap15 a15
## ap16 a16
## ap17 a17
## ap18_01 a18_01
## ap18_02 a18_02
## ap18_03 a18_03
## ap19 a19
## ap21 a21
## ap22 a22
## ap23_01 a23_01
## ap23_02 a23_02
## ap23_03 a23_03
## ap23_04 a23_04
## ap23_05 a23_05
## ap23_06 a23_06
## ap24 a24
## ap25_01 a25_01
## ap25_02 a25_02
## ap25_03 a25_03
## ap26 ap26
## ap27_a ap27_a
## ap27_b ap27_b
## ap27_c ap27_c
## ap27_d ap27_d
## ap27_e ap27_e
## ap27_f ap27_f
## ap28_01 a28_01
## ap28_02 a28_02
## ap28_03 a28_03
## ap28_04 a28_04
## ap29_01 ap29_01
## ap29_02 ap29_02
## ap29_03 ap29_03
## ap29_04 ap29_04
## ap29_05 ap29_05
## ap29_06 ap29_06
## ap29_07 ap29_07
## ap30 a30
## ap31_01 a31_01
## ap31_02 a31_02
## ap31_03 a31_03
## ap31_04 a31_04
## ap31_05 a31_05
## ap31_06 a31_06
## ap32_a ap32_a
## ap32_b ap32_b
## ap32_c ap32_c
## ap32_d ap32_d
## ap32_e ap32_e
## ap32_f ap32_f
## ap33_01_a ap33_01_a
## ap33_02_a ap33_02_a
## ap33_03_a ap33_03_a
## ap33_04_a ap33_04_a
## ap33_01_b ap33_01_b
## ap33_02_b ap33_02_b
## ap33_03_b ap33_03_b
## ap33_04_b ap33_04_b
## ap33_01bis ap33_01
## ap33_02bis ap33_02
## ap33_03bis ap33_03
## ap33_04bis ap33_04
## ap33_05bis a33_05
## ap33_06bis a33_06
## ap33_07bis a33_07
## ap33_08bis a33_08
## ap33_09bis a33_09
## ap33_10bis a33_10
## ap33_11bis a33_11
## ap34 a34
## ap35_01 a35_01
## ap35_02 a35_02
## ap35_03 a35_03
## ap35_04 a35_04
## ap35_05 a35_05
## ap36_a ap36_a
## ap36_b ap36_b
## ap36_c ap36_c
## ap36_d ap36_d
## ap36_e ap36_e
## ap36_f ap36_f
## ap37_a ap37_a
## ap37_b ap37_b
## ap37_c ap37_c
## ap37_d ap37_d
## ap37_e ap37_e
## ap37_f ap37_f
## ap37_g ap37_g
## ap37_h ap37_h
## ap37_i ap37_i
## ap37_j ap37_j
## ap37_k ap37_k
## ap37_l ap37_l
## ap37_m ap37_m
## ap37_n ap37_n
## ap38_a ap38_a
## ap38_b ap38_b
## ap38_c ap38_c
## ap38_d ap38_d
## ap38_e ap38_e
## ap38_f ap38_f
## ap38_g ap38_g
## ap38_h ap38_h
## ap38_i ap38_i
## ap38_j ap38_j
## ap38_k ap38_k
## ap38_l ap38_l
## ap38_m ap38_m
## ap38_n ap38_n
## ap39_01 a39_01
## ap39_02 a39_02
## ap39_03 a39_03
## ap39_04 a39_04
## ap40_01 a40_01
## ap40_02 a40_02
## ap40_03 a40_03
## ap40_04 a40_04
## ap40_05 a40_05
## ap40_06 a40_06
## ap41_01 a41_01
## ap41_02 a41_02
## ap41_03 a41_03
## ap41_04 a41_04
## ap41_05 a41_05
## ap41_06 a41_06
## ap41_07 a41_07
## ap41_08 a41_08
## ap41_09 a41_09
## ap41_10 a41_10
## ap41_11 a41_11
## ap42_01 ap42_01
## ap42_02 ap42_02
## ap42_03 ap42_03
## ap42_04 ap42_04
## ap43_a ap43_a
## ap43_b ap43_b
## ap43_c ap43_c
## ap43_d ap43_d
## ap43_e ap43_e
## ap43_f ap43_f
## ap43_g ap43_g
## ap43_h ap43_h
## ap44_01 a44_01
## ap44_02 a44_02
## ap44_03 a44_03
## ap44_04 a44_04
## ap44_05 a44_05
## ap45 a45
## ap46_01 a46_01
## ap46_02 a46_02
## ap46_03 a46_03
## ap46_04 a46_04
## ap46_05 a46_05
## ap47_01 a47_01
## ap47_02 a47_02
## ap47_03 a47_03
## ap47_04 a47_04
## ap47_05 a47_05
## ap47_06 a47_06
## ap47_07 a47_07
## ap47_08 a47_08
## ap47_09 a47_09
## ap47_10 a47_10
## ap47_11 a47_11
## ap47_12 a47_12
## ap48_a ap48_a
## ap48_b ap48_b
## ap48_c ap48_c
## ap48_d ap48_d
## ap48_e ap48_e
## ap48_f ap48_f
## ap48_g ap48_g
## ap48_h ap48_h
## ap48_i ap48_i
## ap49_01 a49_01
## ap49_02 a49_02
## ap50_01 a50_01
## ap50_02 a50_02
## ap50_03 a50_03
## ap50_04 a50_04
## ap50_05 a50_05
## ap51_01 a51_01
## ap51_02 a51_02
## ap51_03 a51_03
## ap51_04 a51_04
## ap51_05 a51_05
## ap51_06 a51_06
## ap51_07 a51_07
## ap51_08 a51_08
## ap51_09 a51_09
## ap51_10 a51_1
## isocioa is
## repitencia_dicotomica r
## jardín j
## ap37_dicotomica ap37_dc
## ap29_01.dico a29_01.
## ap29_02.dico a29_02.
## ap29_03.dico a29_03.
## ap29_04.dico a29_04.
## ap29_05.dico a29_05.
## ap29_06.dico a29_06.
## ap29_07.dico a29_07.
## ap26_rec a26_
## trabaja_fuera_hogar tr__
## trabaja_fuera_hogar_remunerado t___
## migración mg
## edadA_junio2019 e
## sobreedad sb
## iinfraestructura in
## ap42_01rec ap42_01r
## ap42_02rec ap42_02r
## ap42_03rec ap42_03r
## ap42_04rec ap42_04r
subsets(leaps1, statistic="cp", xlim=c(-100,120), legend = FALSE)
## Warning in abbreviate(object$xnames, minlength = abbrev): abbreviate used with
## non-ASCII chars
## Warning in abbreviate(object$xnames, minlength = abbrev): abbreviate used with
## non-ASCII chars
## Abbreviation
## mdesemp md
## sector sc
## ambito am
## ap01_01 a01_01
## ap01_02 a01_02
## gender g
## ap03 a03
## ap04 a04
## ap05 a05
## ap06 a06
## ap07 a07
## ap08_a ap08_a
## ap08_b ap08_b
## ap08_c ap08_c
## ap08_d ap08_d
## ap08_e ap08_e
## ap08_f ap08_f
## ap08_g ap08_g
## ap08_h ap08_h
## ap08_i ap08_i
## ap09 a09
## ap10 a10
## ap11_01 a11_01
## ap11_02 a11_02
## ap11_03 a11_03
## ap11_04 a11_04
## ap11_05 a11_05
## ap11_06 a11_06
## ap11_07 a11_07
## ap11_08 a11_08
## ap12 a12
## ap13 a13
## ap14_01 a14_01
## ap14_02 a14_02
## ap15 a15
## ap16 a16
## ap17 a17
## ap18_01 a18_01
## ap18_02 a18_02
## ap18_03 a18_03
## ap19 a19
## ap21 a21
## ap22 a22
## ap23_01 a23_01
## ap23_02 a23_02
## ap23_03 a23_03
## ap23_04 a23_04
## ap23_05 a23_05
## ap23_06 a23_06
## ap24 a24
## ap25_01 a25_01
## ap25_02 a25_02
## ap25_03 a25_03
## ap26 ap26
## ap27_a ap27_a
## ap27_b ap27_b
## ap27_c ap27_c
## ap27_d ap27_d
## ap27_e ap27_e
## ap27_f ap27_f
## ap28_01 a28_01
## ap28_02 a28_02
## ap28_03 a28_03
## ap28_04 a28_04
## ap29_01 ap29_01
## ap29_02 ap29_02
## ap29_03 ap29_03
## ap29_04 ap29_04
## ap29_05 ap29_05
## ap29_06 ap29_06
## ap29_07 ap29_07
## ap30 a30
## ap31_01 a31_01
## ap31_02 a31_02
## ap31_03 a31_03
## ap31_04 a31_04
## ap31_05 a31_05
## ap31_06 a31_06
## ap32_a ap32_a
## ap32_b ap32_b
## ap32_c ap32_c
## ap32_d ap32_d
## ap32_e ap32_e
## ap32_f ap32_f
## ap33_01_a ap33_01_a
## ap33_02_a ap33_02_a
## ap33_03_a ap33_03_a
## ap33_04_a ap33_04_a
## ap33_01_b ap33_01_b
## ap33_02_b ap33_02_b
## ap33_03_b ap33_03_b
## ap33_04_b ap33_04_b
## ap33_01bis ap33_01
## ap33_02bis ap33_02
## ap33_03bis ap33_03
## ap33_04bis ap33_04
## ap33_05bis a33_05
## ap33_06bis a33_06
## ap33_07bis a33_07
## ap33_08bis a33_08
## ap33_09bis a33_09
## ap33_10bis a33_10
## ap33_11bis a33_11
## ap34 a34
## ap35_01 a35_01
## ap35_02 a35_02
## ap35_03 a35_03
## ap35_04 a35_04
## ap35_05 a35_05
## ap36_a ap36_a
## ap36_b ap36_b
## ap36_c ap36_c
## ap36_d ap36_d
## ap36_e ap36_e
## ap36_f ap36_f
## ap37_a ap37_a
## ap37_b ap37_b
## ap37_c ap37_c
## ap37_d ap37_d
## ap37_e ap37_e
## ap37_f ap37_f
## ap37_g ap37_g
## ap37_h ap37_h
## ap37_i ap37_i
## ap37_j ap37_j
## ap37_k ap37_k
## ap37_l ap37_l
## ap37_m ap37_m
## ap37_n ap37_n
## ap38_a ap38_a
## ap38_b ap38_b
## ap38_c ap38_c
## ap38_d ap38_d
## ap38_e ap38_e
## ap38_f ap38_f
## ap38_g ap38_g
## ap38_h ap38_h
## ap38_i ap38_i
## ap38_j ap38_j
## ap38_k ap38_k
## ap38_l ap38_l
## ap38_m ap38_m
## ap38_n ap38_n
## ap39_01 a39_01
## ap39_02 a39_02
## ap39_03 a39_03
## ap39_04 a39_04
## ap40_01 a40_01
## ap40_02 a40_02
## ap40_03 a40_03
## ap40_04 a40_04
## ap40_05 a40_05
## ap40_06 a40_06
## ap41_01 a41_01
## ap41_02 a41_02
## ap41_03 a41_03
## ap41_04 a41_04
## ap41_05 a41_05
## ap41_06 a41_06
## ap41_07 a41_07
## ap41_08 a41_08
## ap41_09 a41_09
## ap41_10 a41_10
## ap41_11 a41_11
## ap42_01 ap42_01
## ap42_02 ap42_02
## ap42_03 ap42_03
## ap42_04 ap42_04
## ap43_a ap43_a
## ap43_b ap43_b
## ap43_c ap43_c
## ap43_d ap43_d
## ap43_e ap43_e
## ap43_f ap43_f
## ap43_g ap43_g
## ap43_h ap43_h
## ap44_01 a44_01
## ap44_02 a44_02
## ap44_03 a44_03
## ap44_04 a44_04
## ap44_05 a44_05
## ap45 a45
## ap46_01 a46_01
## ap46_02 a46_02
## ap46_03 a46_03
## ap46_04 a46_04
## ap46_05 a46_05
## ap47_01 a47_01
## ap47_02 a47_02
## ap47_03 a47_03
## ap47_04 a47_04
## ap47_05 a47_05
## ap47_06 a47_06
## ap47_07 a47_07
## ap47_08 a47_08
## ap47_09 a47_09
## ap47_10 a47_10
## ap47_11 a47_11
## ap47_12 a47_12
## ap48_a ap48_a
## ap48_b ap48_b
## ap48_c ap48_c
## ap48_d ap48_d
## ap48_e ap48_e
## ap48_f ap48_f
## ap48_g ap48_g
## ap48_h ap48_h
## ap48_i ap48_i
## ap49_01 a49_01
## ap49_02 a49_02
## ap50_01 a50_01
## ap50_02 a50_02
## ap50_03 a50_03
## ap50_04 a50_04
## ap50_05 a50_05
## ap51_01 a51_01
## ap51_02 a51_02
## ap51_03 a51_03
## ap51_04 a51_04
## ap51_05 a51_05
## ap51_06 a51_06
## ap51_07 a51_07
## ap51_08 a51_08
## ap51_09 a51_09
## ap51_10 a51_1
## isocioa is
## repitencia_dicotomica r
## jardín j
## ap37_dicotomica ap37_dc
## ap29_01.dico a29_01.
## ap29_02.dico a29_02.
## ap29_03.dico a29_03.
## ap29_04.dico a29_04.
## ap29_05.dico a29_05.
## ap29_06.dico a29_06.
## ap29_07.dico a29_07.
## ap26_rec a26_
## trabaja_fuera_hogar tr__
## trabaja_fuera_hogar_remunerado t___
## migración mg
## edadA_junio2019 e
## sobreedad sb
## iinfraestructura in
## ap42_01rec ap42_01r
## ap42_02rec ap42_02r
## ap42_03rec ap42_03r
## ap42_04rec ap42_04r
subsets(leaps1, statistic="adjr2", xlim=c(-100,100), legend=FALSE)
## Warning in abbreviate(object$xnames, minlength = abbrev): abbreviate used with
## non-ASCII chars
## Warning in abbreviate(object$xnames, minlength = abbrev): abbreviate used with
## non-ASCII chars
## Abbreviation
## mdesemp md
## sector sc
## ambito am
## ap01_01 a01_01
## ap01_02 a01_02
## gender g
## ap03 a03
## ap04 a04
## ap05 a05
## ap06 a06
## ap07 a07
## ap08_a ap08_a
## ap08_b ap08_b
## ap08_c ap08_c
## ap08_d ap08_d
## ap08_e ap08_e
## ap08_f ap08_f
## ap08_g ap08_g
## ap08_h ap08_h
## ap08_i ap08_i
## ap09 a09
## ap10 a10
## ap11_01 a11_01
## ap11_02 a11_02
## ap11_03 a11_03
## ap11_04 a11_04
## ap11_05 a11_05
## ap11_06 a11_06
## ap11_07 a11_07
## ap11_08 a11_08
## ap12 a12
## ap13 a13
## ap14_01 a14_01
## ap14_02 a14_02
## ap15 a15
## ap16 a16
## ap17 a17
## ap18_01 a18_01
## ap18_02 a18_02
## ap18_03 a18_03
## ap19 a19
## ap21 a21
## ap22 a22
## ap23_01 a23_01
## ap23_02 a23_02
## ap23_03 a23_03
## ap23_04 a23_04
## ap23_05 a23_05
## ap23_06 a23_06
## ap24 a24
## ap25_01 a25_01
## ap25_02 a25_02
## ap25_03 a25_03
## ap26 ap26
## ap27_a ap27_a
## ap27_b ap27_b
## ap27_c ap27_c
## ap27_d ap27_d
## ap27_e ap27_e
## ap27_f ap27_f
## ap28_01 a28_01
## ap28_02 a28_02
## ap28_03 a28_03
## ap28_04 a28_04
## ap29_01 ap29_01
## ap29_02 ap29_02
## ap29_03 ap29_03
## ap29_04 ap29_04
## ap29_05 ap29_05
## ap29_06 ap29_06
## ap29_07 ap29_07
## ap30 a30
## ap31_01 a31_01
## ap31_02 a31_02
## ap31_03 a31_03
## ap31_04 a31_04
## ap31_05 a31_05
## ap31_06 a31_06
## ap32_a ap32_a
## ap32_b ap32_b
## ap32_c ap32_c
## ap32_d ap32_d
## ap32_e ap32_e
## ap32_f ap32_f
## ap33_01_a ap33_01_a
## ap33_02_a ap33_02_a
## ap33_03_a ap33_03_a
## ap33_04_a ap33_04_a
## ap33_01_b ap33_01_b
## ap33_02_b ap33_02_b
## ap33_03_b ap33_03_b
## ap33_04_b ap33_04_b
## ap33_01bis ap33_01
## ap33_02bis ap33_02
## ap33_03bis ap33_03
## ap33_04bis ap33_04
## ap33_05bis a33_05
## ap33_06bis a33_06
## ap33_07bis a33_07
## ap33_08bis a33_08
## ap33_09bis a33_09
## ap33_10bis a33_10
## ap33_11bis a33_11
## ap34 a34
## ap35_01 a35_01
## ap35_02 a35_02
## ap35_03 a35_03
## ap35_04 a35_04
## ap35_05 a35_05
## ap36_a ap36_a
## ap36_b ap36_b
## ap36_c ap36_c
## ap36_d ap36_d
## ap36_e ap36_e
## ap36_f ap36_f
## ap37_a ap37_a
## ap37_b ap37_b
## ap37_c ap37_c
## ap37_d ap37_d
## ap37_e ap37_e
## ap37_f ap37_f
## ap37_g ap37_g
## ap37_h ap37_h
## ap37_i ap37_i
## ap37_j ap37_j
## ap37_k ap37_k
## ap37_l ap37_l
## ap37_m ap37_m
## ap37_n ap37_n
## ap38_a ap38_a
## ap38_b ap38_b
## ap38_c ap38_c
## ap38_d ap38_d
## ap38_e ap38_e
## ap38_f ap38_f
## ap38_g ap38_g
## ap38_h ap38_h
## ap38_i ap38_i
## ap38_j ap38_j
## ap38_k ap38_k
## ap38_l ap38_l
## ap38_m ap38_m
## ap38_n ap38_n
## ap39_01 a39_01
## ap39_02 a39_02
## ap39_03 a39_03
## ap39_04 a39_04
## ap40_01 a40_01
## ap40_02 a40_02
## ap40_03 a40_03
## ap40_04 a40_04
## ap40_05 a40_05
## ap40_06 a40_06
## ap41_01 a41_01
## ap41_02 a41_02
## ap41_03 a41_03
## ap41_04 a41_04
## ap41_05 a41_05
## ap41_06 a41_06
## ap41_07 a41_07
## ap41_08 a41_08
## ap41_09 a41_09
## ap41_10 a41_10
## ap41_11 a41_11
## ap42_01 ap42_01
## ap42_02 ap42_02
## ap42_03 ap42_03
## ap42_04 ap42_04
## ap43_a ap43_a
## ap43_b ap43_b
## ap43_c ap43_c
## ap43_d ap43_d
## ap43_e ap43_e
## ap43_f ap43_f
## ap43_g ap43_g
## ap43_h ap43_h
## ap44_01 a44_01
## ap44_02 a44_02
## ap44_03 a44_03
## ap44_04 a44_04
## ap44_05 a44_05
## ap45 a45
## ap46_01 a46_01
## ap46_02 a46_02
## ap46_03 a46_03
## ap46_04 a46_04
## ap46_05 a46_05
## ap47_01 a47_01
## ap47_02 a47_02
## ap47_03 a47_03
## ap47_04 a47_04
## ap47_05 a47_05
## ap47_06 a47_06
## ap47_07 a47_07
## ap47_08 a47_08
## ap47_09 a47_09
## ap47_10 a47_10
## ap47_11 a47_11
## ap47_12 a47_12
## ap48_a ap48_a
## ap48_b ap48_b
## ap48_c ap48_c
## ap48_d ap48_d
## ap48_e ap48_e
## ap48_f ap48_f
## ap48_g ap48_g
## ap48_h ap48_h
## ap48_i ap48_i
## ap49_01 a49_01
## ap49_02 a49_02
## ap50_01 a50_01
## ap50_02 a50_02
## ap50_03 a50_03
## ap50_04 a50_04
## ap50_05 a50_05
## ap51_01 a51_01
## ap51_02 a51_02
## ap51_03 a51_03
## ap51_04 a51_04
## ap51_05 a51_05
## ap51_06 a51_06
## ap51_07 a51_07
## ap51_08 a51_08
## ap51_09 a51_09
## ap51_10 a51_1
## isocioa is
## repitencia_dicotomica r
## jardín j
## ap37_dicotomica ap37_dc
## ap29_01.dico a29_01.
## ap29_02.dico a29_02.
## ap29_03.dico a29_03.
## ap29_04.dico a29_04.
## ap29_05.dico a29_05.
## ap29_06.dico a29_06.
## ap29_07.dico a29_07.
## ap26_rec a26_
## trabaja_fuera_hogar tr__
## trabaja_fuera_hogar_remunerado t___
## migración mg
## edadA_junio2019 e
## sobreedad sb
## iinfraestructura in
## ap42_01rec ap42_01r
## ap42_02rec ap42_02r
## ap42_03rec ap42_03r
## ap42_04rec ap42_04r
leaps_summary2 <- summary(leaps2)
data_frame(Cp = leaps_summary2$cp,
BIC = leaps_summary2$bic,
AdjR2 = leaps_summary2$adjr2) %>%
mutate(id = row_number()) %>%
gather(value_type, value, -id) %>%
ggplot(aes(id, value, col = value_type)) +
geom_line() + geom_point() + ylab('') + xlab('Number of Variables Used') +
facet_wrap(~ value_type, scales = 'free') + scale_x_continuous(breaks = 1:10)
library(car)
subsets(leaps2, statistic="bic", xlim=c(-100,120), ylim=c(-13500,-9300), legend = FALSE)
## Warning in abbreviate(object$xnames, minlength = abbrev): abbreviate used with
## non-ASCII chars
## Abbreviation
## ldesemp l
## sector sc
## ambito am
## ap01_01 a01_01
## ap01_02 a01_02
## gender g
## ap03 a03
## ap04 a04
## ap05 a05
## ap06 a06
## ap07 a07
## ap08_a ap08_a
## ap08_b ap08_b
## ap08_c ap08_c
## ap08_d ap08_d
## ap08_e ap08_e
## ap08_f ap08_f
## ap08_g ap08_g
## ap08_h ap08_h
## ap08_i ap08_i
## ap09 a09
## ap10 a10
## ap11_01 a11_01
## ap11_02 a11_02
## ap11_03 a11_03
## ap11_04 a11_04
## ap11_05 a11_05
## ap11_06 a11_06
## ap11_07 a11_07
## ap11_08 a11_08
## ap12 a12
## ap13 a13
## ap14_01 a14_01
## ap14_02 a14_02
## ap15 a15
## ap16 a16
## ap17 a17
## ap18_01 a18_01
## ap18_02 a18_02
## ap18_03 a18_03
## ap19 a19
## ap21 a21
## ap22 a22
## ap23_01 a23_01
## ap23_02 a23_02
## ap23_03 a23_03
## ap23_04 a23_04
## ap23_05 a23_05
## ap23_06 a23_06
## ap24 a24
## ap25_01 a25_01
## ap25_02 a25_02
## ap25_03 a25_03
## ap26 ap26
## ap27_a ap27_a
## ap27_b ap27_b
## ap27_c ap27_c
## ap27_d ap27_d
## ap27_e ap27_e
## ap27_f ap27_f
## ap28_01 a28_01
## ap28_02 a28_02
## ap28_03 a28_03
## ap28_04 a28_04
## ap29_01 ap29_01
## ap29_02 ap29_02
## ap29_03 ap29_03
## ap29_04 ap29_04
## ap29_05 ap29_05
## ap29_06 ap29_06
## ap29_07 ap29_07
## ap30 a30
## ap31_01 a31_01
## ap31_02 a31_02
## ap31_03 a31_03
## ap31_04 a31_04
## ap31_05 a31_05
## ap31_06 a31_06
## ap32_a ap32_a
## ap32_b ap32_b
## ap32_c ap32_c
## ap32_d ap32_d
## ap32_e ap32_e
## ap32_f ap32_f
## ap33_01_a ap33_01_a
## ap33_02_a ap33_02_a
## ap33_03_a ap33_03_a
## ap33_04_a ap33_04_a
## ap33_01_b ap33_01_b
## ap33_02_b ap33_02_b
## ap33_03_b ap33_03_b
## ap33_04_b ap33_04_b
## ap33_01bis ap33_01
## ap33_02bis ap33_02
## ap33_03bis ap33_03
## ap33_04bis ap33_04
## ap33_05bis a33_05
## ap33_06bis a33_06
## ap33_07bis a33_07
## ap33_08bis a33_08
## ap33_09bis a33_09
## ap33_10bis a33_10
## ap33_11bis a33_11
## ap34 a34
## ap35_01 a35_01
## ap35_02 a35_02
## ap35_03 a35_03
## ap35_04 a35_04
## ap35_05 a35_05
## ap36_a ap36_a
## ap36_b ap36_b
## ap36_c ap36_c
## ap36_d ap36_d
## ap36_e ap36_e
## ap36_f ap36_f
## ap37_a ap37_a
## ap37_b ap37_b
## ap37_c ap37_c
## ap37_d ap37_d
## ap37_e ap37_e
## ap37_f ap37_f
## ap37_g ap37_g
## ap37_h ap37_h
## ap37_i ap37_i
## ap37_j ap37_j
## ap37_k ap37_k
## ap37_l ap37_l
## ap37_m ap37_m
## ap37_n ap37_n
## ap38_a ap38_a
## ap38_b ap38_b
## ap38_c ap38_c
## ap38_d ap38_d
## ap38_e ap38_e
## ap38_f ap38_f
## ap38_g ap38_g
## ap38_h ap38_h
## ap38_i ap38_i
## ap38_j ap38_j
## ap38_k ap38_k
## ap38_l ap38_l
## ap38_m ap38_m
## ap38_n ap38_n
## ap39_01 a39_01
## ap39_02 a39_02
## ap39_03 a39_03
## ap39_04 a39_04
## ap40_01 a40_01
## ap40_02 a40_02
## ap40_03 a40_03
## ap40_04 a40_04
## ap40_05 a40_05
## ap40_06 a40_06
## ap41_01 a41_01
## ap41_02 a41_02
## ap41_03 a41_03
## ap41_04 a41_04
## ap41_05 a41_05
## ap41_06 a41_06
## ap41_07 a41_07
## ap41_08 a41_08
## ap41_09 a41_09
## ap41_10 a41_10
## ap41_11 a41_11
## ap42_01 ap42_01
## ap42_02 ap42_02
## ap42_03 ap42_03
## ap42_04 ap42_04
## ap43_a ap43_a
## ap43_b ap43_b
## ap43_c ap43_c
## ap43_d ap43_d
## ap43_e ap43_e
## ap43_f ap43_f
## ap43_g ap43_g
## ap43_h ap43_h
## ap44_01 a44_01
## ap44_02 a44_02
## ap44_03 a44_03
## ap44_04 a44_04
## ap44_05 a44_05
## ap45 a45
## ap46_01 a46_01
## ap46_02 a46_02
## ap46_03 a46_03
## ap46_04 a46_04
## ap46_05 a46_05
## ap47_01 a47_01
## ap47_02 a47_02
## ap47_03 a47_03
## ap47_04 a47_04
## ap47_05 a47_05
## ap47_06 a47_06
## ap47_07 a47_07
## ap47_08 a47_08
## ap47_09 a47_09
## ap47_10 a47_10
## ap47_11 a47_11
## ap47_12 a47_12
## ap48_a ap48_a
## ap48_b ap48_b
## ap48_c ap48_c
## ap48_d ap48_d
## ap48_e ap48_e
## ap48_f ap48_f
## ap48_g ap48_g
## ap48_h ap48_h
## ap48_i ap48_i
## ap49_01 a49_01
## ap49_02 a49_02
## ap50_01 a50_01
## ap50_02 a50_02
## ap50_03 a50_03
## ap50_04 a50_04
## ap50_05 a50_05
## ap51_01 a51_01
## ap51_02 a51_02
## ap51_03 a51_03
## ap51_04 a51_04
## ap51_05 a51_05
## ap51_06 a51_06
## ap51_07 a51_07
## ap51_08 a51_08
## ap51_09 a51_09
## ap51_10 a51_1
## isocioa is
## repitencia_dicotomica r
## jardín j
## ap37_dicotomica ap37_dc
## ap29_01.dico a29_01.
## ap29_02.dico a29_02.
## ap29_03.dico a29_03.
## ap29_04.dico a29_04.
## ap29_05.dico a29_05.
## ap29_06.dico a29_06.
## ap29_07.dico a29_07.
## ap26_rec a26_
## trabaja_fuera_hogar tr__
## trabaja_fuera_hogar_remunerado t___
## migración m
## edadA_junio2019 e
## sobreedad sb
## iinfraestructura in
## ap42_01rec ap42_01r
## ap42_02rec ap42_02r
## ap42_03rec ap42_03r
## ap42_04rec ap42_04r
subsets(leaps2, statistic="cp", xlim=c(-100,120), legend = FALSE)
## Warning in abbreviate(object$xnames, minlength = abbrev): abbreviate used with
## non-ASCII chars
## Abbreviation
## ldesemp l
## sector sc
## ambito am
## ap01_01 a01_01
## ap01_02 a01_02
## gender g
## ap03 a03
## ap04 a04
## ap05 a05
## ap06 a06
## ap07 a07
## ap08_a ap08_a
## ap08_b ap08_b
## ap08_c ap08_c
## ap08_d ap08_d
## ap08_e ap08_e
## ap08_f ap08_f
## ap08_g ap08_g
## ap08_h ap08_h
## ap08_i ap08_i
## ap09 a09
## ap10 a10
## ap11_01 a11_01
## ap11_02 a11_02
## ap11_03 a11_03
## ap11_04 a11_04
## ap11_05 a11_05
## ap11_06 a11_06
## ap11_07 a11_07
## ap11_08 a11_08
## ap12 a12
## ap13 a13
## ap14_01 a14_01
## ap14_02 a14_02
## ap15 a15
## ap16 a16
## ap17 a17
## ap18_01 a18_01
## ap18_02 a18_02
## ap18_03 a18_03
## ap19 a19
## ap21 a21
## ap22 a22
## ap23_01 a23_01
## ap23_02 a23_02
## ap23_03 a23_03
## ap23_04 a23_04
## ap23_05 a23_05
## ap23_06 a23_06
## ap24 a24
## ap25_01 a25_01
## ap25_02 a25_02
## ap25_03 a25_03
## ap26 ap26
## ap27_a ap27_a
## ap27_b ap27_b
## ap27_c ap27_c
## ap27_d ap27_d
## ap27_e ap27_e
## ap27_f ap27_f
## ap28_01 a28_01
## ap28_02 a28_02
## ap28_03 a28_03
## ap28_04 a28_04
## ap29_01 ap29_01
## ap29_02 ap29_02
## ap29_03 ap29_03
## ap29_04 ap29_04
## ap29_05 ap29_05
## ap29_06 ap29_06
## ap29_07 ap29_07
## ap30 a30
## ap31_01 a31_01
## ap31_02 a31_02
## ap31_03 a31_03
## ap31_04 a31_04
## ap31_05 a31_05
## ap31_06 a31_06
## ap32_a ap32_a
## ap32_b ap32_b
## ap32_c ap32_c
## ap32_d ap32_d
## ap32_e ap32_e
## ap32_f ap32_f
## ap33_01_a ap33_01_a
## ap33_02_a ap33_02_a
## ap33_03_a ap33_03_a
## ap33_04_a ap33_04_a
## ap33_01_b ap33_01_b
## ap33_02_b ap33_02_b
## ap33_03_b ap33_03_b
## ap33_04_b ap33_04_b
## ap33_01bis ap33_01
## ap33_02bis ap33_02
## ap33_03bis ap33_03
## ap33_04bis ap33_04
## ap33_05bis a33_05
## ap33_06bis a33_06
## ap33_07bis a33_07
## ap33_08bis a33_08
## ap33_09bis a33_09
## ap33_10bis a33_10
## ap33_11bis a33_11
## ap34 a34
## ap35_01 a35_01
## ap35_02 a35_02
## ap35_03 a35_03
## ap35_04 a35_04
## ap35_05 a35_05
## ap36_a ap36_a
## ap36_b ap36_b
## ap36_c ap36_c
## ap36_d ap36_d
## ap36_e ap36_e
## ap36_f ap36_f
## ap37_a ap37_a
## ap37_b ap37_b
## ap37_c ap37_c
## ap37_d ap37_d
## ap37_e ap37_e
## ap37_f ap37_f
## ap37_g ap37_g
## ap37_h ap37_h
## ap37_i ap37_i
## ap37_j ap37_j
## ap37_k ap37_k
## ap37_l ap37_l
## ap37_m ap37_m
## ap37_n ap37_n
## ap38_a ap38_a
## ap38_b ap38_b
## ap38_c ap38_c
## ap38_d ap38_d
## ap38_e ap38_e
## ap38_f ap38_f
## ap38_g ap38_g
## ap38_h ap38_h
## ap38_i ap38_i
## ap38_j ap38_j
## ap38_k ap38_k
## ap38_l ap38_l
## ap38_m ap38_m
## ap38_n ap38_n
## ap39_01 a39_01
## ap39_02 a39_02
## ap39_03 a39_03
## ap39_04 a39_04
## ap40_01 a40_01
## ap40_02 a40_02
## ap40_03 a40_03
## ap40_04 a40_04
## ap40_05 a40_05
## ap40_06 a40_06
## ap41_01 a41_01
## ap41_02 a41_02
## ap41_03 a41_03
## ap41_04 a41_04
## ap41_05 a41_05
## ap41_06 a41_06
## ap41_07 a41_07
## ap41_08 a41_08
## ap41_09 a41_09
## ap41_10 a41_10
## ap41_11 a41_11
## ap42_01 ap42_01
## ap42_02 ap42_02
## ap42_03 ap42_03
## ap42_04 ap42_04
## ap43_a ap43_a
## ap43_b ap43_b
## ap43_c ap43_c
## ap43_d ap43_d
## ap43_e ap43_e
## ap43_f ap43_f
## ap43_g ap43_g
## ap43_h ap43_h
## ap44_01 a44_01
## ap44_02 a44_02
## ap44_03 a44_03
## ap44_04 a44_04
## ap44_05 a44_05
## ap45 a45
## ap46_01 a46_01
## ap46_02 a46_02
## ap46_03 a46_03
## ap46_04 a46_04
## ap46_05 a46_05
## ap47_01 a47_01
## ap47_02 a47_02
## ap47_03 a47_03
## ap47_04 a47_04
## ap47_05 a47_05
## ap47_06 a47_06
## ap47_07 a47_07
## ap47_08 a47_08
## ap47_09 a47_09
## ap47_10 a47_10
## ap47_11 a47_11
## ap47_12 a47_12
## ap48_a ap48_a
## ap48_b ap48_b
## ap48_c ap48_c
## ap48_d ap48_d
## ap48_e ap48_e
## ap48_f ap48_f
## ap48_g ap48_g
## ap48_h ap48_h
## ap48_i ap48_i
## ap49_01 a49_01
## ap49_02 a49_02
## ap50_01 a50_01
## ap50_02 a50_02
## ap50_03 a50_03
## ap50_04 a50_04
## ap50_05 a50_05
## ap51_01 a51_01
## ap51_02 a51_02
## ap51_03 a51_03
## ap51_04 a51_04
## ap51_05 a51_05
## ap51_06 a51_06
## ap51_07 a51_07
## ap51_08 a51_08
## ap51_09 a51_09
## ap51_10 a51_1
## isocioa is
## repitencia_dicotomica r
## jardín j
## ap37_dicotomica ap37_dc
## ap29_01.dico a29_01.
## ap29_02.dico a29_02.
## ap29_03.dico a29_03.
## ap29_04.dico a29_04.
## ap29_05.dico a29_05.
## ap29_06.dico a29_06.
## ap29_07.dico a29_07.
## ap26_rec a26_
## trabaja_fuera_hogar tr__
## trabaja_fuera_hogar_remunerado t___
## migración m
## edadA_junio2019 e
## sobreedad sb
## iinfraestructura in
## ap42_01rec ap42_01r
## ap42_02rec ap42_02r
## ap42_03rec ap42_03r
## ap42_04rec ap42_04r
subsets(leaps2, statistic="adjr2", xlim=c(-100,100), legend=FALSE)
## Warning in abbreviate(object$xnames, minlength = abbrev): abbreviate used with
## non-ASCII chars
## Abbreviation
## ldesemp l
## sector sc
## ambito am
## ap01_01 a01_01
## ap01_02 a01_02
## gender g
## ap03 a03
## ap04 a04
## ap05 a05
## ap06 a06
## ap07 a07
## ap08_a ap08_a
## ap08_b ap08_b
## ap08_c ap08_c
## ap08_d ap08_d
## ap08_e ap08_e
## ap08_f ap08_f
## ap08_g ap08_g
## ap08_h ap08_h
## ap08_i ap08_i
## ap09 a09
## ap10 a10
## ap11_01 a11_01
## ap11_02 a11_02
## ap11_03 a11_03
## ap11_04 a11_04
## ap11_05 a11_05
## ap11_06 a11_06
## ap11_07 a11_07
## ap11_08 a11_08
## ap12 a12
## ap13 a13
## ap14_01 a14_01
## ap14_02 a14_02
## ap15 a15
## ap16 a16
## ap17 a17
## ap18_01 a18_01
## ap18_02 a18_02
## ap18_03 a18_03
## ap19 a19
## ap21 a21
## ap22 a22
## ap23_01 a23_01
## ap23_02 a23_02
## ap23_03 a23_03
## ap23_04 a23_04
## ap23_05 a23_05
## ap23_06 a23_06
## ap24 a24
## ap25_01 a25_01
## ap25_02 a25_02
## ap25_03 a25_03
## ap26 ap26
## ap27_a ap27_a
## ap27_b ap27_b
## ap27_c ap27_c
## ap27_d ap27_d
## ap27_e ap27_e
## ap27_f ap27_f
## ap28_01 a28_01
## ap28_02 a28_02
## ap28_03 a28_03
## ap28_04 a28_04
## ap29_01 ap29_01
## ap29_02 ap29_02
## ap29_03 ap29_03
## ap29_04 ap29_04
## ap29_05 ap29_05
## ap29_06 ap29_06
## ap29_07 ap29_07
## ap30 a30
## ap31_01 a31_01
## ap31_02 a31_02
## ap31_03 a31_03
## ap31_04 a31_04
## ap31_05 a31_05
## ap31_06 a31_06
## ap32_a ap32_a
## ap32_b ap32_b
## ap32_c ap32_c
## ap32_d ap32_d
## ap32_e ap32_e
## ap32_f ap32_f
## ap33_01_a ap33_01_a
## ap33_02_a ap33_02_a
## ap33_03_a ap33_03_a
## ap33_04_a ap33_04_a
## ap33_01_b ap33_01_b
## ap33_02_b ap33_02_b
## ap33_03_b ap33_03_b
## ap33_04_b ap33_04_b
## ap33_01bis ap33_01
## ap33_02bis ap33_02
## ap33_03bis ap33_03
## ap33_04bis ap33_04
## ap33_05bis a33_05
## ap33_06bis a33_06
## ap33_07bis a33_07
## ap33_08bis a33_08
## ap33_09bis a33_09
## ap33_10bis a33_10
## ap33_11bis a33_11
## ap34 a34
## ap35_01 a35_01
## ap35_02 a35_02
## ap35_03 a35_03
## ap35_04 a35_04
## ap35_05 a35_05
## ap36_a ap36_a
## ap36_b ap36_b
## ap36_c ap36_c
## ap36_d ap36_d
## ap36_e ap36_e
## ap36_f ap36_f
## ap37_a ap37_a
## ap37_b ap37_b
## ap37_c ap37_c
## ap37_d ap37_d
## ap37_e ap37_e
## ap37_f ap37_f
## ap37_g ap37_g
## ap37_h ap37_h
## ap37_i ap37_i
## ap37_j ap37_j
## ap37_k ap37_k
## ap37_l ap37_l
## ap37_m ap37_m
## ap37_n ap37_n
## ap38_a ap38_a
## ap38_b ap38_b
## ap38_c ap38_c
## ap38_d ap38_d
## ap38_e ap38_e
## ap38_f ap38_f
## ap38_g ap38_g
## ap38_h ap38_h
## ap38_i ap38_i
## ap38_j ap38_j
## ap38_k ap38_k
## ap38_l ap38_l
## ap38_m ap38_m
## ap38_n ap38_n
## ap39_01 a39_01
## ap39_02 a39_02
## ap39_03 a39_03
## ap39_04 a39_04
## ap40_01 a40_01
## ap40_02 a40_02
## ap40_03 a40_03
## ap40_04 a40_04
## ap40_05 a40_05
## ap40_06 a40_06
## ap41_01 a41_01
## ap41_02 a41_02
## ap41_03 a41_03
## ap41_04 a41_04
## ap41_05 a41_05
## ap41_06 a41_06
## ap41_07 a41_07
## ap41_08 a41_08
## ap41_09 a41_09
## ap41_10 a41_10
## ap41_11 a41_11
## ap42_01 ap42_01
## ap42_02 ap42_02
## ap42_03 ap42_03
## ap42_04 ap42_04
## ap43_a ap43_a
## ap43_b ap43_b
## ap43_c ap43_c
## ap43_d ap43_d
## ap43_e ap43_e
## ap43_f ap43_f
## ap43_g ap43_g
## ap43_h ap43_h
## ap44_01 a44_01
## ap44_02 a44_02
## ap44_03 a44_03
## ap44_04 a44_04
## ap44_05 a44_05
## ap45 a45
## ap46_01 a46_01
## ap46_02 a46_02
## ap46_03 a46_03
## ap46_04 a46_04
## ap46_05 a46_05
## ap47_01 a47_01
## ap47_02 a47_02
## ap47_03 a47_03
## ap47_04 a47_04
## ap47_05 a47_05
## ap47_06 a47_06
## ap47_07 a47_07
## ap47_08 a47_08
## ap47_09 a47_09
## ap47_10 a47_10
## ap47_11 a47_11
## ap47_12 a47_12
## ap48_a ap48_a
## ap48_b ap48_b
## ap48_c ap48_c
## ap48_d ap48_d
## ap48_e ap48_e
## ap48_f ap48_f
## ap48_g ap48_g
## ap48_h ap48_h
## ap48_i ap48_i
## ap49_01 a49_01
## ap49_02 a49_02
## ap50_01 a50_01
## ap50_02 a50_02
## ap50_03 a50_03
## ap50_04 a50_04
## ap50_05 a50_05
## ap51_01 a51_01
## ap51_02 a51_02
## ap51_03 a51_03
## ap51_04 a51_04
## ap51_05 a51_05
## ap51_06 a51_06
## ap51_07 a51_07
## ap51_08 a51_08
## ap51_09 a51_09
## ap51_10 a51_1
## isocioa is
## repitencia_dicotomica r
## jardín j
## ap37_dicotomica ap37_dc
## ap29_01.dico a29_01.
## ap29_02.dico a29_02.
## ap29_03.dico a29_03.
## ap29_04.dico a29_04.
## ap29_05.dico a29_05.
## ap29_06.dico a29_06.
## ap29_07.dico a29_07.
## ap26_rec a26_
## trabaja_fuera_hogar tr__
## trabaja_fuera_hogar_remunerado t___
## migración m
## edadA_junio2019 e
## sobreedad sb
## iinfraestructura in
## ap42_01rec ap42_01r
## ap42_02rec ap42_02r
## ap42_03rec ap42_03r
## ap42_04rec ap42_04r
rightfit_lang=lm(ldesemp~ mdesemp + ap22 + ap39_01 +factor(isocioa) + sobreedad, data=mydata)
summary(rightfit_lang)
##
## Call:
## lm(formula = ldesemp ~ mdesemp + ap22 + ap39_01 + factor(isocioa) +
## sobreedad, data = mydata)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.91814 -0.40730 0.07649 0.62468 2.51955
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.4114056 0.0252469 55.904 <2e-16 ***
## mdesemp 0.4672318 0.0048366 96.603 <2e-16 ***
## ap22 -0.0185926 0.0008372 -22.207 <2e-16 ***
## ap39_01 0.0384708 0.0019996 19.239 <2e-16 ***
## factor(isocioa)1 -0.0282151 0.0263374 -1.071 0.2840
## factor(isocioa)2 0.2190756 0.0239274 9.156 <2e-16 ***
## factor(isocioa)3 0.3601995 0.0250424 14.384 <2e-16 ***
## sobreedad -0.0051384 0.0021680 -2.370 0.0178 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7485 on 33006 degrees of freedom
## (1177 observations deleted due to missingness)
## Multiple R-squared: 0.3192, Adjusted R-squared: 0.319
## F-statistic: 2210 on 7 and 33006 DF, p-value: < 2.2e-16
rightfit_math=lm(mdesemp~ ldesemp + factor(sector)+ factor(gender) +
ap26 + ap39_02 + ap40_01 + factor(isocioa),data=mydata)
summary(rightfit_math)
##
## Call:
## lm(formula = mdesemp ~ ldesemp + factor(sector) + factor(gender) +
## ap26 + ap39_02 + ap40_01 + factor(isocioa), data = mydata)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.25127 -0.50469 0.01578 0.52603 2.61051
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.813066 0.025988 31.286 < 2e-16 ***
## ldesemp 0.439687 0.004720 93.144 < 2e-16 ***
## factor(sector)2 0.312291 0.008758 35.656 < 2e-16 ***
## factor(gender)2 -0.169882 0.008077 -21.032 < 2e-16 ***
## factor(gender)3 -0.134028 0.037599 -3.565 0.000365 ***
## ap26 -0.032972 0.002972 -11.094 < 2e-16 ***
## ap39_02 -0.047744 0.002490 -19.175 < 2e-16 ***
## ap40_01 0.086066 0.002468 34.872 < 2e-16 ***
## factor(isocioa)1 -0.095942 0.025529 -3.758 0.000171 ***
## factor(isocioa)2 0.064344 0.023136 2.781 0.005420 **
## factor(isocioa)3 0.217876 0.024310 8.962 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7201 on 33003 degrees of freedom
## (1177 observations deleted due to missingness)
## Multiple R-squared: 0.3683, Adjusted R-squared: 0.3681
## F-statistic: 1924 on 10 and 33003 DF, p-value: < 2.2e-16
library("rpart")
## Warning: package 'rpart' was built under R version 4.0.5
library("rpart.plot")
## Warning: package 'rpart.plot' was built under R version 4.0.5
library("rattle")
## Warning: package 'rattle' was built under R version 4.0.5
## Loading required package: bitops
## Warning: package 'bitops' was built under R version 4.0.5
## Rattle: A free graphical interface for data science with R.
## Version 5.4.0 Copyright (c) 2006-2020 Togaware Pty Ltd.
## Type 'rattle()' to shake, rattle, and roll your data.
# AER Package (AER: Applied Econometrics with R)
library(AER)
## Warning: package 'AER' was built under R version 4.0.5
## Loading required package: lmtest
## Warning: package 'lmtest' was built under R version 4.0.5
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Loading required package: sandwich
## Warning: package 'sandwich' was built under R version 4.0.5
## Loading required package: survival
tree_base <- subset(mydata, select = c(ldesemp, mdesemp, ap22, isocioa, sobreedad))
names(tree_base)[1] <- "lang_perf"
names(tree_base)[2] <- "math_perf"
names(tree_base)[3] <- "job_pay"
names(tree_base)[4] <- "socioeconom"
names(tree_base)[5] <- "overage"
tree_base <- na.omit(tree_base)
tree_base$lang_perf <- ifelse(tree_base$lang_perf >= "3", 1, 0);
set.seed(1001)
new_tree_base <- tree_base[sample(nrow(tree_base)),]
t_idx <- sample(seq_len(nrow(tree_base)), size = round(0.70 * nrow(tree_base)))
traindata <- new_tree_base[t_idx,]
testdata <- new_tree_base[ - t_idx,]
dtree_lang <- rpart::rpart(formula = lang_perf ~ ., data = traindata, method = "class", control = rpart.control(cp = 0.001)) # complexity parameter
rattle::fancyRpartPlot(dtree_lang, type = 1, main = "Decision tree: Language Performance", caption = "Accomplish at Least Satisfactory Language Performance Level" )
resultdt <- predict(dtree_lang, newdata = testdata, type = "class")
cm_langdt <- table(testdata$lang_perf, resultdt, dnn = c("Actual", "Predicted"))
cm_langdt
## Predicted
## Actual 0 1
## 0 1288 1491
## 1 807 6318
cm_langdt[4] / sum(cm_langdt[, 2])
## [1] 0.8090665
cm_langdt[1] / sum(cm_langdt[, 1])
## [1] 0.6147971
accuracydt <- sum(diag(cm_langdt)) / sum(cm_langdt)
accuracydt
## [1] 0.7679725
# install.packages("party")
library(party)
## Warning: package 'party' was built under R version 4.0.5
## Loading required package: grid
## Loading required package: mvtnorm
## Warning: package 'mvtnorm' was built under R version 4.0.3
## Loading required package: modeltools
## Warning: package 'modeltools' was built under R version 4.0.3
## Loading required package: stats4
##
## Attaching package: 'modeltools'
## The following object is masked from 'package:car':
##
## Predict
## Loading required package: strucchange
## Warning: package 'strucchange' was built under R version 4.0.5
##
## Attaching package: 'strucchange'
## The following object is masked from 'package:stringr':
##
## boundary
cit <- ctree(lang_perf~ ., data = traindata)
plot(cit, main = "Conditional Inference Tree")
cm_langcit = table(testdata$lang_perf, round(predict(cit, newdata = testdata)), dnn = c("Actual", "Predicted"))
cm_langcit
## Predicted
## Actual 0 1
## 0 1161 1618
## 1 706 6419
cm_langcit[4] / sum(cm_langcit[, 2])
## [1] 0.7986811
cm_langcit[1] / sum(cm_langcit[, 1])
## [1] 0.6218532
accuracycit <- sum(diag(cm_langcit)) / sum(cm_langcit)
accuracycit
## [1] 0.7653473
tree_base <- subset(mydata, select = c(mdesemp, ldesemp, sector, gender, ap26,
ap39_02, ap40_01, isocioa))
names(tree_base)[1] <- "math_perf"
names(tree_base)[2] <- "lang_perf"
names(tree_base)[5] <- "absent"
names(tree_base)[6] <- "dif_writing"
names(tree_base)[7] <- "enjoy_math"
names(tree_base)[8] <- "socioeconom"
tree_base <- na.omit(tree_base)
tree_base$math_perf <- ifelse(tree_base$math_perf >= "3", 1, 0);
set.seed(1001)
new_tree_base <- tree_base[sample(nrow(tree_base)),]
t_idx <- sample(seq_len(nrow(tree_base)), size = round(0.70 * nrow(tree_base)))
traindata <- new_tree_base[t_idx,]
testdata <- new_tree_base[ - t_idx,]
dtree_math <- rpart::rpart(formula = math_perf ~ ., data = traindata, method = "class", control = rpart.control(cp = 0.001)) # complexity parameter
rattle::fancyRpartPlot(dtree_math, type = 1, main = "Decision tree: Math Performance", caption = "Accomplish at Least Satisfactory Math Performance Level" )
resultdt <- predict(dtree_math, newdata = testdata, type = "class")
cm_mathdt <- table(testdata$math_perf, resultdt, dnn = c("Actual", "Predicted"))
cm_mathdt
## Predicted
## Actual 0 1
## 0 4965 910
## 1 1418 2611
cm_mathdt[4] / sum(cm_mathdt[, 2])
## [1] 0.7415507
cm_mathdt[1] / sum(cm_mathdt[, 1])
## [1] 0.7778474
accuracydt <- sum(diag(cm_mathdt)) / sum(cm_mathdt)
accuracydt
## [1] 0.7649435
cit <- ctree(math_perf~ ., data = traindata)
plot(cit, main = "Conditional Inference Tree")
cm_mathcit = table(testdata$math_perf, round(predict(cit, newdata = testdata)), dnn = c("Actual", "Predicted"))
cm_mathcit
## Predicted
## Actual 0 1
## 0 5053 822
## 1 1545 2484
cm_mathcit[4] / sum(cm_mathcit[, 2])
## [1] 0.7513612
cm_mathcit[1] / sum(cm_mathcit[, 1])
## [1] 0.7658381
accuracycit <- sum(diag(cm_mathcit)) / sum(cm_mathcit)
accuracycit
## [1] 0.7610057