1 Variable CENSO

Necesitamos calcular las frecuencias a nivel censal de las respuestas correspondientes a la categoría: “tejas o tejuelas de arcilla, metálicas, de cemento, de madera, asfálticas o plásticas” del campo P03B del Censo de viviendas. Recordemos que ésta fué la más alta correlación en relación a los ingresos expandidos (ver punto 1.2 aquí).

1.1 Lectura y filtrado de la tabla censal de viviendas

Leemos la tabla Casen 2017 de viviendas que ya tiene integrada la clave zonal:

tabla_con_clave <- readRDS("censo_viviendas_con_clave_17.rds")
r3_100 <- tabla_con_clave[c(1:100),]
kbl(r3_100) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  kable_paper() %>%
  scroll_box(width = "100%", height = "300px")
REGION PROVINCIA COMUNA DC AREA ZC_LOC ID_ZONA_LOC NVIV P01 P02 P03A P03B P03C P04 P05 CANT_HOG CANT_PER REGION_15R PROVINCIA_15R COMUNA_15R clave
15 152 15202 1 2 6 13225 1 3 1 5 3 5 1 4 1 1 15 152 15202 15202012006
15 152 15202 1 2 6 13225 2 1 3 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 3 1 1 5 3 5 2 3 1 4 15 152 15202 15202012006
15 152 15202 1 2 6 13225 4 1 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 5 3 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 6 3 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 7 3 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 8 3 3 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 9 3 1 5 3 5 1 4 1 4 15 152 15202 15202012006
15 152 15202 1 2 6 13225 10 1 1 5 3 4 1 4 1 1 15 152 15202 15202012006
15 152 15202 1 2 6 13225 11 1 2 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 12 1 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 13 1 1 5 3 4 1 4 1 3 15 152 15202 15202012006
15 152 15202 1 2 6 13225 14 1 3 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 15 1 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 16 1 1 5 3 5 1 3 1 3 15 152 15202 15202012006
15 152 15202 1 2 6 13225 17 1 1 5 3 5 2 4 1 8 15 152 15202 15202012006
15 152 15202 1 2 6 13225 18 3 1 5 3 5 1 1 1 1 15 152 15202 15202012006
15 152 15202 1 2 6 13225 19 3 1 5 3 5 1 3 1 1 15 152 15202 15202012006
15 152 15202 1 2 6 13225 20 1 1 5 3 5 2 1 1 2 15 152 15202 15202012006
15 152 15202 1 2 6 13225 21 1 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 22 1 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 23 3 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 24 1 3 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 25 1 1 5 3 5 1 4 1 2 15 152 15202 15202012006
15 152 15202 1 2 6 13225 26 1 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 27 3 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 28 3 1 5 3 5 1 4 1 5 15 152 15202 15202012006
15 152 15202 1 2 6 13225 29 1 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 30 3 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 31 1 3 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 32 3 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 33 1 1 5 3 5 3 4 1 4 15 152 15202 15202012006
15 152 15202 1 2 6 13225 34 1 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 35 3 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 36 1 1 5 3 5 3 2 1 9 15 152 15202 15202012006
15 152 15202 1 2 6 13225 37 3 3 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 38 1 1 5 3 5 99 4 1 1 15 152 15202 15202012006
15 152 15202 1 2 6 13225 39 1 1 5 3 5 1 4 1 2 15 152 15202 15202012006
15 152 15202 1 2 6 13225 40 1 3 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 41 1 3 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 42 3 3 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 43 3 1 5 3 5 2 1 1 5 15 152 15202 15202012006
15 152 15202 1 2 6 13225 44 1 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 6 13225 45 1 4 98 98 98 98 98 0 0 15 152 15202 15202012006
15 152 15202 1 2 8 13910 1 1 2 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 2 1 3 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 3 1 3 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 4 3 3 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 5 3 1 5 3 5 2 3 1 3 15 152 15202 15202012008
15 152 15202 1 2 8 13910 6 1 2 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 7 1 1 5 99 5 2 4 1 2 15 152 15202 15202012008
15 152 15202 1 2 8 13910 8 3 1 5 3 5 3 3 1 2 15 152 15202 15202012008
15 152 15202 1 2 8 13910 9 3 3 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 10 3 3 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 11 1 4 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 12 1 2 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 13 1 4 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 14 3 3 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 15 1 4 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 16 1 4 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 17 3 2 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 18 1 2 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 19 3 1 99 99 99 99 99 1 1 15 152 15202 15202012008
15 152 15202 1 2 8 13910 20 1 2 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 21 1 1 5 3 5 1 4 1 2 15 152 15202 15202012008
15 152 15202 1 2 8 13910 22 3 1 5 3 5 2 4 1 1 15 152 15202 15202012008
15 152 15202 1 2 8 13910 23 1 4 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 24 3 4 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 25 3 3 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 26 1 2 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 27 1 4 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 28 3 2 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 29 1 3 98 98 98 98 98 0 0 15 152 15202 15202012008
15 152 15202 1 2 8 13910 30 1 1 5 1 4 2 4 1 1 15 152 15202 15202012008
15 152 15202 1 2 12 8394 1 3 4 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 2 3 4 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 3 3 1 5 3 5 2 3 1 4 15 152 15202 15202012012
15 152 15202 1 2 12 8394 4 3 2 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 5 3 3 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 6 3 3 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 7 3 4 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 8 3 2 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 9 3 1 5 3 5 1 4 1 1 15 152 15202 15202012012
15 152 15202 1 2 12 8394 10 3 4 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 11 3 2 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 12 3 4 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 13 3 4 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 14 3 2 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 15 3 2 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 16 3 4 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 17 3 2 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 18 3 2 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 19 3 1 99 99 99 99 99 1 1 15 152 15202 15202012012
15 152 15202 1 2 12 8394 20 3 1 5 3 5 3 99 1 1 15 152 15202 15202012012
15 152 15202 1 2 12 8394 21 3 1 5 99 5 1 4 1 2 15 152 15202 15202012012
15 152 15202 1 2 12 8394 22 3 2 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 23 3 4 98 98 98 98 98 0 0 15 152 15202 15202012012
15 152 15202 1 2 12 8394 24 3 1 5 3 5 1 2 1 2 15 152 15202 15202012012
15 152 15202 1 2 12 8394 25 3 4 98 98 98 98 98 0 0 15 152 15202 15202012012

Despleguemos los códigos de regiones de nuestra tabla:

regiones <- unique(tabla_con_clave$REGION)
regiones
##  [1] 15 14 13 12 11 10  9 16  8  7  6  5  4  3  2  1

Hagamos un subset con la 1:

tabla_con_clave <- filter(tabla_con_clave, tabla_con_clave$REGION == 3) 

1.2 Cálculo de frecuencias

tabla_con_clave_f <- tabla_con_clave[,-c(1,2,4,5,6,7,8,9,10,11,13,14,15,16,17,18,19,20),drop=FALSE] 
names(tabla_con_clave_f)[2] <- "Tipo de techo" 
# Ahora filtramos por Tipo de techo = 1.
tabla_con_clave_ff <- filter(tabla_con_clave_f, tabla_con_clave_f$`Tipo de techo` == 1)
# Determinamos las frecuencias por zona:
b <- tabla_con_clave_ff$clave
c <- tabla_con_clave_ff$`Tipo de techo`
d <- tabla_con_clave_ff$COMUNA
cross_tab =  xtabs( ~ unlist(b) + unlist(c)+ unlist(d))
tabla <- as.data.frame(cross_tab)
d <-tabla[!(tabla$Freq == 0),]
names(d)[1] <- "zona" 
d$anio <- "2017"

Veamos los primeros 100 registros:

r3_100 <- d[c(1:100),]
kbl(r3_100) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  kable_paper() %>%
  scroll_box(width = "100%", height = "300px")
zona unlist.c. unlist.d. Freq anio
1 3101011001 1 3101 59 2017
2 3101021001 1 3101 77 2017
3 3101031001 1 3101 45 2017
4 3101041001 1 3101 91 2017
5 3101051001 1 3101 71 2017
6 3101061001 1 3101 55 2017
7 3101061002 1 3101 12 2017
8 3101061003 1 3101 25 2017
9 3101061004 1 3101 87 2017
10 3101061005 1 3101 75 2017
11 3101061006 1 3101 89 2017
12 3101061007 1 3101 35 2017
13 3101061008 1 3101 30 2017
14 3101061009 1 3101 109 2017
15 3101071001 1 3101 162 2017
16 3101071002 1 3101 162 2017
17 3101081001 1 3101 68 2017
18 3101091001 1 3101 102 2017
19 3101101001 1 3101 2 2017
20 3101102901 1 3101 2 2017
21 3101111001 1 3101 665 2017
22 3101111002 1 3101 187 2017
23 3101111003 1 3101 640 2017
24 3101122013 1 3101 54 2017
25 3101122047 1 3101 1 2017
26 3101122901 1 3101 1 2017
27 3101132901 1 3101 1 2017
28 3101161001 1 3101 186 2017
29 3101161002 1 3101 654 2017
30 3101161003 1 3101 264 2017
31 3101161004 1 3101 334 2017
32 3101162050 1 3101 2 2017
33 3101172013 1 3101 11 2017
34 3101172017 1 3101 18 2017
35 3101172021 1 3101 1 2017
36 3101172026 1 3101 16 2017
37 3101172035 1 3101 15 2017
38 3101172037 1 3101 12 2017
39 3101182901 1 3101 1 2017
40 3101211001 1 3101 367 2017
41 3101211002 1 3101 80 2017
42 3101211003 1 3101 108 2017
43 3101211004 1 3101 169 2017
44 3101211005 1 3101 301 2017
45 3101211006 1 3101 219 2017
46 3101211007 1 3101 248 2017
47 3101222015 1 3101 1 2017
48 3101222048 1 3101 1 2017
49 3101231001 1 3101 16 2017
50 3101231002 1 3101 81 2017
51 3101231003 1 3101 122 2017
52 3101231004 1 3101 81 2017
53 3101231005 1 3101 36 2017
54 3101241001 1 3101 515 2017
55 3101241002 1 3101 719 2017
56 3101241003 1 3101 149 2017
57 3101241004 1 3101 98 2017
58 3101241005 1 3101 287 2017
251 3102011001 1 3102 179 2017
252 3102011002 1 3102 148 2017
253 3102011003 1 3102 228 2017
254 3102011007 1 3102 343 2017
255 3102012001 1 3102 66 2017
256 3102012004 1 3102 2 2017
257 3102022010 1 3102 22 2017
258 3102022901 1 3102 2 2017
259 3102032003 1 3102 10 2017
260 3102032007 1 3102 4 2017
261 3102042002 1 3102 1 2017
262 3102991999 1 3102 9 2017
455 3103011001 1 3103 73 2017
456 3103011002 1 3103 19 2017
457 3103011003 1 3103 127 2017
458 3103012003 1 3103 2 2017
459 3103012022 1 3103 5 2017
460 3103012029 1 3103 1 2017
461 3103032006 1 3103 1 2017
462 3103032009 1 3103 1 2017
463 3103032014 1 3103 1 2017
464 3103042028 1 3103 1 2017
465 3103052020 1 3103 4 2017
466 3103062901 1 3103 1 2017
467 3103072012 1 3103 1 2017
468 3103991999 1 3103 2 2017
661 3201011001 1 3201 49 2017
662 3201011002 1 3201 65 2017
663 3201011003 1 3201 44 2017
664 3201011004 1 3201 15 2017
665 3201011005 1 3201 31 2017
666 3201011006 1 3201 11 2017
667 3201012003 1 3201 4 2017
668 3201012005 1 3201 1 2017
669 3201022006 1 3201 6 2017
670 3201032007 1 3201 3 2017
863 3202011001 1 3202 81 2017
864 3202011002 1 3202 38 2017
865 3202011003 1 3202 89 2017
866 3202021001 1 3202 56 2017
867 3202021002 1 3202 231 2017
868 3202021003 1 3202 119 2017

Agregamos un cero a los códigos comunales de cuatro dígitos:

codigos <- d$unlist.d.
rango <- seq(1:nrow(d))
cadena <- paste("0",codigos[rango], sep = "")
cadena <- substr(cadena,(nchar(cadena)[rango])-(4),6)
codigos <- as.data.frame(codigos)
cadena <- as.data.frame(cadena)
comuna_corr <- cbind(d,cadena)
comuna_corr <- comuna_corr[,-c(2,3),drop=FALSE]
names(comuna_corr)[4] <- "código" 
r3_100 <- comuna_corr[c(1:100),]
kbl(r3_100) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  kable_paper() %>%
  scroll_box(width = "100%", height = "300px")
zona Freq anio código
1 3101011001 59 2017 03101
2 3101021001 77 2017 03101
3 3101031001 45 2017 03101
4 3101041001 91 2017 03101
5 3101051001 71 2017 03101
6 3101061001 55 2017 03101
7 3101061002 12 2017 03101
8 3101061003 25 2017 03101
9 3101061004 87 2017 03101
10 3101061005 75 2017 03101
11 3101061006 89 2017 03101
12 3101061007 35 2017 03101
13 3101061008 30 2017 03101
14 3101061009 109 2017 03101
15 3101071001 162 2017 03101
16 3101071002 162 2017 03101
17 3101081001 68 2017 03101
18 3101091001 102 2017 03101
19 3101101001 2 2017 03101
20 3101102901 2 2017 03101
21 3101111001 665 2017 03101
22 3101111002 187 2017 03101
23 3101111003 640 2017 03101
24 3101122013 54 2017 03101
25 3101122047 1 2017 03101
26 3101122901 1 2017 03101
27 3101132901 1 2017 03101
28 3101161001 186 2017 03101
29 3101161002 654 2017 03101
30 3101161003 264 2017 03101
31 3101161004 334 2017 03101
32 3101162050 2 2017 03101
33 3101172013 11 2017 03101
34 3101172017 18 2017 03101
35 3101172021 1 2017 03101
36 3101172026 16 2017 03101
37 3101172035 15 2017 03101
38 3101172037 12 2017 03101
39 3101182901 1 2017 03101
40 3101211001 367 2017 03101
41 3101211002 80 2017 03101
42 3101211003 108 2017 03101
43 3101211004 169 2017 03101
44 3101211005 301 2017 03101
45 3101211006 219 2017 03101
46 3101211007 248 2017 03101
47 3101222015 1 2017 03101
48 3101222048 1 2017 03101
49 3101231001 16 2017 03101
50 3101231002 81 2017 03101
51 3101231003 122 2017 03101
52 3101231004 81 2017 03101
53 3101231005 36 2017 03101
54 3101241001 515 2017 03101
55 3101241002 719 2017 03101
56 3101241003 149 2017 03101
57 3101241004 98 2017 03101
58 3101241005 287 2017 03101
251 3102011001 179 2017 03102
252 3102011002 148 2017 03102
253 3102011003 228 2017 03102
254 3102011007 343 2017 03102
255 3102012001 66 2017 03102
256 3102012004 2 2017 03102
257 3102022010 22 2017 03102
258 3102022901 2 2017 03102
259 3102032003 10 2017 03102
260 3102032007 4 2017 03102
261 3102042002 1 2017 03102
262 3102991999 9 2017 03102
455 3103011001 73 2017 03103
456 3103011002 19 2017 03103
457 3103011003 127 2017 03103
458 3103012003 2 2017 03103
459 3103012022 5 2017 03103
460 3103012029 1 2017 03103
461 3103032006 1 2017 03103
462 3103032009 1 2017 03103
463 3103032014 1 2017 03103
464 3103042028 1 2017 03103
465 3103052020 4 2017 03103
466 3103062901 1 2017 03103
467 3103072012 1 2017 03103
468 3103991999 2 2017 03103
661 3201011001 49 2017 03201
662 3201011002 65 2017 03201
663 3201011003 44 2017 03201
664 3201011004 15 2017 03201
665 3201011005 31 2017 03201
666 3201011006 11 2017 03201
667 3201012003 4 2017 03201
668 3201012005 1 2017 03201
669 3201022006 6 2017 03201
670 3201032007 3 2017 03201
863 3202011001 81 2017 03202
864 3202011002 38 2017 03202
865 3202011003 89 2017 03202
866 3202021001 56 2017 03202
867 3202021002 231 2017 03202
868 3202021003 119 2017 03202


2 Variable CASEN

2.1 Tabla de ingresos expandidos

Hemos calculado ya éste valor como conclusión del punto 1.1 de aquí

h_y_m_2017_censo <- readRDS("ingresos_expandidos_17.rds")
tablamadre <- head(h_y_m_2017_censo,50)
kbl(tablamadre) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  kable_paper() %>%
  scroll_box(width = "100%", height = "300px")
código comuna.x promedio_i año comuna.y personas Ingresos_expandidos
01101 Iquique 354820.7 2017 1101 191468 67936815240
01107 Alto Hospicio 301933.4 2017 1107 108375 32722034397
01401 Pozo Almonte 285981.8 2017 1401 15711 4493059532
01402 Camiña 262850.3 2017 1402 1250 328562901
01404 Huara 253968.5 2017 1404 2730 693334131
01405 Pica 313007.5 2017 1405 9296 2909717399
02101 Antofagasta 347580.2 2017 2101 361873 125779893517
02102 Mejillones 369770.7 2017 2102 13467 4979702302
02103 Sierra Gorda 403458.5 2017 2103 10186 4109628188
02104 Taltal 364539.1 2017 2104 13317 4854566842
02201 Calama 409671.3 2017 2201 165731 67895226712
02203 San Pedro de Atacama 426592.0 2017 2203 10996 4690805471
02301 Tocopilla 246615.3 2017 2301 25186 6211253937
02302 María Elena 466266.9 2017 2302 6457 3010685220
03101 Copiapó 330075.2 2017 3101 153937 50810778473
03102 Caldera 299314.8 2017 3102 17662 5286498241
03103 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03201 Chañaral 286389.3 2017 3201 12219 3499391196
03202 Diego de Almagro 336256.8 2017 3202 13925 4682376047
03301 Vallenar 304336.7 2017 3301 51917 15800246795
03302 Alto del Carmen 227130.4 2017 3302 5299 1203563833
03303 Freirina 253086.7 2017 3303 7041 1781983257
03304 Huasco 287406.6 2017 3304 10149 2916889629
04101 La Serena 270221.9 2017 4101 221054 59733627577
04102 Coquimbo 261852.6 2017 4102 227730 59631700074
04103 Andacollo 248209.3 2017 4103 11044 2741223967
04104 La Higuera 228356.8 2017 4104 4241 968461330
04105 Paiguano 205942.1 2017 4105 4497 926121774
04106 Vicuña 211431.9 2017 4106 27771 5871675449
04201 Illapel 238674.4 2017 4201 30848 7362627007
04202 Canela 207933.6 2017 4202 9093 1890740321
04203 Los Vilos 255200.4 2017 4203 21382 5456695139
04204 Salamanca 242879.5 2017 4204 29347 7127783272
04301 Ovalle 266522.9 2017 4301 111272 29656533187
04302 Combarbalá 210409.7 2017 4302 13322 2803077721
04303 Monte Patria 211907.9 2017 4303 30751 6516380780
04304 Punitaqui 194997.8 2017 4304 10956 2136395349
04305 Río Hurtado 182027.2 2017 4305 4278 778712384
05101 Valparaíso 298720.7 2017 5101 296655 88616992249
05102 Casablanca 312802.7 2017 5102 26867 8404070481
05103 Concón 318496.3 2017 5103 42152 13425257057
05105 Puchuncaví 288737.2 2017 5105 18546 5354920887
05107 Quintero 316659.1 2017 5107 31923 10108709691
05109 Viña del Mar 337006.1 2017 5109 334248 112643604611
05301 Los Andes 338182.5 2017 5301 66708 22559476922
05302 Calle Larga 245165.4 2017 5302 14832 3636293159
05303 Rinconada 281633.2 2017 5303 10207 2874630315
05304 San Esteban 220958.4 2017 5304 18855 4166170587
05401 La Ligua 229623.7 2017 5401 35390 8126381563
05402 Cabildo 249717.7 2017 5402 19388 4841527150

3 Unión Censo-Casen

Integramos a la tabla censal de frecuencias la tabla de ingresos expandidos de la Casen.

comunas_con_ing_exp = merge( x = comuna_corr, y = h_y_m_2017_censo, by = "código", all.x = TRUE)
r3_100 <- comunas_con_ing_exp[c(1:100),]
kbl(r3_100) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  kable_paper() %>%
  scroll_box(width = "100%", height = "300px")
código zona Freq anio comuna.x promedio_i año comuna.y personas Ingresos_expandidos
03101 3101011001 59 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101021001 77 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101031001 45 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101041001 91 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101051001 71 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061001 55 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061002 12 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061003 25 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061004 87 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061005 75 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061006 89 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061007 35 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061008 30 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061009 109 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101071001 162 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101071002 162 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101081001 68 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101091001 102 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101101001 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101102901 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101111001 665 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101111002 187 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101111003 640 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101122013 54 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101122047 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101122901 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101132901 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101161001 186 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101161002 654 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101161003 264 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101161004 334 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101162050 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101172013 11 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101172017 18 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101172021 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101172026 16 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101172035 15 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101172037 12 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101182901 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211001 367 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211002 80 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211003 108 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211004 169 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211005 301 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211006 219 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211007 248 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101222015 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101222048 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101231001 16 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101231002 81 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101231003 122 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101231004 81 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101231005 36 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101241001 515 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101241002 719 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101241003 149 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101241004 98 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101241005 287 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03102 3102011001 179 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102011002 148 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102011003 228 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102011007 343 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102012001 66 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102012004 2 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102022010 22 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102022901 2 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102032003 10 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102032007 4 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102042002 1 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102991999 9 2017 Caldera 299314.8 2017 3102 17662 5286498241
03103 3103011001 73 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103011002 19 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103011003 127 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103012003 2 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103012022 5 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103012029 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103032006 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103032009 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103032014 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103042028 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103052020 4 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103062901 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103072012 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103991999 2 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03201 3201011001 49 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201011002 65 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201011003 44 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201011004 15 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201011005 31 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201011006 11 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201012003 4 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201012005 1 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201022006 6 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201032007 3 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03202 3202011001 81 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047
03202 3202011002 38 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047
03202 3202011003 89 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047
03202 3202021001 56 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047
03202 3202021002 231 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047
03202 3202021003 119 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047


4 Proporción poblacional zonal respecto a la comunal

Del censo obtenemos la cantidad de población a nivel de zona y estimamos su proporción a nivel comunal. Ya hemos calculado ésta proporción aquí.

prop_pob <- readRDS("tabla_de_prop_pob.rds")
names(prop_pob)[1] <- "zona"
names(prop_pob)[3] <- "p_poblacional" 

Veamos los 100 primeros registros:

r3_100 <- prop_pob[c(1:100),]
kbl(r3_100) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  kable_paper() %>%
  scroll_box(width = "100%", height = "300px")
zona Freq p_poblacional código
1101011001 2491 0.0130100 01101
1101011002 1475 0.0077036 01101
1101021001 1003 0.0052385 01101
1101021002 54 0.0002820 01101
1101021003 2895 0.0151200 01101
1101021004 2398 0.0125243 01101
1101021005 4525 0.0236332 01101
1101031001 2725 0.0142321 01101
1101031002 3554 0.0185618 01101
1101031003 5246 0.0273988 01101
1101031004 3389 0.0177001 01101
1101041001 1800 0.0094010 01101
1101041002 2538 0.0132555 01101
1101041003 3855 0.0201339 01101
1101041004 5663 0.0295767 01101
1101041005 4162 0.0217373 01101
1101041006 2689 0.0140441 01101
1101051001 3296 0.0172144 01101
1101051002 4465 0.0233198 01101
1101051003 4656 0.0243174 01101
1101051004 2097 0.0109522 01101
1101051005 3569 0.0186402 01101
1101051006 2741 0.0143157 01101
1101061001 1625 0.0084871 01101
1101061002 4767 0.0248971 01101
1101061003 4826 0.0252053 01101
1101061004 4077 0.0212934 01101
1101061005 2166 0.0113126 01101
1101071001 2324 0.0121378 01101
1101071002 2801 0.0146291 01101
1101071003 3829 0.0199981 01101
1101071004 1987 0.0103777 01101
1101081001 5133 0.0268087 01101
1101081002 3233 0.0168853 01101
1101081003 2122 0.0110828 01101
1101081004 2392 0.0124929 01101
1101092001 57 0.0002977 01101
1101092004 247 0.0012900 01101
1101092005 76 0.0003969 01101
1101092006 603 0.0031494 01101
1101092007 84 0.0004387 01101
1101092010 398 0.0020787 01101
1101092012 58 0.0003029 01101
1101092014 23 0.0001201 01101
1101092016 20 0.0001045 01101
1101092017 8 0.0000418 01101
1101092018 74 0.0003865 01101
1101092019 25 0.0001306 01101
1101092021 177 0.0009244 01101
1101092022 23 0.0001201 01101
1101092023 288 0.0015042 01101
1101092024 14 0.0000731 01101
1101092901 30 0.0001567 01101
1101101001 2672 0.0139553 01101
1101101002 4398 0.0229699 01101
1101101003 4524 0.0236280 01101
1101101004 3544 0.0185096 01101
1101101005 4911 0.0256492 01101
1101101006 3688 0.0192617 01101
1101111001 3886 0.0202958 01101
1101111002 2312 0.0120751 01101
1101111003 4874 0.0254560 01101
1101111004 4543 0.0237272 01101
1101111005 4331 0.0226200 01101
1101111006 3253 0.0169898 01101
1101111007 4639 0.0242286 01101
1101111008 4881 0.0254925 01101
1101111009 5006 0.0261454 01101
1101111010 366 0.0019115 01101
1101111011 4351 0.0227244 01101
1101111012 2926 0.0152819 01101
1101111013 3390 0.0177053 01101
1101111014 2940 0.0153550 01101
1101112003 33 0.0001724 01101
1101112013 104 0.0005432 01101
1101112019 34 0.0001776 01101
1101112025 21 0.0001097 01101
1101112901 6 0.0000313 01101
1101991999 1062 0.0055466 01101
1107011001 4104 0.0378685 01107
1107011002 4360 0.0402307 01107
1107011003 8549 0.0788835 01107
1107012003 3 0.0000277 01107
1107012901 17 0.0001569 01107
1107021001 6701 0.0618316 01107
1107021002 3971 0.0366413 01107
1107021003 6349 0.0585836 01107
1107021004 5125 0.0472895 01107
1107021005 4451 0.0410704 01107
1107021006 3864 0.0356540 01107
1107021007 5235 0.0483045 01107
1107021008 4566 0.0421315 01107
1107031001 4195 0.0387082 01107
1107031002 7099 0.0655040 01107
1107031003 4720 0.0435525 01107
1107032005 38 0.0003506 01107
1107032006 2399 0.0221361 01107
1107032008 4 0.0000369 01107
1107041001 3630 0.0334948 01107
1107041002 5358 0.0494394 01107


5 Ingreso medio

Deseamos el valor del ingreso promedio a nivel comunal, pero expandido a nivel zonal. Ésta información está contenida en el campo promedio_i de la tabla obtenida en el punto 3.

r3_100 <- comunas_con_ing_exp[c(1:100),]
kbl(r3_100) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  kable_paper() %>%
  scroll_box(width = "100%", height = "300px")
código zona Freq anio comuna.x promedio_i año comuna.y personas Ingresos_expandidos
03101 3101011001 59 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101021001 77 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101031001 45 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101041001 91 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101051001 71 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061001 55 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061002 12 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061003 25 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061004 87 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061005 75 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061006 89 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061007 35 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061008 30 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101061009 109 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101071001 162 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101071002 162 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101081001 68 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101091001 102 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101101001 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101102901 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101111001 665 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101111002 187 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101111003 640 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101122013 54 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101122047 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101122901 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101132901 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101161001 186 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101161002 654 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101161003 264 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101161004 334 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101162050 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101172013 11 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101172017 18 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101172021 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101172026 16 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101172035 15 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101172037 12 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101182901 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211001 367 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211002 80 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211003 108 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211004 169 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211005 301 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211006 219 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101211007 248 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101222015 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101222048 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101231001 16 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101231002 81 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101231003 122 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101231004 81 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101231005 36 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101241001 515 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101241002 719 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101241003 149 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101241004 98 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03101 3101241005 287 2017 Copiapó 330075.2 2017 3101 153937 50810778473
03102 3102011001 179 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102011002 148 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102011003 228 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102011007 343 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102012001 66 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102012004 2 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102022010 22 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102022901 2 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102032003 10 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102032007 4 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102042002 1 2017 Caldera 299314.8 2017 3102 17662 5286498241
03102 3102991999 9 2017 Caldera 299314.8 2017 3102 17662 5286498241
03103 3103011001 73 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103011002 19 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103011003 127 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103012003 2 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103012022 5 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103012029 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103032006 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103032009 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103032014 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103042028 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103052020 4 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103062901 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103072012 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03103 3103991999 2 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711
03201 3201011001 49 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201011002 65 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201011003 44 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201011004 15 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201011005 31 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201011006 11 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201012003 4 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201012005 1 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201022006 6 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03201 3201032007 3 2017 Chañaral 286389.3 2017 3201 12219 3499391196
03202 3202011001 81 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047
03202 3202011002 38 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047
03202 3202011003 89 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047
03202 3202021001 56 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047
03202 3202021002 231 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047
03202 3202021003 119 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047


6 Ingreso promedio expandido por zona (multi_pob)

En éste momento vamos a construir nuestra variable dependiente de regresión aplicando la siguiente fórmula:

\[ multi\_pob = promedio\_i \cdot personas \cdot p\_poblacional \]

Para ello integramos a la tabla de ingresos expandidos a nivel zonal (punto 3) la tabla de proporciones poblacionales zonales respecto al total comunal (punto 4) :

h_y_m_comuna_corr_01 = merge( x = comunas_con_ing_exp, y = prop_pob, by = "zona", all.x = TRUE)
tablamadre <- head(h_y_m_comuna_corr_01,100)
kbl(tablamadre) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  kable_paper() %>%
  scroll_box(width = "100%", height = "300px")
zona código.x Freq.x anio comuna.x promedio_i año comuna.y personas Ingresos_expandidos Freq.y p_poblacional código.y
3101011001 03101 59 2017 Copiapó 330075.2 2017 3101 153937 50810778473 869 0.0056452 03101
3101021001 03101 77 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1437 0.0093350 03101
3101031001 03101 45 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1502 0.0097572 03101
3101041001 03101 91 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1734 0.0112643 03101
3101051001 03101 71 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1576 0.0102380 03101
3101061001 03101 55 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4376 0.0284272 03101
3101061002 03101 12 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2049 0.0133106 03101
3101061003 03101 25 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4199 0.0272774 03101
3101061004 03101 87 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5838 0.0379246 03101
3101061005 03101 75 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3217 0.0208982 03101
3101061006 03101 89 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1930 0.0125376 03101
3101061007 03101 35 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3446 0.0223858 03101
3101061008 03101 30 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2624 0.0170459 03101
3101061009 03101 109 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5319 0.0345531 03101
3101071001 03101 162 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3367 0.0218726 03101
3101071002 03101 162 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2651 0.0172213 03101
3101081001 03101 68 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2352 0.0152790 03101
3101091001 03101 102 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4467 0.0290184 03101
3101101001 03101 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473 94 0.0006106 03101
3101102901 03101 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473 26 0.0001689 03101
3101111001 03101 665 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3046 0.0197873 03101
3101111002 03101 187 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2128 0.0138238 03101
3101111003 03101 640 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4579 0.0297459 03101
3101122013 03101 54 2017 Copiapó 330075.2 2017 3101 153937 50810778473 332 0.0021567 03101
3101122047 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 183 0.0011888 03101
3101122901 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 54 0.0003508 03101
3101132901 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 14 0.0000909 03101
3101161001 03101 186 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3897 0.0253156 03101
3101161002 03101 654 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5267 0.0342153 03101
3101161003 03101 264 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4789 0.0311101 03101
3101161004 03101 334 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4382 0.0284662 03101
3101162050 03101 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473 33 0.0002144 03101
3101172013 03101 11 2017 Copiapó 330075.2 2017 3101 153937 50810778473 194 0.0012603 03101
3101172017 03101 18 2017 Copiapó 330075.2 2017 3101 153937 50810778473 121 0.0007860 03101
3101172021 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 74 0.0004807 03101
3101172026 03101 16 2017 Copiapó 330075.2 2017 3101 153937 50810778473 340 0.0022087 03101
3101172035 03101 15 2017 Copiapó 330075.2 2017 3101 153937 50810778473 293 0.0019034 03101
3101172037 03101 12 2017 Copiapó 330075.2 2017 3101 153937 50810778473 859 0.0055802 03101
3101182901 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 17 0.0001104 03101
3101211001 03101 367 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4698 0.0305190 03101
3101211002 03101 80 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2574 0.0167211 03101
3101211003 03101 108 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4857 0.0315519 03101
3101211004 03101 169 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4381 0.0284597 03101
3101211005 03101 301 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3957 0.0257053 03101
3101211006 03101 219 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5331 0.0346311 03101
3101211007 03101 248 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2203 0.0143110 03101
3101222015 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 97 0.0006301 03101
3101222048 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 62 0.0004028 03101
3101231001 03101 16 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2431 0.0157922 03101
3101231002 03101 81 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4099 0.0266278 03101
3101231003 03101 122 2017 Copiapó 330075.2 2017 3101 153937 50810778473 6102 0.0396396 03101
3101231004 03101 81 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3368 0.0218791 03101
3101231005 03101 36 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3855 0.0250427 03101
3101241001 03101 515 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5023 0.0326302 03101
3101241002 03101 719 2017 Copiapó 330075.2 2017 3101 153937 50810778473 6270 0.0407309 03101
3101241003 03101 149 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3082 0.0200212 03101
3101241004 03101 98 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3115 0.0202356 03101
3101241005 03101 287 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4323 0.0280829 03101
3102011001 03102 179 2017 Caldera 299314.8 2017 3102 17662 5286498241 2174 0.1230891 03102
3102011002 03102 148 2017 Caldera 299314.8 2017 3102 17662 5286498241 2696 0.1526441 03102
3102011003 03102 228 2017 Caldera 299314.8 2017 3102 17662 5286498241 3928 0.2223984 03102
3102011007 03102 343 2017 Caldera 299314.8 2017 3102 17662 5286498241 6749 0.3821198 03102
3102012001 03102 66 2017 Caldera 299314.8 2017 3102 17662 5286498241 590 0.0334051 03102
3102012004 03102 2 2017 Caldera 299314.8 2017 3102 17662 5286498241 117 0.0066244 03102
3102022010 03102 22 2017 Caldera 299314.8 2017 3102 17662 5286498241 542 0.0306874 03102
3102022901 03102 2 2017 Caldera 299314.8 2017 3102 17662 5286498241 53 0.0030008 03102
3102032003 03102 10 2017 Caldera 299314.8 2017 3102 17662 5286498241 297 0.0168158 03102
3102032007 03102 4 2017 Caldera 299314.8 2017 3102 17662 5286498241 181 0.0102480 03102
3102042002 03102 1 2017 Caldera 299314.8 2017 3102 17662 5286498241 22 0.0012456 03102
3102991999 03102 9 2017 Caldera 299314.8 2017 3102 17662 5286498241 228 0.0129091 03102
3103011001 03103 73 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 6039 0.4307725 03103
3103011002 03103 19 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 1412 0.1007205 03103
3103011003 03103 127 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 2406 0.1716242 03103
3103012003 03103 2 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 74 0.0052786 03103
3103012022 03103 5 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 553 0.0394465 03103
3103012029 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 86 0.0061345 03103
3103032006 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 476 0.0339539 03103
3103032009 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 22 0.0015693 03103
3103032014 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 41 0.0029246 03103
3103042028 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 195 0.0139097 03103
3103052020 03103 4 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 952 0.0679078 03103
3103062901 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 122 0.0087025 03103
3103072012 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 27 0.0019260 03103
3103991999 03103 2 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 78 0.0055639 03103
3201011001 03201 49 2017 Chañaral 286389.3 2017 3201 12219 3499391196 4870 0.3985596 03201
3201011002 03201 65 2017 Chañaral 286389.3 2017 3201 12219 3499391196 1606 0.1314347 03201
3201011003 03201 44 2017 Chañaral 286389.3 2017 3201 12219 3499391196 2325 0.1902774 03201
3201011004 03201 15 2017 Chañaral 286389.3 2017 3201 12219 3499391196 1169 0.0956707 03201
3201011005 03201 31 2017 Chañaral 286389.3 2017 3201 12219 3499391196 735 0.0601522 03201
3201011006 03201 11 2017 Chañaral 286389.3 2017 3201 12219 3499391196 368 0.0301170 03201
3201012003 03201 4 2017 Chañaral 286389.3 2017 3201 12219 3499391196 27 0.0022097 03201
3201012005 03201 1 2017 Chañaral 286389.3 2017 3201 12219 3499391196 29 0.0023734 03201
3201022006 03201 6 2017 Chañaral 286389.3 2017 3201 12219 3499391196 699 0.0572060 03201
3201032007 03201 3 2017 Chañaral 286389.3 2017 3201 12219 3499391196 185 0.0151404 03201
3202011001 03202 81 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 2416 0.1735009 03202
3202011002 03202 38 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 1650 0.1184919 03202
3202011003 03202 89 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 3157 0.2267145 03202
3202021001 03202 56 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 1494 0.1072890 03202
3202021002 03202 231 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 2848 0.2045242 03202
3202021003 03202 119 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 1690 0.1213645 03202


Hacemos la multiplicación que queda almacenada en la variable multi_pob:

h_y_m_comuna_corr_01$multi_pob <- h_y_m_comuna_corr_01$promedio_i * h_y_m_comuna_corr_01$personas * h_y_m_comuna_corr_01$p_poblacional
tablamadre <- head(h_y_m_comuna_corr_01,100)
kbl(tablamadre) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  kable_paper() %>%
  scroll_box(width = "100%", height = "300px")
zona código.x Freq.x anio comuna.x promedio_i año comuna.y personas Ingresos_expandidos Freq.y p_poblacional código.y multi_pob
3101011001 03101 59 2017 Copiapó 330075.2 2017 3101 153937 50810778473 869 0.0056452 03101 286835306
3101021001 03101 77 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1437 0.0093350 03101 474317992
3101031001 03101 45 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1502 0.0097572 03101 495772876
3101041001 03101 91 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1734 0.0112643 03101 572350311
3101051001 03101 71 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1576 0.0102380 03101 520198438
3101061001 03101 55 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4376 0.0284272 03101 1444408859
3101061002 03101 12 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2049 0.0133106 03101 676323984
3101061003 03101 25 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4199 0.0272774 03101 1385985558
3101061004 03101 87 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5838 0.0379246 03101 1926978730
3101061005 03101 75 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3217 0.0208982 03101 1061851760
3101061006 03101 89 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1930 0.0125376 03101 637045041
3101061007 03101 35 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3446 0.0223858 03101 1137438969
3101061008 03101 30 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2624 0.0170459 03101 866117195
3101061009 03101 109 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5319 0.0345531 03101 1755669727
3101071001 03101 162 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3367 0.0218726 03101 1111363032
3101071002 03101 162 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2651 0.0172213 03101 875029225
3101081001 03101 68 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2352 0.0152790 03101 776336754
3101091001 03101 102 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4467 0.0290184 03101 1474445698
3101101001 03101 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473 94 0.0006106 03101 31027064
3101102901 03101 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473 26 0.0001689 03101 8581954
3101111001 03101 665 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3046 0.0197873 03101 1005408909
3101111002 03101 187 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2128 0.0138238 03101 702399921
3101111003 03101 640 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4579 0.0297459 03101 1511414115
3101122013 03101 54 2017 Copiapó 330075.2 2017 3101 153937 50810778473 332 0.0021567 03101 109584950
3101122047 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 183 0.0011888 03101 60403753
3101122901 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 54 0.0003508 03101 17824058
3101132901 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 14 0.0000909 03101 4621052
3101161001 03101 186 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3897 0.0253156 03101 1286302862
3101161002 03101 654 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5267 0.0342153 03101 1738505819
3101161003 03101 264 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4789 0.0311101 03101 1580729897
3101161004 03101 334 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4382 0.0284662 03101 1446389310
3101162050 03101 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473 33 0.0002144 03101 10892480
3101172013 03101 11 2017 Copiapó 330075.2 2017 3101 153937 50810778473 194 0.0012603 03101 64034579
3101172017 03101 18 2017 Copiapó 330075.2 2017 3101 153937 50810778473 121 0.0007860 03101 39939093
3101172021 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 74 0.0004807 03101 24425561
3101172026 03101 16 2017 Copiapó 330075.2 2017 3101 153937 50810778473 340 0.0022087 03101 112225551
3101172035 03101 15 2017 Copiapó 330075.2 2017 3101 153937 50810778473 293 0.0019034 03101 96712019
3101172037 03101 12 2017 Copiapó 330075.2 2017 3101 153937 50810778473 859 0.0055802 03101 283534554
3101182901 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 17 0.0001104 03101 5611278
3101211001 03101 367 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4698 0.0305190 03101 1550693058
3101211002 03101 80 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2574 0.0167211 03101 849613438
3101211003 03101 108 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4857 0.0315519 03101 1603175007
3101211004 03101 169 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4381 0.0284597 03101 1446059235
3101211005 03101 301 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3957 0.0257053 03101 1306107371
3101211006 03101 219 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5331 0.0346311 03101 1759630628
3101211007 03101 248 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2203 0.0143110 03101 727155557
3101222015 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 97 0.0006301 03101 32017290
3101222048 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 62 0.0004028 03101 20464659
3101231001 03101 16 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2431 0.0157922 03101 802412691
3101231002 03101 81 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4099 0.0266278 03101 1352978043
3101231003 03101 122 2017 Copiapó 330075.2 2017 3101 153937 50810778473 6102 0.0396396 03101 2014118570
3101231004 03101 81 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3368 0.0218791 03101 1111693108
3101231005 03101 36 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3855 0.0250427 03101 1272439706
3101241001 03101 515 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5023 0.0326302 03101 1657967482
3101241002 03101 719 2017 Copiapó 330075.2 2017 3101 153937 50810778473 6270 0.0407309 03101 2069571195
3101241003 03101 149 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3082 0.0200212 03101 1017291614
3101241004 03101 98 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3115 0.0202356 03101 1028184094
3101241005 03101 287 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4323 0.0280829 03101 1426914876
3102011001 03102 179 2017 Caldera 299314.8 2017 3102 17662 5286498241 2174 0.1230891 03102 650710405
3102011002 03102 148 2017 Caldera 299314.8 2017 3102 17662 5286498241 2696 0.1526441 03102 806952738
3102011003 03102 228 2017 Caldera 299314.8 2017 3102 17662 5286498241 3928 0.2223984 03102 1175708588
3102011007 03102 343 2017 Caldera 299314.8 2017 3102 17662 5286498241 6749 0.3821198 03102 2020075678
3102012001 03102 66 2017 Caldera 299314.8 2017 3102 17662 5286498241 590 0.0334051 03102 176595740
3102012004 03102 2 2017 Caldera 299314.8 2017 3102 17662 5286498241 117 0.0066244 03102 35019833
3102022010 03102 22 2017 Caldera 299314.8 2017 3102 17662 5286498241 542 0.0306874 03102 162228629
3102022901 03102 2 2017 Caldera 299314.8 2017 3102 17662 5286498241 53 0.0030008 03102 15863685
3102032003 03102 10 2017 Caldera 299314.8 2017 3102 17662 5286498241 297 0.0168158 03102 88896500
3102032007 03102 4 2017 Caldera 299314.8 2017 3102 17662 5286498241 181 0.0102480 03102 54175981
3102042002 03102 1 2017 Caldera 299314.8 2017 3102 17662 5286498241 22 0.0012456 03102 6584926
3102991999 03102 9 2017 Caldera 299314.8 2017 3102 17662 5286498241 228 0.0129091 03102 68243778
3103011001 03103 73 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 6039 0.4307725 03103 1900134459
3103011002 03103 19 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 1412 0.1007205 03103 444277174
3103011003 03103 127 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 2406 0.1716242 03103 757033202
3103012003 03103 2 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 74 0.0052786 03103 23283648
3103012022 03103 5 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 553 0.0394465 03103 173998072
3103012029 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 86 0.0061345 03103 27059375
3103032006 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 476 0.0339539 03103 149770492
3103032009 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 22 0.0015693 03103 6922166
3103032014 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 41 0.0029246 03103 12900400
3103042028 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 195 0.0139097 03103 61355559
3103052020 03103 4 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 952 0.0679078 03103 299540984
3103062901 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 122 0.0087025 03103 38386555
3103072012 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 27 0.0019260 03103 8495385
3103991999 03103 2 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 78 0.0055639 03103 24542224
3201011001 03201 49 2017 Chañaral 286389.3 2017 3201 12219 3499391196 4870 0.3985596 03201 1394716026
3201011002 03201 65 2017 Chañaral 286389.3 2017 3201 12219 3499391196 1606 0.1314347 03201 459941260
3201011003 03201 44 2017 Chañaral 286389.3 2017 3201 12219 3499391196 2325 0.1902774 03201 665855187
3201011004 03201 15 2017 Chañaral 286389.3 2017 3201 12219 3499391196 1169 0.0956707 03201 334789124
3201011005 03201 31 2017 Chañaral 286389.3 2017 3201 12219 3499391196 735 0.0601522 03201 210496156
3201011006 03201 11 2017 Chañaral 286389.3 2017 3201 12219 3499391196 368 0.0301170 03201 105391273
3201012003 03201 4 2017 Chañaral 286389.3 2017 3201 12219 3499391196 27 0.0022097 03201 7732512
3201012005 03201 1 2017 Chañaral 286389.3 2017 3201 12219 3499391196 29 0.0023734 03201 8305291
3201022006 03201 6 2017 Chañaral 286389.3 2017 3201 12219 3499391196 699 0.0572060 03201 200186140
3201032007 03201 3 2017 Chañaral 286389.3 2017 3201 12219 3499391196 185 0.0151404 03201 52982026
3202011001 03202 81 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 2416 0.1735009 03202 812396447
3202011002 03202 38 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 1650 0.1184919 03202 554823733
3202011003 03202 89 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 3157 0.2267145 03202 1061562742
3202021001 03202 56 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 1494 0.1072890 03202 502367671
3202021002 03202 231 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 2848 0.2045242 03202 957659388
3202021003 03202 119 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 1690 0.1213645 03202 568274005

7 Análisis de regresión

Aplicaremos un análisis de regresión donde:

\[ Y(dependiente) = ingreso \ expandido \ por \ zona \ (multi\_pob)\]

\[ X(independiente) = frecuencia \ de \ población \ que \ posee \ la \ variable \ Censal \ respecto \ a \ la \ zona \ (Freq.x) \]

7.1 Diagrama de dispersión

scatter.smooth(x=h_y_m_comuna_corr_01$Freq.x, y=h_y_m_comuna_corr_01$multi_pob, main="multi_pob ~ Freq.x",
     xlab = "Freq.x",
     ylab = "multi_pob",
           col = 2) 

7.2 Outliers

Hemos demostrado en el punto 5.7.2 de aquí que la exclusión de ouliers no genera ninguna mejora en el modelo de regresión.

7.3 Modelo lineal

Aplicaremos un análisis de regresión lineal del ingreso expandido por zona sobre las frecuencias de respuestas zonales.

linearMod <- lm( multi_pob~(Freq.x) , data=h_y_m_comuna_corr_01)
summary(linearMod) 
## 
## Call:
## lm(formula = multi_pob ~ (Freq.x), data = h_y_m_comuna_corr_01)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -1.406e+09 -2.277e+08 -1.840e+08  9.344e+07  1.462e+09 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 237888554   33446077   7.113 2.25e-11 ***
## Freq.x        2742196     196164  13.979  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 405100000 on 190 degrees of freedom
## Multiple R-squared:  0.507,  Adjusted R-squared:  0.5044 
## F-statistic: 195.4 on 1 and 190 DF,  p-value: < 2.2e-16

7.4 Gráfica de la recta de regresión lineal

ggplot(h_y_m_comuna_corr_01, aes(x = Freq.x , y = multi_pob)) + 
  geom_point() +
  stat_smooth(method = "lm", col = "red")

Si bien obtenemos nuestro modelo lineal da cuenta del 0.8214 de la variabilidad de los datos de respuesta en torno a su media, modelos alternativos pueden ofrecernos una explicación de la variable dependiente aún mayor.

8 Modelos alternativos

8.1 Modelo cuadrático

\[ \hat Y = \beta_0 + \beta_1 X^2 \]

linearMod <- lm( multi_pob~(Freq.x^2) , data=h_y_m_comuna_corr_01)
summary(linearMod) 
## 
## Call:
## lm(formula = multi_pob ~ (Freq.x^2), data = h_y_m_comuna_corr_01)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -1.406e+09 -2.277e+08 -1.840e+08  9.344e+07  1.462e+09 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 237888554   33446077   7.113 2.25e-11 ***
## Freq.x        2742196     196164  13.979  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 405100000 on 190 degrees of freedom
## Multiple R-squared:  0.507,  Adjusted R-squared:  0.5044 
## F-statistic: 195.4 on 1 and 190 DF,  p-value: < 2.2e-16

8.2 Modelo cúbico

\[ \hat Y = \beta_0 + \beta_1 X^3 \]

linearMod <- lm( multi_pob~(Freq.x^3) , data=h_y_m_comuna_corr_01)
summary(linearMod) 
## 
## Call:
## lm(formula = multi_pob ~ (Freq.x^3), data = h_y_m_comuna_corr_01)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -1.406e+09 -2.277e+08 -1.840e+08  9.344e+07  1.462e+09 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 237888554   33446077   7.113 2.25e-11 ***
## Freq.x        2742196     196164  13.979  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 405100000 on 190 degrees of freedom
## Multiple R-squared:  0.507,  Adjusted R-squared:  0.5044 
## F-statistic: 195.4 on 1 and 190 DF,  p-value: < 2.2e-16

8.3 Modelo logarítmico

\[ \hat Y = \beta_0 + \beta_1 ln X \]

linearMod <- lm( multi_pob~log(Freq.x) , data=h_y_m_comuna_corr_01)
summary(linearMod) 
## 
## Call:
## lm(formula = multi_pob ~ log(Freq.x), data = h_y_m_comuna_corr_01)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -620130689 -274938633  -21357939  212092739 1099862470 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -203853599   43455141  -4.691 5.18e-06 ***
## log(Freq.x)  234036844   12509820  18.708  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 342200000 on 190 degrees of freedom
## Multiple R-squared:  0.6481, Adjusted R-squared:  0.6463 
## F-statistic:   350 on 1 and 190 DF,  p-value: < 2.2e-16

8.4 Modelo exponencial

\[ \hat Y = \beta_0 + \beta_1 e^X \]

No es aplicable sin una transformación pues los valores elevados a \(e\) de Freq.x tienden a infinito.

8.5 Modelo con raíz cuadrada

\[ \hat Y = \beta_0 + \beta_1 \sqrt {X} \]

linearMod <- lm( multi_pob~sqrt(Freq.x) , data=h_y_m_comuna_corr_01)
summary(linearMod) 
## 
## Call:
## lm(formula = multi_pob ~ sqrt(Freq.x), data = h_y_m_comuna_corr_01)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -910715490 -149789040  -64443067   19716290 1287495382 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -33223145   33970130  -0.978    0.329    
## sqrt(Freq.x)  75592456    3732221  20.254   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 324600000 on 190 degrees of freedom
## Multiple R-squared:  0.6835, Adjusted R-squared:  0.6818 
## F-statistic: 410.2 on 1 and 190 DF,  p-value: < 2.2e-16

8.6 Modelo raíz-raíz

\[ \hat Y = {\beta_0}^2 + 2 \beta_0 \beta_1 \sqrt{X}+ \beta_1^2 X \]

linearMod <- lm( sqrt(multi_pob)~sqrt(Freq.x) , data=h_y_m_comuna_corr_01)
summary(linearMod) 
## 
## Call:
## lm(formula = sqrt(multi_pob) ~ sqrt(Freq.x), data = h_y_m_comuna_corr_01)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -22095  -4318  -1864   1804  23161 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   5085.26     754.21   6.743 1.82e-10 ***
## sqrt(Freq.x)  1796.50      82.86  21.680  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 7206 on 190 degrees of freedom
## Multiple R-squared:  0.7121, Adjusted R-squared:  0.7106 
## F-statistic:   470 on 1 and 190 DF,  p-value: < 2.2e-16

8.7 Modelo log-raíz

\[ \hat Y = e^{\beta_0 + \beta_1 \sqrt{X}} \]

linearMod <- lm( log(multi_pob)~sqrt(Freq.x) , data=h_y_m_comuna_corr_01)
summary(linearMod) 
## 
## Call:
## lm(formula = log(multi_pob) ~ sqrt(Freq.x), data = h_y_m_comuna_corr_01)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.4883 -0.7319  0.0417  0.6895  2.7335 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  17.13133    0.12302  139.26   <2e-16 ***
## sqrt(Freq.x)  0.23698    0.01352   17.53   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.175 on 190 degrees of freedom
## Multiple R-squared:  0.618,  Adjusted R-squared:  0.616 
## F-statistic: 307.4 on 1 and 190 DF,  p-value: < 2.2e-16

8.8 Modelo raíz-log

\[ \hat Y = {\beta_0}^2 + 2 \beta_0 \beta_1 \ln{X}+ \beta_1^2 ln^2X \]

linearMod <- lm( sqrt(multi_pob)~log(Freq.x) , data=h_y_m_comuna_corr_01)
summary(linearMod) 
## 
## Call:
## lm(formula = sqrt(multi_pob) ~ log(Freq.x), data = h_y_m_comuna_corr_01)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -13193.0  -4743.9   -798.1   3530.9  18153.5 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   -92.91     810.59  -0.115    0.909    
## log(Freq.x)  5954.95     233.35  25.519   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 6383 on 190 degrees of freedom
## Multiple R-squared:  0.7741, Adjusted R-squared:  0.773 
## F-statistic: 651.2 on 1 and 190 DF,  p-value: < 2.2e-16

8.9 Modelo log-log

\[ \hat Y = e^{\beta_0+\beta_1 ln{X}} \]

linearMod <- lm( log(multi_pob)~log(Freq.x) , data=h_y_m_comuna_corr_01)
summary(linearMod) 
## 
## Call:
## lm(formula = log(multi_pob) ~ log(Freq.x), data = h_y_m_comuna_corr_01)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.7140 -0.5050 -0.0602  0.4293  2.6117 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 16.21286    0.10243  158.28   <2e-16 ***
## log(Freq.x)  0.86789    0.02949   29.43   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8066 on 190 degrees of freedom
## Multiple R-squared:  0.8201, Adjusted R-squared:  0.8192 
## F-statistic: 866.3 on 1 and 190 DF,  p-value: < 2.2e-16

9 Modelo log-log (log-log)

Es éste el modelo que nos entrega el mayor coeficiente de determinación de todos (0.8192).

9.1 Diagrama de dispersión sobre log-log

Desplegamos una curva suavizada por loess en el diagrama de dispersión.

scatter.smooth(x=log(h_y_m_comuna_corr_01$Freq.x), y=log(h_y_m_comuna_corr_01$multi_pob), lpars = list(col = "red", lwd = 2, lty = 1), main="multi_pob ~ Freq.x")

9.2 Modelo log-log

Observemos nuevamente el resultado sobre log-log.

linearMod <- lm(log( multi_pob)~log(Freq.x) , data=h_y_m_comuna_corr_01)
summary(linearMod) 
## 
## Call:
## lm(formula = log(multi_pob) ~ log(Freq.x), data = h_y_m_comuna_corr_01)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.7140 -0.5050 -0.0602  0.4293  2.6117 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 16.21286    0.10243  158.28   <2e-16 ***
## log(Freq.x)  0.86789    0.02949   29.43   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8066 on 190 degrees of freedom
## Multiple R-squared:  0.8201, Adjusted R-squared:  0.8192 
## F-statistic: 866.3 on 1 and 190 DF,  p-value: < 2.2e-16
ggplot(h_y_m_comuna_corr_01, aes(x = log(Freq.x) , y = log(multi_pob))) + 
  geom_point() +
  stat_smooth(method = "lm", col = "red")

9.3 Análisis de residuos

par(mfrow = c (2,2))
plot(linearMod)

9.4 Ecuación del modelo


\[ \hat Y = e^(16.21286 + 0.96940 * lnX) \]


10 Aplicación la regresión a los valores de la variable a nivel de zona

Esta nueva variable se llamará: est_ing

h_y_m_comuna_corr_01$est_ing <- exp(16.21286 + 0.96940 * log(h_y_m_comuna_corr_01$Freq.x))

r3_100 <- h_y_m_comuna_corr_01[c(1:100),]
kbl(r3_100) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  kable_paper() %>%
  scroll_box(width = "100%", height = "300px")
zona código.x Freq.x anio comuna.x promedio_i año comuna.y personas Ingresos_expandidos Freq.y p_poblacional código.y multi_pob est_ing
3101011001 03101 59 2017 Copiapó 330075.2 2017 3101 153937 50810778473 869 0.0056452 03101 286835306 572558114
3101021001 03101 77 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1437 0.0093350 03101 474317992 741173261
3101031001 03101 45 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1502 0.0097572 03101 495772876 440331591
3101041001 03101 91 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1734 0.0112643 03101 572350311 871465823
3101051001 03101 71 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1576 0.0102380 03101 520198438 685118157
3101061001 03101 55 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4376 0.0284272 03101 1444408859 534888456
3101061002 03101 12 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2049 0.0133106 03101 676323984 122268317
3101061003 03101 25 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4199 0.0272774 03101 1385985558 249068427
3101061004 03101 87 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5838 0.0379246 03101 1926978730 834306443
3101061005 03101 75 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3217 0.0208982 03101 1061851760 722503612
3101061006 03101 89 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1930 0.0125376 03101 637045041 852892521
3101061007 03101 35 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3446 0.0223858 03101 1137438969 345124028
3101061008 03101 30 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2624 0.0170459 03101 866117195 297219280
3101061009 03101 109 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5319 0.0345531 03101 1755669727 1038094478
3101071001 03101 162 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3367 0.0218726 03101 1111363032 1524261530
3101071002 03101 162 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2651 0.0172213 03101 875029225 1524261530
3101081001 03101 68 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2352 0.0152790 03101 776336754 657036920
3101091001 03101 102 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4467 0.0290184 03101 1474445698 973402910
3101101001 03101 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473 94 0.0006106 03101 31027064 21526534
3101102901 03101 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473 26 0.0001689 03101 8581954 21526534
3101111001 03101 665 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3046 0.0197873 03101 1005408909 5992374356
3101111002 03101 187 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2128 0.0138238 03101 702399921 1751777271
3101111003 03101 640 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4579 0.0297459 03101 1511414115 5773863342
3101122013 03101 54 2017 Copiapó 330075.2 2017 3101 153937 50810778473 332 0.0021567 03101 109584950 525458165
3101122047 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 183 0.0011888 03101 60403753 10993997
3101122901 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 54 0.0003508 03101 17824058 10993997
3101132901 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 14 0.0000909 03101 4621052 10993997
3101161001 03101 186 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3897 0.0253156 03101 1286302862 1742695389
3101161002 03101 654 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5267 0.0342153 03101 1738505819 5896261049
3101161003 03101 264 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4789 0.0311101 03101 1580729897 2447138111
3101161004 03101 334 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4382 0.0284662 03101 1446389310 3073798956
3101162050 03101 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473 33 0.0002144 03101 10892480 21526534
3101172013 03101 11 2017 Copiapó 330075.2 2017 3101 153937 50810778473 194 0.0012603 03101 64034579 112378105
3101172017 03101 18 2017 Copiapó 330075.2 2017 3101 153937 50810778473 121 0.0007860 03101 39939093 181141016
3101172021 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 74 0.0004807 03101 24425561 10993997
3101172026 03101 16 2017 Copiapó 330075.2 2017 3101 153937 50810778473 340 0.0022087 03101 112225551 161595605
3101172035 03101 15 2017 Copiapó 330075.2 2017 3101 153937 50810778473 293 0.0019034 03101 96712019 151795361
3101172037 03101 12 2017 Copiapó 330075.2 2017 3101 153937 50810778473 859 0.0055802 03101 283534554 122268317
3101182901 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 17 0.0001104 03101 5611278 10993997
3101211001 03101 367 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4698 0.0305190 03101 1550693058 3367773820
3101211002 03101 80 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2574 0.0167211 03101 849613438 769150041
3101211003 03101 108 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4857 0.0315519 03101 1603175007 1028860804
3101211004 03101 169 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4381 0.0284597 03101 1446059235 1588067673
3101211005 03101 301 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3957 0.0257053 03101 1306107371 2778932479
3101211006 03101 219 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5331 0.0346311 03101 1759630628 2041654070
3101211007 03101 248 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2203 0.0143110 03101 727155557 2303228858
3101222015 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 97 0.0006301 03101 32017290 10993997
3101222048 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 62 0.0004028 03101 20464659 10993997
3101231001 03101 16 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2431 0.0157922 03101 802412691 161595605
3101231002 03101 81 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4099 0.0266278 03101 1352978043 778468441
3101231003 03101 122 2017 Copiapó 330075.2 2017 3101 153937 50810778473 6102 0.0396396 03101 2014118570 1157904799
3101231004 03101 81 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3368 0.0218791 03101 1111693108 778468441
3101231005 03101 36 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3855 0.0250427 03101 1272439706 354678839
3101241001 03101 515 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5023 0.0326302 03101 1657967482 4677152837
3101241002 03101 719 2017 Copiapó 330075.2 2017 3101 153937 50810778473 6270 0.0407309 03101 2069571195 6463512904
3101241003 03101 149 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3082 0.0200212 03101 1017291614 1405537388
3101241004 03101 98 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3115 0.0202356 03101 1028184094 936375823
3101241005 03101 287 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4323 0.0280829 03101 1426914876 2653544313
3102011001 03102 179 2017 Caldera 299314.8 2017 3102 17662 5286498241 2174 0.1230891 03102 650710405 1679079897
3102011002 03102 148 2017 Caldera 299314.8 2017 3102 17662 5286498241 2696 0.1526441 03102 806952738 1396391964
3102011003 03102 228 2017 Caldera 299314.8 2017 3102 17662 5286498241 3928 0.2223984 03102 1175708588 2122939778
3102011007 03102 343 2017 Caldera 299314.8 2017 3102 17662 5286498241 6749 0.3821198 03102 2020075678 3154058570
3102012001 03102 66 2017 Caldera 299314.8 2017 3102 17662 5286498241 590 0.0334051 03102 176595740 638295121
3102012004 03102 2 2017 Caldera 299314.8 2017 3102 17662 5286498241 117 0.0066244 03102 35019833 21526534
3102022010 03102 22 2017 Caldera 299314.8 2017 3102 17662 5286498241 542 0.0306874 03102 162228629 220039262
3102022901 03102 2 2017 Caldera 299314.8 2017 3102 17662 5286498241 53 0.0030008 03102 15863685 21526534
3102032003 03102 10 2017 Caldera 299314.8 2017 3102 17662 5286498241 297 0.0168158 03102 88896500 102460303
3102032007 03102 4 2017 Caldera 299314.8 2017 3102 17662 5286498241 181 0.0102480 03102 54175981 42149516
3102042002 03102 1 2017 Caldera 299314.8 2017 3102 17662 5286498241 22 0.0012456 03102 6584926 10993997
3102991999 03102 9 2017 Caldera 299314.8 2017 3102 17662 5286498241 228 0.0129091 03102 68243778 92512054
3103011001 03103 73 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 6039 0.4307725 03103 1900134459 703818721
3103011002 03103 19 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 1412 0.1007205 03103 444277174 190888328
3103011003 03103 127 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 2406 0.1716242 03103 757033202 1203879338
3103012003 03103 2 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 74 0.0052786 03103 23283648 21526534
3103012022 03103 5 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 553 0.0394465 03103 173998072 52328364
3103012029 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 86 0.0061345 03103 27059375 10993997
3103032006 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 476 0.0339539 03103 149770492 10993997
3103032009 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 22 0.0015693 03103 6922166 10993997
3103032014 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 41 0.0029246 03103 12900400 10993997
3103042028 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 195 0.0139097 03103 61355559 10993997
3103052020 03103 4 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 952 0.0679078 03103 299540984 42149516
3103062901 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 122 0.0087025 03103 38386555 10993997
3103072012 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 27 0.0019260 03103 8495385 10993997
3103991999 03103 2 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 78 0.0055639 03103 24542224 21526534
3201011001 03201 49 2017 Chañaral 286389.3 2017 3201 12219 3499391196 4870 0.3985596 03201 1394716026 478224381
3201011002 03201 65 2017 Chañaral 286389.3 2017 3201 12219 3499391196 1606 0.1314347 03201 459941260 628917735
3201011003 03201 44 2017 Chañaral 286389.3 2017 3201 12219 3499391196 2325 0.1902774 03201 665855187 430842620
3201011004 03201 15 2017 Chañaral 286389.3 2017 3201 12219 3499391196 1169 0.0956707 03201 334789124 151795361
3201011005 03201 31 2017 Chañaral 286389.3 2017 3201 12219 3499391196 735 0.0601522 03201 210496156 306818583
3201011006 03201 11 2017 Chañaral 286389.3 2017 3201 12219 3499391196 368 0.0301170 03201 105391273 112378105
3201012003 03201 4 2017 Chañaral 286389.3 2017 3201 12219 3499391196 27 0.0022097 03201 7732512 42149516
3201012005 03201 1 2017 Chañaral 286389.3 2017 3201 12219 3499391196 29 0.0023734 03201 8305291 10993997
3201022006 03201 6 2017 Chañaral 286389.3 2017 3201 12219 3499391196 699 0.0572060 03201 200186140 62444682
3201032007 03201 3 2017 Chañaral 286389.3 2017 3201 12219 3499391196 185 0.0151404 03201 52982026 31891649
3202011001 03202 81 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 2416 0.1735009 03202 812396447 778468441
3202011002 03202 38 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 1650 0.1184919 03202 554823733 373764330
3202011003 03202 89 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 3157 0.2267145 03202 1061562742 852892521
3202021001 03202 56 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 1494 0.1072890 03202 502367671 544313502
3202021002 03202 231 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 2848 0.2045242 03202 957659388 2150013006
3202021003 03202 119 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 1690 0.1213645 03202 568274005 1130292532


11 División del valor estimado entre la población total de la zona para obtener el ingreso medio por zona


\[ Ingreso \_ Medio\_zona = est\_ing / (personas * p\_poblacional) \]


h_y_m_comuna_corr_01$ing_medio_zona <- h_y_m_comuna_corr_01$est_ing  /( h_y_m_comuna_corr_01$personas  * h_y_m_comuna_corr_01$p_poblacional)

r3_100 <- h_y_m_comuna_corr_01[c(1:100),]
kbl(r3_100) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  kable_paper() %>%
  scroll_box(width = "100%", height = "300px")
zona código.x Freq.x anio comuna.x promedio_i año comuna.y personas Ingresos_expandidos Freq.y p_poblacional código.y multi_pob est_ing ing_medio_zona
3101011001 03101 59 2017 Copiapó 330075.2 2017 3101 153937 50810778473 869 0.0056452 03101 286835306 572558114 658870.10
3101021001 03101 77 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1437 0.0093350 03101 474317992 741173261 515778.19
3101031001 03101 45 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1502 0.0097572 03101 495772876 440331591 293163.51
3101041001 03101 91 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1734 0.0112643 03101 572350311 871465823 502575.45
3101051001 03101 71 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1576 0.0102380 03101 520198438 685118157 434719.64
3101061001 03101 55 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4376 0.0284272 03101 1444408859 534888456 122232.28
3101061002 03101 12 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2049 0.0133106 03101 676323984 122268317 59672.19
3101061003 03101 25 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4199 0.0272774 03101 1385985558 249068427 59316.13
3101061004 03101 87 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5838 0.0379246 03101 1926978730 834306443 142909.63
3101061005 03101 75 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3217 0.0208982 03101 1061851760 722503612 224589.25
3101061006 03101 89 2017 Copiapó 330075.2 2017 3101 153937 50810778473 1930 0.0125376 03101 637045041 852892521 441913.22
3101061007 03101 35 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3446 0.0223858 03101 1137438969 345124028 100152.07
3101061008 03101 30 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2624 0.0170459 03101 866117195 297219280 113269.54
3101061009 03101 109 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5319 0.0345531 03101 1755669727 1038094478 195167.23
3101071001 03101 162 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3367 0.0218726 03101 1111363032 1524261530 452706.13
3101071002 03101 162 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2651 0.0172213 03101 875029225 1524261530 574976.06
3101081001 03101 68 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2352 0.0152790 03101 776336754 657036920 279352.43
3101091001 03101 102 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4467 0.0290184 03101 1474445698 973402910 217909.76
3101101001 03101 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473 94 0.0006106 03101 31027064 21526534 229005.68
3101102901 03101 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473 26 0.0001689 03101 8581954 21526534 827943.62
3101111001 03101 665 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3046 0.0197873 03101 1005408909 5992374356 1967292.96
3101111002 03101 187 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2128 0.0138238 03101 702399921 1751777271 823203.60
3101111003 03101 640 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4579 0.0297459 03101 1511414115 5773863342 1260944.17
3101122013 03101 54 2017 Copiapó 330075.2 2017 3101 153937 50810778473 332 0.0021567 03101 109584950 525458165 1582705.32
3101122047 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 183 0.0011888 03101 60403753 10993997 60076.49
3101122901 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 54 0.0003508 03101 17824058 10993997 203592.55
3101132901 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 14 0.0000909 03101 4621052 10993997 785285.54
3101161001 03101 186 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3897 0.0253156 03101 1286302862 1742695389 447188.96
3101161002 03101 654 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5267 0.0342153 03101 1738505819 5896261049 1119472.38
3101161003 03101 264 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4789 0.0311101 03101 1580729897 2447138111 510991.46
3101161004 03101 334 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4382 0.0284662 03101 1446389310 3073798956 701460.28
3101162050 03101 2 2017 Copiapó 330075.2 2017 3101 153937 50810778473 33 0.0002144 03101 10892480 21526534 652319.22
3101172013 03101 11 2017 Copiapó 330075.2 2017 3101 153937 50810778473 194 0.0012603 03101 64034579 112378105 579268.58
3101172017 03101 18 2017 Copiapó 330075.2 2017 3101 153937 50810778473 121 0.0007860 03101 39939093 181141016 1497033.19
3101172021 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 74 0.0004807 03101 24425561 10993997 148567.53
3101172026 03101 16 2017 Copiapó 330075.2 2017 3101 153937 50810778473 340 0.0022087 03101 112225551 161595605 475281.19
3101172035 03101 15 2017 Copiapó 330075.2 2017 3101 153937 50810778473 293 0.0019034 03101 96712019 151795361 518072.91
3101172037 03101 12 2017 Copiapó 330075.2 2017 3101 153937 50810778473 859 0.0055802 03101 283534554 122268317 142337.97
3101182901 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 17 0.0001104 03101 5611278 10993997 646705.74
3101211001 03101 367 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4698 0.0305190 03101 1550693058 3367773820 716852.66
3101211002 03101 80 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2574 0.0167211 03101 849613438 769150041 298815.09
3101211003 03101 108 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4857 0.0315519 03101 1603175007 1028860804 211830.51
3101211004 03101 169 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4381 0.0284597 03101 1446059235 1588067673 362489.77
3101211005 03101 301 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3957 0.0257053 03101 1306107371 2778932479 702282.66
3101211006 03101 219 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5331 0.0346311 03101 1759630628 2041654070 382977.69
3101211007 03101 248 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2203 0.0143110 03101 727155557 2303228858 1045496.53
3101222015 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 97 0.0006301 03101 32017290 10993997 113340.18
3101222048 03101 1 2017 Copiapó 330075.2 2017 3101 153937 50810778473 62 0.0004028 03101 20464659 10993997 177322.54
3101231001 03101 16 2017 Copiapó 330075.2 2017 3101 153937 50810778473 2431 0.0157922 03101 802412691 161595605 66472.89
3101231002 03101 81 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4099 0.0266278 03101 1352978043 778468441 189916.67
3101231003 03101 122 2017 Copiapó 330075.2 2017 3101 153937 50810778473 6102 0.0396396 03101 2014118570 1157904799 189758.24
3101231004 03101 81 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3368 0.0218791 03101 1111693108 778468441 231136.71
3101231005 03101 36 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3855 0.0250427 03101 1272439706 354678839 92004.89
3101241001 03101 515 2017 Copiapó 330075.2 2017 3101 153937 50810778473 5023 0.0326302 03101 1657967482 4677152837 931147.29
3101241002 03101 719 2017 Copiapó 330075.2 2017 3101 153937 50810778473 6270 0.0407309 03101 2069571195 6463512904 1030863.30
3101241003 03101 149 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3082 0.0200212 03101 1017291614 1405537388 456047.17
3101241004 03101 98 2017 Copiapó 330075.2 2017 3101 153937 50810778473 3115 0.0202356 03101 1028184094 936375823 300602.19
3101241005 03101 287 2017 Copiapó 330075.2 2017 3101 153937 50810778473 4323 0.0280829 03101 1426914876 2653544313 613820.10
3102011001 03102 179 2017 Caldera 299314.8 2017 3102 17662 5286498241 2174 0.1230891 03102 650710405 1679079897 772345.86
3102011002 03102 148 2017 Caldera 299314.8 2017 3102 17662 5286498241 2696 0.1526441 03102 806952738 1396391964 517949.54
3102011003 03102 228 2017 Caldera 299314.8 2017 3102 17662 5286498241 3928 0.2223984 03102 1175708588 2122939778 540463.28
3102011007 03102 343 2017 Caldera 299314.8 2017 3102 17662 5286498241 6749 0.3821198 03102 2020075678 3154058570 467337.17
3102012001 03102 66 2017 Caldera 299314.8 2017 3102 17662 5286498241 590 0.0334051 03102 176595740 638295121 1081856.14
3102012004 03102 2 2017 Caldera 299314.8 2017 3102 17662 5286498241 117 0.0066244 03102 35019833 21526534 183987.47
3102022010 03102 22 2017 Caldera 299314.8 2017 3102 17662 5286498241 542 0.0306874 03102 162228629 220039262 405976.50
3102022901 03102 2 2017 Caldera 299314.8 2017 3102 17662 5286498241 53 0.0030008 03102 15863685 21526534 406161.02
3102032003 03102 10 2017 Caldera 299314.8 2017 3102 17662 5286498241 297 0.0168158 03102 88896500 102460303 344984.18
3102032007 03102 4 2017 Caldera 299314.8 2017 3102 17662 5286498241 181 0.0102480 03102 54175981 42149516 232870.25
3102042002 03102 1 2017 Caldera 299314.8 2017 3102 17662 5286498241 22 0.0012456 03102 6584926 10993997 499727.16
3102991999 03102 9 2017 Caldera 299314.8 2017 3102 17662 5286498241 228 0.0129091 03102 68243778 92512054 405754.62
3103011001 03103 73 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 6039 0.4307725 03103 1900134459 703818721 116545.57
3103011002 03103 19 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 1412 0.1007205 03103 444277174 190888328 135190.03
3103011003 03103 127 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 2406 0.1716242 03103 757033202 1203879338 500365.48
3103012003 03103 2 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 74 0.0052786 03103 23283648 21526534 290899.11
3103012022 03103 5 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 553 0.0394465 03103 173998072 52328364 94626.34
3103012029 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 86 0.0061345 03103 27059375 10993997 127837.18
3103032006 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 476 0.0339539 03103 149770492 10993997 23096.63
3103032009 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 22 0.0015693 03103 6922166 10993997 499727.16
3103032014 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 41 0.0029246 03103 12900400 10993997 268146.28
3103042028 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 195 0.0139097 03103 61355559 10993997 56379.47
3103052020 03103 4 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 952 0.0679078 03103 299540984 42149516 44274.70
3103062901 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 122 0.0087025 03103 38386555 10993997 90114.73
3103072012 03103 1 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 27 0.0019260 03103 8495385 10993997 407185.09
3103991999 03103 2 2017 Tierra Amarilla 314643.9 2017 3103 14019 4410992711 78 0.0055639 03103 24542224 21526534 275981.21
3201011001 03201 49 2017 Chañaral 286389.3 2017 3201 12219 3499391196 4870 0.3985596 03201 1394716026 478224381 98198.02
3201011002 03201 65 2017 Chañaral 286389.3 2017 3201 12219 3499391196 1606 0.1314347 03201 459941260 628917735 391605.07
3201011003 03201 44 2017 Chañaral 286389.3 2017 3201 12219 3499391196 2325 0.1902774 03201 665855187 430842620 185308.65
3201011004 03201 15 2017 Chañaral 286389.3 2017 3201 12219 3499391196 1169 0.0956707 03201 334789124 151795361 129850.61
3201011005 03201 31 2017 Chañaral 286389.3 2017 3201 12219 3499391196 735 0.0601522 03201 210496156 306818583 417440.25
3201011006 03201 11 2017 Chañaral 286389.3 2017 3201 12219 3499391196 368 0.0301170 03201 105391273 112378105 305375.28
3201012003 03201 4 2017 Chañaral 286389.3 2017 3201 12219 3499391196 27 0.0022097 03201 7732512 42149516 1561093.18
3201012005 03201 1 2017 Chañaral 286389.3 2017 3201 12219 3499391196 29 0.0023734 03201 8305291 10993997 379103.36
3201022006 03201 6 2017 Chañaral 286389.3 2017 3201 12219 3499391196 699 0.0572060 03201 200186140 62444682 89334.31
3201032007 03201 3 2017 Chañaral 286389.3 2017 3201 12219 3499391196 185 0.0151404 03201 52982026 31891649 172387.29
3202011001 03202 81 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 2416 0.1735009 03202 812396447 778468441 322213.76
3202011002 03202 38 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 1650 0.1184919 03202 554823733 373764330 226523.84
3202011003 03202 89 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 3157 0.2267145 03202 1061562742 852892521 270159.18
3202021001 03202 56 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 1494 0.1072890 03202 502367671 544313502 364333.00
3202021002 03202 231 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 2848 0.2045242 03202 957659388 2150013006 754920.30
3202021003 03202 119 2017 Diego de Almagro 336256.8 2017 3202 13925 4682376047 1690 0.1213645 03202 568274005 1130292532 668812.15


Guardamos:

saveRDS(h_y_m_comuna_corr_01, "casen_censo_region_03.rds")