1 Variable CENSO

Necesitamos calcular las frecuencias a nivel censal de las respuestas correspondientes a la categoría: “Parquet, piso flotante, cerámico, madera, alfombra, flexit, cubrepiso u otro similar, sobre radier o vigas de madera” del campo P03C 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 Censo 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)

Hagamos un subset con la 1:

tabla_con_clave <- filter(tabla_con_clave, tabla_con_clave$REGION == 4) 
tabla_con_clave <- filter(tabla_con_clave, tabla_con_clave$AREA== 1) 

1.2 Cálculo de frecuencias

tabla_con_clave_f <- tabla_con_clave[,-c(1,2,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20),drop=FALSE]

aterial de construcción del piso

names(tabla_con_clave_f)[2] <- "Tipo de piso"
# Ahora filtramos por Tipo de techo = 1.
tabla_con_clave_ff <- filter(tabla_con_clave_f, tabla_con_clave_f$`Tipo de piso` == 1)
# Determinamos las frecuencias por zona:
b <- tabla_con_clave_ff$clave
c <- tabla_con_clave_ff$`Tipo de piso`
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 4101011001 1 4101 376 2017
2 4101021001 1 4101 532 2017
3 4101021002 1 4101 762 2017
4 4101021003 1 4101 738 2017
5 4101021004 1 4101 1306 2017
6 4101021005 1 4101 444 2017
7 4101031001 1 4101 1549 2017
8 4101031002 1 4101 876 2017
9 4101031003 1 4101 1441 2017
10 4101041001 1 4101 440 2017
11 4101041002 1 4101 480 2017
12 4101041003 1 4101 1578 2017
13 4101041004 1 4101 1157 2017
14 4101041005 1 4101 359 2017
15 4101041006 1 4101 343 2017
16 4101051001 1 4101 473 2017
17 4101051002 1 4101 969 2017
18 4101051003 1 4101 922 2017
19 4101051004 1 4101 859 2017
20 4101051005 1 4101 1684 2017
21 4101051006 1 4101 1322 2017
22 4101051007 1 4101 787 2017
23 4101051008 1 4101 1238 2017
24 4101051009 1 4101 1146 2017
25 4101051010 1 4101 1143 2017
26 4101051011 1 4101 951 2017
27 4101061001 1 4101 1359 2017
28 4101061002 1 4101 905 2017
29 4101061003 1 4101 1046 2017
30 4101061004 1 4101 1643 2017
31 4101061005 1 4101 68 2017
32 4101071001 1 4101 212 2017
33 4101091001 1 4101 290 2017
34 4101141001 1 4101 622 2017
35 4101141002 1 4101 672 2017
36 4101141003 1 4101 1357 2017
37 4101141004 1 4101 1096 2017
38 4101141005 1 4101 1850 2017
39 4101141006 1 4101 579 2017
40 4101151001 1 4101 1585 2017
41 4101151002 1 4101 545 2017
42 4101151003 1 4101 656 2017
43 4101151004 1 4101 894 2017
44 4101151005 1 4101 751 2017
45 4101151006 1 4101 1028 2017
46 4101161001 1 4101 1537 2017
47 4101161002 1 4101 735 2017
48 4101161003 1 4101 611 2017
49 4101161004 1 4101 1074 2017
50 4101161005 1 4101 1257 2017
51 4101161006 1 4101 1234 2017
52 4101161007 1 4101 1226 2017
53 4101161008 1 4101 1216 2017
54 4101161009 1 4101 1192 2017
55 4101161010 1 4101 1146 2017
56 4101171001 1 4101 607 2017
57 4101171002 1 4101 735 2017
58 4101171003 1 4101 954 2017
59 4101171004 1 4101 1210 2017
60 4101171005 1 4101 1252 2017
61 4101991999 1 4101 197 2017
255 4102011001 1 4102 1296 2017
256 4102011002 1 4102 561 2017
257 4102021001 1 4102 1011 2017
258 4102021002 1 4102 488 2017
259 4102021003 1 4102 497 2017
260 4102021004 1 4102 881 2017
261 4102021005 1 4102 543 2017
262 4102021006 1 4102 648 2017
263 4102031001 1 4102 634 2017
264 4102031002 1 4102 930 2017
265 4102031003 1 4102 622 2017
266 4102031004 1 4102 655 2017
267 4102041001 1 4102 534 2017
268 4102041002 1 4102 529 2017
269 4102051001 1 4102 1437 2017
270 4102051002 1 4102 1635 2017
271 4102051003 1 4102 1366 2017
272 4102051004 1 4102 5 2017
273 4102051005 1 4102 1485 2017
274 4102051006 1 4102 1182 2017
275 4102051007 1 4102 924 2017
276 4102051008 1 4102 742 2017
277 4102061001 1 4102 978 2017
278 4102061002 1 4102 1712 2017
279 4102061003 1 4102 81 2017
280 4102061004 1 4102 1279 2017
281 4102061005 1 4102 1852 2017
282 4102061006 1 4102 1375 2017
283 4102081001 1 4102 779 2017
284 4102081002 1 4102 863 2017
285 4102091001 1 4102 343 2017
286 4102091002 1 4102 735 2017
287 4102091003 1 4102 787 2017
288 4102091004 1 4102 599 2017
289 4102091005 1 4102 903 2017
290 4102091006 1 4102 946 2017
291 4102091007 1 4102 1648 2017
292 4102091008 1 4102 1655 2017
293 4102101001 1 4102 336 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 4101011001 376 2017 04101
2 4101021001 532 2017 04101
3 4101021002 762 2017 04101
4 4101021003 738 2017 04101
5 4101021004 1306 2017 04101
6 4101021005 444 2017 04101
7 4101031001 1549 2017 04101
8 4101031002 876 2017 04101
9 4101031003 1441 2017 04101
10 4101041001 440 2017 04101
11 4101041002 480 2017 04101
12 4101041003 1578 2017 04101
13 4101041004 1157 2017 04101
14 4101041005 359 2017 04101
15 4101041006 343 2017 04101
16 4101051001 473 2017 04101
17 4101051002 969 2017 04101
18 4101051003 922 2017 04101
19 4101051004 859 2017 04101
20 4101051005 1684 2017 04101
21 4101051006 1322 2017 04101
22 4101051007 787 2017 04101
23 4101051008 1238 2017 04101
24 4101051009 1146 2017 04101
25 4101051010 1143 2017 04101
26 4101051011 951 2017 04101
27 4101061001 1359 2017 04101
28 4101061002 905 2017 04101
29 4101061003 1046 2017 04101
30 4101061004 1643 2017 04101
31 4101061005 68 2017 04101
32 4101071001 212 2017 04101
33 4101091001 290 2017 04101
34 4101141001 622 2017 04101
35 4101141002 672 2017 04101
36 4101141003 1357 2017 04101
37 4101141004 1096 2017 04101
38 4101141005 1850 2017 04101
39 4101141006 579 2017 04101
40 4101151001 1585 2017 04101
41 4101151002 545 2017 04101
42 4101151003 656 2017 04101
43 4101151004 894 2017 04101
44 4101151005 751 2017 04101
45 4101151006 1028 2017 04101
46 4101161001 1537 2017 04101
47 4101161002 735 2017 04101
48 4101161003 611 2017 04101
49 4101161004 1074 2017 04101
50 4101161005 1257 2017 04101
51 4101161006 1234 2017 04101
52 4101161007 1226 2017 04101
53 4101161008 1216 2017 04101
54 4101161009 1192 2017 04101
55 4101161010 1146 2017 04101
56 4101171001 607 2017 04101
57 4101171002 735 2017 04101
58 4101171003 954 2017 04101
59 4101171004 1210 2017 04101
60 4101171005 1252 2017 04101
61 4101991999 197 2017 04101
255 4102011001 1296 2017 04102
256 4102011002 561 2017 04102
257 4102021001 1011 2017 04102
258 4102021002 488 2017 04102
259 4102021003 497 2017 04102
260 4102021004 881 2017 04102
261 4102021005 543 2017 04102
262 4102021006 648 2017 04102
263 4102031001 634 2017 04102
264 4102031002 930 2017 04102
265 4102031003 622 2017 04102
266 4102031004 655 2017 04102
267 4102041001 534 2017 04102
268 4102041002 529 2017 04102
269 4102051001 1437 2017 04102
270 4102051002 1635 2017 04102
271 4102051003 1366 2017 04102
272 4102051004 5 2017 04102
273 4102051005 1485 2017 04102
274 4102051006 1182 2017 04102
275 4102051007 924 2017 04102
276 4102051008 742 2017 04102
277 4102061001 978 2017 04102
278 4102061002 1712 2017 04102
279 4102061003 81 2017 04102
280 4102061004 1279 2017 04102
281 4102061005 1852 2017 04102
282 4102061006 1375 2017 04102
283 4102081001 779 2017 04102
284 4102081002 863 2017 04102
285 4102091001 343 2017 04102
286 4102091002 735 2017 04102
287 4102091003 787 2017 04102
288 4102091004 599 2017 04102
289 4102091005 903 2017 04102
290 4102091006 946 2017 04102
291 4102091007 1648 2017 04102
292 4102091008 1655 2017 04102
293 4102101001 336 2017 04102


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_urbano_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 375676.9 2017 1101 191468 71930106513
01107 Alto Hospicio 311571.7 2017 1107 108375 33766585496
01401 Pozo Almonte 316138.5 2017 1401 15711 4966851883
01405 Pica 330061.1 2017 1405 9296 3068247619
02101 Antofagasta 368221.4 2017 2101 361873 133249367039
02102 Mejillones 369770.7 2017 2102 13467 4979702302
02104 Taltal 383666.2 2017 2104 13317 5109282942
02201 Calama 434325.1 2017 2201 165731 71981127235
02203 San Pedro de Atacama 442861.0 2017 2203 10996 4869699464
02301 Tocopilla 286187.2 2017 2301 25186 7207910819
02302 María Elena 477748.0 2017 2302 6457 3084818966
03101 Copiapó 343121.0 2017 3101 153937 52819016037
03102 Caldera 318653.2 2017 3102 17662 5628052276
03103 Tierra Amarilla 333194.9 2017 3103 14019 4671058718
03201 Chañaral 286389.3 2017 3201 12219 3499391196
03202 Diego de Almagro 351583.9 2017 3202 13925 4895805596
03301 Vallenar 315981.5 2017 3301 51917 16404810756
03303 Freirina 289049.9 2017 3303 7041 2035200054
03304 Huasco 337414.8 2017 3304 10149 3424422750
04101 La Serena 279340.1 2017 4101 221054 61749247282
04102 Coquimbo 269078.6 2017 4102 227730 61277269093
04103 Andacollo 258539.7 2017 4103 11044 2855312920
04104 La Higuera 214257.0 2017 4104 4241 908664019
04106 Vicuña 254177.0 2017 4106 27771 7058750373
04201 Illapel 282139.3 2017 4201 30848 8703433491
04202 Canela 233397.3 2017 4202 9093 2122281844
04203 Los Vilos 285214.0 2017 4203 21382 6098444926
04204 Salamanca 262056.9 2017 4204 29347 7690585032
04301 Ovalle 280373.5 2017 4301 111272 31197719080
04302 Combarbalá 234537.3 2017 4302 13322 3124505460
04303 Monte Patria 225369.1 2017 4303 30751 6930326684
04304 Punitaqui 212496.1 2017 4304 10956 2328107498
05101 Valparaíso 306572.5 2017 5101 296655 90946261553
05102 Casablanca 348088.6 2017 5102 26867 9352095757
05103 Concón 333932.4 2017 5103 42152 14075920021
05105 Puchuncaví 296035.5 2017 5105 18546 5490274928
05107 Quintero 308224.7 2017 5107 31923 9839456903
05109 Viña del Mar 354715.9 2017 5109 334248 118563074323
05301 Los Andes 355446.2 2017 5301 66708 23711104774
05302 Calle Larga 246387.3 2017 5302 14832 3654416747
05303 Rinconada 279807.9 2017 5303 10207 2855998928
05304 San Esteban 219571.6 2017 5304 18855 4140022481
05401 La Ligua 259482.3 2017 5401 35390 9183080280
05402 Cabildo 262745.9 2017 5402 19388 5094117762
05403 Papudo 302317.1 2017 5403 6356 1921527704
05404 Petorca 237510.8 2017 5404 9826 2333781007
05405 Zapallar 294389.2 2017 5405 7339 2160521991
05501 Quillota 288694.2 2017 5501 90517 26131733924
05502 Calera 282823.6 2017 5502 50554 14297866792
05503 Hijuelas 268449.7 2017 5503 17988 4828872604

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)
comunas_con_ing_exp <-comunas_con_ing_exp[!(is.na(comunas_con_ing_exp$Ingresos_expandidos)),]
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
04101 4101011001 376 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101021001 532 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101021002 762 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101021003 738 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101021004 1306 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101021005 444 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101031001 1549 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101031002 876 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101031003 1441 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101041001 440 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101041002 480 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101041003 1578 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101041004 1157 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101041005 359 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101041006 343 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051001 473 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051002 969 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051003 922 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051004 859 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051005 1684 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051006 1322 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051007 787 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051008 1238 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051009 1146 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051010 1143 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051011 951 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101061001 1359 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101061002 905 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101061003 1046 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101061004 1643 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101061005 68 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101071001 212 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101091001 290 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101141001 622 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101141002 672 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101141003 1357 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101141004 1096 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101141005 1850 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101141006 579 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101151001 1585 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101151002 545 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101151003 656 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101151004 894 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101151005 751 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101151006 1028 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161001 1537 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161002 735 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161003 611 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161004 1074 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161005 1257 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161006 1234 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161007 1226 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161008 1216 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161009 1192 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161010 1146 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101171001 607 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101171002 735 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101171003 954 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101171004 1210 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101171005 1252 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101991999 197 2017 La Serena 279340.1 2017 4101 221054 61749247282
04102 4102011001 1296 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102011002 561 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102021001 1011 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102021002 488 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102021003 497 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102021004 881 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102021005 543 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102021006 648 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102031001 634 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102031002 930 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102031003 622 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102031004 655 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102041001 534 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102041002 529 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051001 1437 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051002 1635 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051003 1366 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051004 5 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051005 1485 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051006 1182 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051007 924 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051008 742 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102061001 978 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102061002 1712 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102061003 81 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102061004 1279 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102061005 1852 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102061006 1375 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102081001 779 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102081002 863 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091001 343 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091002 735 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091003 787 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091004 599 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091005 903 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091006 946 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091007 1648 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091008 1655 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102101001 336 2017 Coquimbo 269078.6 2017 4102 227730 61277269093


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
04101 4101011001 376 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101021001 532 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101021002 762 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101021003 738 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101021004 1306 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101021005 444 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101031001 1549 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101031002 876 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101031003 1441 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101041001 440 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101041002 480 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101041003 1578 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101041004 1157 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101041005 359 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101041006 343 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051001 473 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051002 969 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051003 922 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051004 859 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051005 1684 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051006 1322 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051007 787 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051008 1238 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051009 1146 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051010 1143 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101051011 951 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101061001 1359 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101061002 905 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101061003 1046 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101061004 1643 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101061005 68 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101071001 212 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101091001 290 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101141001 622 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101141002 672 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101141003 1357 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101141004 1096 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101141005 1850 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101141006 579 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101151001 1585 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101151002 545 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101151003 656 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101151004 894 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101151005 751 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101151006 1028 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161001 1537 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161002 735 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161003 611 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161004 1074 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161005 1257 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161006 1234 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161007 1226 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161008 1216 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161009 1192 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101161010 1146 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101171001 607 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101171002 735 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101171003 954 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101171004 1210 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101171005 1252 2017 La Serena 279340.1 2017 4101 221054 61749247282
04101 4101991999 197 2017 La Serena 279340.1 2017 4101 221054 61749247282
04102 4102011001 1296 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102011002 561 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102021001 1011 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102021002 488 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102021003 497 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102021004 881 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102021005 543 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102021006 648 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102031001 634 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102031002 930 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102031003 622 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102031004 655 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102041001 534 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102041002 529 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051001 1437 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051002 1635 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051003 1366 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051004 5 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051005 1485 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051006 1182 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051007 924 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102051008 742 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102061001 978 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102061002 1712 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102061003 81 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102061004 1279 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102061005 1852 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102061006 1375 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102081001 779 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102081002 863 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091001 343 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091002 735 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091003 787 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091004 599 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091005 903 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091006 946 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091007 1648 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102091008 1655 2017 Coquimbo 269078.6 2017 4102 227730 61277269093
04102 4102101001 336 2017 Coquimbo 269078.6 2017 4102 227730 61277269093


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
4101011001 04101 376 2017 La Serena 279340.1 2017 4101 221054 61749247282 1455 0.0065821 04101
4101021001 04101 532 2017 La Serena 279340.1 2017 4101 221054 61749247282 2431 0.0109973 04101
4101021002 04101 762 2017 La Serena 279340.1 2017 4101 221054 61749247282 2926 0.0132366 04101
4101021003 04101 738 2017 La Serena 279340.1 2017 4101 221054 61749247282 2699 0.0122097 04101
4101021004 04101 1306 2017 La Serena 279340.1 2017 4101 221054 61749247282 5323 0.0240801 04101
4101021005 04101 444 2017 La Serena 279340.1 2017 4101 221054 61749247282 2125 0.0096130 04101
4101031001 04101 1549 2017 La Serena 279340.1 2017 4101 221054 61749247282 4341 0.0196377 04101
4101031002 04101 876 2017 La Serena 279340.1 2017 4101 221054 61749247282 2583 0.0116849 04101
4101031003 04101 1441 2017 La Serena 279340.1 2017 4101 221054 61749247282 4026 0.0182127 04101
4101041001 04101 440 2017 La Serena 279340.1 2017 4101 221054 61749247282 1108 0.0050123 04101
4101041002 04101 480 2017 La Serena 279340.1 2017 4101 221054 61749247282 1015 0.0045916 04101
4101041003 04101 1578 2017 La Serena 279340.1 2017 4101 221054 61749247282 4721 0.0213568 04101
4101041004 04101 1157 2017 La Serena 279340.1 2017 4101 221054 61749247282 3560 0.0161047 04101
4101041005 04101 359 2017 La Serena 279340.1 2017 4101 221054 61749247282 812 0.0036733 04101
4101041006 04101 343 2017 La Serena 279340.1 2017 4101 221054 61749247282 821 0.0037140 04101
4101051001 04101 473 2017 La Serena 279340.1 2017 4101 221054 61749247282 1419 0.0064192 04101
4101051002 04101 969 2017 La Serena 279340.1 2017 4101 221054 61749247282 2920 0.0132094 04101
4101051003 04101 922 2017 La Serena 279340.1 2017 4101 221054 61749247282 3348 0.0151456 04101
4101051004 04101 859 2017 La Serena 279340.1 2017 4101 221054 61749247282 2851 0.0128973 04101
4101051005 04101 1684 2017 La Serena 279340.1 2017 4101 221054 61749247282 5493 0.0248491 04101
4101051006 04101 1322 2017 La Serena 279340.1 2017 4101 221054 61749247282 4295 0.0194296 04101
4101051007 04101 787 2017 La Serena 279340.1 2017 4101 221054 61749247282 2336 0.0105676 04101
4101051008 04101 1238 2017 La Serena 279340.1 2017 4101 221054 61749247282 4235 0.0191582 04101
4101051009 04101 1146 2017 La Serena 279340.1 2017 4101 221054 61749247282 3882 0.0175613 04101
4101051010 04101 1143 2017 La Serena 279340.1 2017 4101 221054 61749247282 3226 0.0145937 04101
4101051011 04101 951 2017 La Serena 279340.1 2017 4101 221054 61749247282 2966 0.0134175 04101
4101061001 04101 1359 2017 La Serena 279340.1 2017 4101 221054 61749247282 4424 0.0200132 04101
4101061002 04101 905 2017 La Serena 279340.1 2017 4101 221054 61749247282 3047 0.0137840 04101
4101061003 04101 1046 2017 La Serena 279340.1 2017 4101 221054 61749247282 3472 0.0157066 04101
4101061004 04101 1643 2017 La Serena 279340.1 2017 4101 221054 61749247282 5333 0.0241253 04101
4101061005 04101 68 2017 La Serena 279340.1 2017 4101 221054 61749247282 288 0.0013028 04101
4101071001 04101 212 2017 La Serena 279340.1 2017 4101 221054 61749247282 1056 0.0047771 04101
4101091001 04101 290 2017 La Serena 279340.1 2017 4101 221054 61749247282 1292 0.0058447 04101
4101141001 04101 622 2017 La Serena 279340.1 2017 4101 221054 61749247282 2872 0.0129923 04101
4101141002 04101 672 2017 La Serena 279340.1 2017 4101 221054 61749247282 2750 0.0124404 04101
4101141003 04101 1357 2017 La Serena 279340.1 2017 4101 221054 61749247282 4706 0.0212889 04101
4101141004 04101 1096 2017 La Serena 279340.1 2017 4101 221054 61749247282 3750 0.0169642 04101
4101141005 04101 1850 2017 La Serena 279340.1 2017 4101 221054 61749247282 5866 0.0265365 04101
4101141006 04101 579 2017 La Serena 279340.1 2017 4101 221054 61749247282 2114 0.0095633 04101
4101151001 04101 1585 2017 La Serena 279340.1 2017 4101 221054 61749247282 4957 0.0224244 04101
4101151002 04101 545 2017 La Serena 279340.1 2017 4101 221054 61749247282 1602 0.0072471 04101
4101151003 04101 656 2017 La Serena 279340.1 2017 4101 221054 61749247282 1900 0.0085952 04101
4101151004 04101 894 2017 La Serena 279340.1 2017 4101 221054 61749247282 2649 0.0119835 04101
4101151005 04101 751 2017 La Serena 279340.1 2017 4101 221054 61749247282 2047 0.0092602 04101
4101151006 04101 1028 2017 La Serena 279340.1 2017 4101 221054 61749247282 3173 0.0143540 04101
4101161001 04101 1537 2017 La Serena 279340.1 2017 4101 221054 61749247282 5756 0.0260389 04101
4101161002 04101 735 2017 La Serena 279340.1 2017 4101 221054 61749247282 3690 0.0166928 04101
4101161003 04101 611 2017 La Serena 279340.1 2017 4101 221054 61749247282 2952 0.0133542 04101
4101161004 04101 1074 2017 La Serena 279340.1 2017 4101 221054 61749247282 5185 0.0234558 04101
4101161005 04101 1257 2017 La Serena 279340.1 2017 4101 221054 61749247282 4746 0.0214699 04101
4101161006 04101 1234 2017 La Serena 279340.1 2017 4101 221054 61749247282 4464 0.0201942 04101
4101161007 04101 1226 2017 La Serena 279340.1 2017 4101 221054 61749247282 5497 0.0248672 04101
4101161008 04101 1216 2017 La Serena 279340.1 2017 4101 221054 61749247282 4352 0.0196875 04101
4101161009 04101 1192 2017 La Serena 279340.1 2017 4101 221054 61749247282 4309 0.0194930 04101
4101161010 04101 1146 2017 La Serena 279340.1 2017 4101 221054 61749247282 4752 0.0214970 04101
4101171001 04101 607 2017 La Serena 279340.1 2017 4101 221054 61749247282 2644 0.0119609 04101
4101171002 04101 735 2017 La Serena 279340.1 2017 4101 221054 61749247282 2927 0.0132411 04101
4101171003 04101 954 2017 La Serena 279340.1 2017 4101 221054 61749247282 5093 0.0230396 04101
4101171004 04101 1210 2017 La Serena 279340.1 2017 4101 221054 61749247282 4747 0.0214744 04101
4101171005 04101 1252 2017 La Serena 279340.1 2017 4101 221054 61749247282 4515 0.0204249 04101
4101991999 04101 197 2017 La Serena 279340.1 2017 4101 221054 61749247282 796 0.0036009 04101
4102011001 04102 1296 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6389 0.0280552 04102
4102011002 04102 561 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2328 0.0102226 04102
4102021001 04102 1011 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4724 0.0207439 04102
4102021002 04102 488 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2101 0.0092258 04102
4102021003 04102 497 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2094 0.0091951 04102
4102021004 04102 881 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4472 0.0196373 04102
4102021005 04102 543 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2188 0.0096079 04102
4102021006 04102 648 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3498 0.0153603 04102
4102031001 04102 634 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2056 0.0090282 04102
4102031002 04102 930 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3483 0.0152944 04102
4102031003 04102 622 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2188 0.0096079 04102
4102031004 04102 655 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2324 0.0102051 04102
4102041001 04102 534 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1800 0.0079041 04102
4102041002 04102 529 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1873 0.0082247 04102
4102051001 04102 1437 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4645 0.0203970 04102
4102051002 04102 1635 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 5393 0.0236816 04102
4102051003 04102 1366 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4578 0.0201028 04102
4102051004 04102 5 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 15 0.0000659 04102
4102051005 04102 1485 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4613 0.0202564 04102
4102051006 04102 1182 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4305 0.0189040 04102
4102051007 04102 924 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2872 0.0126114 04102
4102051008 04102 742 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2455 0.0107803 04102
4102061001 04102 978 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4034 0.0177140 04102
4102061002 04102 1712 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6820 0.0299477 04102
4102061003 04102 81 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 309 0.0013569 04102
4102061004 04102 1279 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4293 0.0188513 04102
4102061005 04102 1852 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6111 0.0268344 04102
4102061006 04102 1375 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4633 0.0203443 04102
4102081001 04102 779 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2323 0.0102007 04102
4102081002 04102 863 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3139 0.0137839 04102
4102091001 04102 343 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1423 0.0062486 04102
4102091002 04102 735 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2821 0.0123875 04102
4102091003 04102 787 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3087 0.0135555 04102
4102091004 04102 599 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2580 0.0113292 04102
4102091005 04102 903 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3863 0.0169631 04102
4102091006 04102 946 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3170 0.0139200 04102
4102091007 04102 1648 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6290 0.0276204 04102
4102091008 04102 1655 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 5782 0.0253897 04102
4102101001 04102 336 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1476 0.0064814 04102


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
4101011001 04101 376 2017 La Serena 279340.1 2017 4101 221054 61749247282 1455 0.0065821 04101 406439851
4101021001 04101 532 2017 La Serena 279340.1 2017 4101 221054 61749247282 2431 0.0109973 04101 679075792
4101021002 04101 762 2017 La Serena 279340.1 2017 4101 221054 61749247282 2926 0.0132366 04101 817349143
4101021003 04101 738 2017 La Serena 279340.1 2017 4101 221054 61749247282 2699 0.0122097 04101 753938940
4101021004 04101 1306 2017 La Serena 279340.1 2017 4101 221054 61749247282 5323 0.0240801 04101 1486927372
4101021005 04101 444 2017 La Serena 279340.1 2017 4101 221054 61749247282 2125 0.0096130 04101 593597720
4101031001 04101 1549 2017 La Serena 279340.1 2017 4101 221054 61749247282 4341 0.0196377 04101 1212615390
4101031002 04101 876 2017 La Serena 279340.1 2017 4101 221054 61749247282 2583 0.0116849 04101 721535488
4101031003 04101 1441 2017 La Serena 279340.1 2017 4101 221054 61749247282 4026 0.0182127 04101 1124623257
4101041001 04101 440 2017 La Serena 279340.1 2017 4101 221054 61749247282 1108 0.0050123 04101 309508835
4101041002 04101 480 2017 La Serena 279340.1 2017 4101 221054 61749247282 1015 0.0045916 04101 283530205
4101041003 04101 1578 2017 La Serena 279340.1 2017 4101 221054 61749247282 4721 0.0213568 04101 1318764630
4101041004 04101 1157 2017 La Serena 279340.1 2017 4101 221054 61749247282 3560 0.0161047 04101 994450769
4101041005 04101 359 2017 La Serena 279340.1 2017 4101 221054 61749247282 812 0.0036733 04101 226824164
4101041006 04101 343 2017 La Serena 279340.1 2017 4101 221054 61749247282 821 0.0037140 04101 229338225
4101051001 04101 473 2017 La Serena 279340.1 2017 4101 221054 61749247282 1419 0.0064192 04101 396383607
4101051002 04101 969 2017 La Serena 279340.1 2017 4101 221054 61749247282 2920 0.0132094 04101 815673103
4101051003 04101 922 2017 La Serena 279340.1 2017 4101 221054 61749247282 3348 0.0151456 04101 935230667
4101051004 04101 859 2017 La Serena 279340.1 2017 4101 221054 61749247282 2851 0.0128973 04101 796398636
4101051005 04101 1684 2017 La Serena 279340.1 2017 4101 221054 61749247282 5493 0.0248491 04101 1534415190
4101051006 04101 1322 2017 La Serena 279340.1 2017 4101 221054 61749247282 4295 0.0194296 04101 1199765745
4101051007 04101 787 2017 La Serena 279340.1 2017 4101 221054 61749247282 2336 0.0105676 04101 652538482
4101051008 04101 1238 2017 La Serena 279340.1 2017 4101 221054 61749247282 4235 0.0191582 04101 1183005339
4101051009 04101 1146 2017 La Serena 279340.1 2017 4101 221054 61749247282 3882 0.0175613 04101 1084398283
4101051010 04101 1143 2017 La Serena 279340.1 2017 4101 221054 61749247282 3226 0.0145937 04101 901151175
4101051011 04101 951 2017 La Serena 279340.1 2017 4101 221054 61749247282 2966 0.0134175 04101 828522748
4101061001 04101 1359 2017 La Serena 279340.1 2017 4101 221054 61749247282 4424 0.0200132 04101 1235800619
4101061002 04101 905 2017 La Serena 279340.1 2017 4101 221054 61749247282 3047 0.0137840 04101 851149296
4101061003 04101 1046 2017 La Serena 279340.1 2017 4101 221054 61749247282 3472 0.0157066 04101 969868840
4101061004 04101 1643 2017 La Serena 279340.1 2017 4101 221054 61749247282 5333 0.0241253 04101 1489720773
4101061005 04101 68 2017 La Serena 279340.1 2017 4101 221054 61749247282 288 0.0013028 04101 80449950
4101071001 04101 212 2017 La Serena 279340.1 2017 4101 221054 61749247282 1056 0.0047771 04101 294983150
4101091001 04101 290 2017 La Serena 279340.1 2017 4101 221054 61749247282 1292 0.0058447 04101 360907414
4101141001 04101 622 2017 La Serena 279340.1 2017 4101 221054 61749247282 2872 0.0129923 04101 802264778
4101141002 04101 672 2017 La Serena 279340.1 2017 4101 221054 61749247282 2750 0.0124404 04101 768185285
4101141003 04101 1357 2017 La Serena 279340.1 2017 4101 221054 61749247282 4706 0.0212889 04101 1314574528
4101141004 04101 1096 2017 La Serena 279340.1 2017 4101 221054 61749247282 3750 0.0169642 04101 1047525389
4101141005 04101 1850 2017 La Serena 279340.1 2017 4101 221054 61749247282 5866 0.0265365 04101 1638609048
4101141006 04101 579 2017 La Serena 279340.1 2017 4101 221054 61749247282 2114 0.0095633 04101 590524979
4101151001 04101 1585 2017 La Serena 279340.1 2017 4101 221054 61749247282 4957 0.0224244 04101 1384688894
4101151002 04101 545 2017 La Serena 279340.1 2017 4101 221054 61749247282 1602 0.0072471 04101 447502846
4101151003 04101 656 2017 La Serena 279340.1 2017 4101 221054 61749247282 1900 0.0085952 04101 530746197
4101151004 04101 894 2017 La Serena 279340.1 2017 4101 221054 61749247282 2649 0.0119835 04101 739971935
4101151005 04101 751 2017 La Serena 279340.1 2017 4101 221054 61749247282 2047 0.0092602 04101 571809192
4101151006 04101 1028 2017 La Serena 279340.1 2017 4101 221054 61749247282 3173 0.0143540 04101 886346149
4101161001 04101 1537 2017 La Serena 279340.1 2017 4101 221054 61749247282 5756 0.0260389 04101 1607881637
4101161002 04101 735 2017 La Serena 279340.1 2017 4101 221054 61749247282 3690 0.0166928 04101 1030764983
4101161003 04101 611 2017 La Serena 279340.1 2017 4101 221054 61749247282 2952 0.0133542 04101 824611986
4101161004 04101 1074 2017 La Serena 279340.1 2017 4101 221054 61749247282 5185 0.0234558 04101 1448378438
4101161005 04101 1257 2017 La Serena 279340.1 2017 4101 221054 61749247282 4746 0.0214699 04101 1325748132
4101161006 04101 1234 2017 La Serena 279340.1 2017 4101 221054 61749247282 4464 0.0201942 04101 1246974223
4101161007 04101 1226 2017 La Serena 279340.1 2017 4101 221054 61749247282 5497 0.0248672 04101 1535532550
4101161008 04101 1216 2017 La Serena 279340.1 2017 4101 221054 61749247282 4352 0.0196875 04101 1215688131
4101161009 04101 1192 2017 La Serena 279340.1 2017 4101 221054 61749247282 4309 0.0194930 04101 1203676507
4101161010 04101 1146 2017 La Serena 279340.1 2017 4101 221054 61749247282 4752 0.0214970 04101 1327424173
4101171001 04101 607 2017 La Serena 279340.1 2017 4101 221054 61749247282 2644 0.0119609 04101 738575234
4101171002 04101 735 2017 La Serena 279340.1 2017 4101 221054 61749247282 2927 0.0132411 04101 817628484
4101171003 04101 954 2017 La Serena 279340.1 2017 4101 221054 61749247282 5093 0.0230396 04101 1422679148
4101171004 04101 1210 2017 La Serena 279340.1 2017 4101 221054 61749247282 4747 0.0214744 04101 1326027472
4101171005 04101 1252 2017 La Serena 279340.1 2017 4101 221054 61749247282 4515 0.0204249 04101 1261220568
4101991999 04101 197 2017 La Serena 279340.1 2017 4101 221054 61749247282 796 0.0036009 04101 222354723
4102011001 04102 1296 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6389 0.0280552 04102 1719143162
4102011002 04102 561 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2328 0.0102226 04102 626414976
4102021001 04102 1011 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4724 0.0207439 04102 1271127296
4102021002 04102 488 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2101 0.0092258 04102 565334134
4102021003 04102 497 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2094 0.0091951 04102 563450584
4102021004 04102 881 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4472 0.0196373 04102 1203319490
4102021005 04102 543 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2188 0.0096079 04102 588743972
4102021006 04102 648 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3498 0.0153603 04102 941236935
4102031001 04102 634 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2056 0.0090282 04102 553225597
4102031002 04102 930 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3483 0.0152944 04102 937200756
4102031003 04102 622 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2188 0.0096079 04102 588743972
4102031004 04102 655 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2324 0.0102051 04102 625338661
4102041001 04102 534 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1800 0.0079041 04102 484341476
4102041002 04102 529 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1873 0.0082247 04102 503984214
4102051001 04102 1437 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4645 0.0203970 04102 1249870087
4102051002 04102 1635 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 5393 0.0236816 04102 1451140878
4102051003 04102 1366 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4578 0.0201028 04102 1231841821
4102051004 04102 5 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 15 0.0000659 04102 4036179
4102051005 04102 1485 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4613 0.0202564 04102 1241259572
4102051006 04102 1182 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4305 0.0189040 04102 1158383364
4102051007 04102 924 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2872 0.0126114 04102 772793733
4102051008 04102 742 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2455 0.0107803 04102 660587958
4102061001 04102 978 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4034 0.0177140 04102 1085463064
4102061002 04102 1712 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6820 0.0299477 04102 1835116037
4102061003 04102 81 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 309 0.0013569 04102 83145287
4102061004 04102 1279 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4293 0.0188513 04102 1155154421
4102061005 04102 1852 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6111 0.0268344 04102 1644339312
4102061006 04102 1375 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4633 0.0203443 04102 1246641144
4102081001 04102 779 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2323 0.0102007 04102 625069583
4102081002 04102 863 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3139 0.0137839 04102 844637719
4102091001 04102 343 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1423 0.0062486 04102 382898845
4102091002 04102 735 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2821 0.0123875 04102 759070725
4102091003 04102 787 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3087 0.0135555 04102 830645632
4102091004 04102 599 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2580 0.0113292 04102 694222783
4102091005 04102 903 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3863 0.0169631 04102 1039450624
4102091006 04102 946 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3170 0.0139200 04102 852979155
4102091007 04102 1648 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6290 0.0276204 04102 1692504381
4102091008 04102 1655 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 5782 0.0253897 04102 1555812453
4102101001 04102 336 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1476 0.0064814 04102 397160010

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 loess

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 
## -294701357  -86138039  -16269587   51612906  476023651 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 47712923   19496083   2.447   0.0153 *  
## Freq.x        942288      19737  47.741   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 128700000 on 191 degrees of freedom
## Multiple R-squared:  0.9227, Adjusted R-squared:  0.9223 
## F-statistic:  2279 on 1 and 191 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

linearMod <- lm( multi_pob~(Freq.x^2) , data=h_y_m_comuna_corr_01)
datos <- summary(linearMod)
dato <- datos$adj.r.squared
modelo <- "cuadrático"
sintaxis <- "linearMod <- lm( multi_pob~(Freq.x^2) , data=h_y_m_comuna_corr_01)"
latex <- "$$ '\'hat Y = '\'beta_0 + '\'beta_1  X^2  $$"
modelos1 <- cbind(modelo,dato,sintaxis,latex)
 
### 8.2 Modelo cúbico
 
linearMod <- lm( multi_pob~(Freq.x^3) , data=h_y_m_comuna_corr_01)
datos <- summary(linearMod)
dato <- datos$adj.r.squared
modelo <- "cúbico"
sintaxis <- "linearMod <- lm( multi_pob~(Freq.x^3) , data=h_y_m_comuna_corr_01)"
latex <- "$$ '\'hat Y = '\'beta_0 + '\'beta_1  X^3  $$"
modelos2 <- cbind(modelo,dato,sintaxis,latex)
 
### 8.3 Modelo logarítmico
 
linearMod <- lm( multi_pob~log(Freq.x) , data=h_y_m_comuna_corr_01)
datos <- summary(linearMod)
dato <- datos$adj.r.squared
modelo <- "logarítmico"
sintaxis <- "linearMod <- lm( multi_pob~log(Freq.x) , data=h_y_m_comuna_corr_01)"
latex <- "$$ '\'hat Y = '\'beta_0 + '\'beta_1 ln X  $$"
modelos3 <- cbind(modelo,dato,sintaxis,latex)
 
### 8.5 Modelo con raíz cuadrada 
 
linearMod <- lm( multi_pob~sqrt(Freq.x) , data=h_y_m_comuna_corr_01)
datos <- summary(linearMod)
dato <- datos$adj.r.squared
modelo <- "raíz cuadrada"
sintaxis <- "linearMod <- lm( multi_pob~sqrt(Freq.x) , data=h_y_m_comuna_corr_01)"
latex <- "$$ '\'hat Y = '\'beta_0 + '\'beta_1  '\'sqrt {X}  $$"
modelos5 <- cbind(modelo,dato,sintaxis,latex)
 
### 8.6 Modelo raíz-raíz
 
linearMod <- lm( sqrt(multi_pob)~sqrt(Freq.x) , data=h_y_m_comuna_corr_01)
datos <- summary(linearMod)
dato <- datos$adj.r.squared
modelo <- "raíz-raíz"
sintaxis <- "linearMod <- lm( sqrt(multi_pob)~sqrt(Freq.x) , data=h_y_m_comuna_corr_01)"
latex <- "$$ '\'hat Y = {'\'beta_0}^2 + 2  '\'beta_0  '\'beta_1 '\'sqrt{X}+  '\'beta_1^2 X  $$"
modelos6 <- cbind(modelo,dato,sintaxis,latex)
 
### 8.7 Modelo log-raíz
 
linearMod <- lm( log(multi_pob)~sqrt(Freq.x) , data=h_y_m_comuna_corr_01)
datos <- summary(linearMod)
dato <- datos$adj.r.squared
modelo <- "log-raíz"
sintaxis <- "linearMod <- lm( log(multi_pob)~sqrt(Freq.x) , data=h_y_m_comuna_corr_01)"
latex <- "$$ '\'hat Y = e^{'\'beta_0 + '\'beta_1 '\'sqrt{X}} $$"
modelos7 <- cbind(modelo,dato,sintaxis,latex)
 
### 8.8 Modelo raíz-log
 
linearMod <- lm( sqrt(multi_pob)~log(Freq.x) , data=h_y_m_comuna_corr_01)
datos <- summary(linearMod)
dato <- datos$adj.r.squared
modelo <- "raíz-log"
sintaxis <- "linearMod <- lm( sqrt(multi_pob)~log(Freq.x) , data=h_y_m_comuna_corr_01)"
latex <- "$$ '\'hat Y = {'\'beta_0}^2 + 2  '\'beta_0  '\'beta_1 '\'ln{X}+  '\'beta_1^2 ln^2X  $$"
modelos8 <- cbind(modelo,dato,sintaxis,latex)
 
### 8.9 Modelo log-log
 
linearMod <- lm( log(multi_pob)~log(Freq.x) , data=h_y_m_comuna_corr_01)
datos <- summary(linearMod)
dato <- datos$adj.r.squared
modelo <- "log-log"
sintaxis <- "linearMod <- lm( log(multi_pob)~log(Freq.x) , data=h_y_m_comuna_corr_01)"
latex <- "$$ '\'hat Y = e^{'\'beta_0+'\'beta_1  ln{X}} $$"
modelos9 <- cbind(modelo,dato,sintaxis,latex)
 
modelos_bind <- rbind(modelos1,modelos2,modelos3,modelos5,modelos6,modelos7,modelos8,modelos9)
modelos_bind <- as.data.frame(modelos_bind)

modelos_bind <<- modelos_bind[order(modelos_bind$dato ),]
h_y_m_comuna_corr_01 <<- h_y_m_comuna_corr_01

kbl(modelos_bind) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  kable_paper() %>%
  scroll_box(width = "100%", height = "300px")
modelo dato sintaxis latex
3 logarítmico 0.63999970331006 linearMod <- lm( multi_pob~log(Freq.x) , data=h_y_m_comuna_corr_01) \[ ''hat Y = ''beta_0 + ''beta_1 ln X \]
6 log-raíz 0.816408583872768 linearMod <- lm( log(multi_pob)~sqrt(Freq.x) , data=h_y_m_comuna_corr_01) \[ ''hat Y = e^{''beta_0 + ''beta_1 ''sqrt{X}} \]
7 raíz-log 0.825843712907017 linearMod <- lm( sqrt(multi_pob)~log(Freq.x) , data=h_y_m_comuna_corr_01) \[ ''hat Y = {''beta_0}^2 + 2 ''beta_0 ''beta_1 ''ln{X}+ ''beta_1^2 ln^2X \]
4 raíz cuadrada 0.88509550225697 linearMod <- lm( multi_pob~sqrt(Freq.x) , data=h_y_m_comuna_corr_01) \[ ''hat Y = ''beta_0 + ''beta_1 ''sqrt {X} \]
1 cuadrático 0.92227444130024 linearMod <- lm( multi_pob~(Freq.x^2) , data=h_y_m_comuna_corr_01) \[ ''hat Y = ''beta_0 + ''beta_1 X^2 \]
2 cúbico 0.92227444130024 linearMod <- lm( multi_pob~(Freq.x^3) , data=h_y_m_comuna_corr_01) \[ ''hat Y = ''beta_0 + ''beta_1 X^3 \]
5 raíz-raíz 0.945887021141637 linearMod <- lm( sqrt(multi_pob)~sqrt(Freq.x) , data=h_y_m_comuna_corr_01) \[ ''hat Y = {''beta_0}^2 + 2 ''beta_0 ''beta_1 ''sqrt{X}+ ''beta_1^2 X \]
8 log-log 0.958780429287661 linearMod <- lm( log(multi_pob)~log(Freq.x) , data=h_y_m_comuna_corr_01) \[ ''hat Y = e^{''beta_0+''beta_1 ln{X}} \]
h_y_m_comuna_corr <- h_y_m_comuna_corr_01
metodo <- 8


switch (metodo,
        case = linearMod <- lm( multi_pob~(Freq.x^2) , data=h_y_m_comuna_corr),
        case = linearMod <- lm( multi_pob~(Freq.x^3) , data=h_y_m_comuna_corr),
        case = linearMod <- lm( multi_pob~log(Freq.x) , data=h_y_m_comuna_corr),
        case = linearMod <- lm( multi_pob~sqrt(Freq.x) , data=h_y_m_comuna_corr),
        case = linearMod <- lm( sqrt(multi_pob)~sqrt(Freq.x) , data=h_y_m_comuna_corr),
        case = linearMod <- lm( log(multi_pob)~sqrt(Freq.x) , data=h_y_m_comuna_corr),
        case = linearMod <- lm( sqrt(multi_pob)~log(Freq.x) , data=h_y_m_comuna_corr),
        case = linearMod <- lm( log(multi_pob)~log(Freq.x) , data=h_y_m_comuna_corr)
)
summary(linearMod)
## 
## Call:
## lm(formula = log(multi_pob) ~ log(Freq.x), data = h_y_m_comuna_corr)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.53509 -0.09912 -0.00938  0.09334  1.84502 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 13.97259    0.09578  145.89   <2e-16 ***
## log(Freq.x)  0.97595    0.01460   66.83   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2122 on 191 degrees of freedom
## Multiple R-squared:  0.959,  Adjusted R-squared:  0.9588 
## F-statistic:  4467 on 1 and 191 DF,  p-value: < 2.2e-16
aa <- linearMod$coefficients[1]
aa
## (Intercept) 
##    13.97259
bb <- linearMod$coefficients[2]
bb
## log(Freq.x) 
##   0.9759537

9 Modelo log-log (log-log)

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

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$Freq.x), y=log(h_y_m_comuna_corr$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)
summary(linearMod) 
## 
## Call:
## lm(formula = log(multi_pob) ~ log(Freq.x), data = h_y_m_comuna_corr)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.53509 -0.09912 -0.00938  0.09334  1.84502 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 13.97259    0.09578  145.89   <2e-16 ***
## log(Freq.x)  0.97595    0.01460   66.83   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2122 on 191 degrees of freedom
## Multiple R-squared:  0.959,  Adjusted R-squared:  0.9588 
## F-statistic:  4467 on 1 and 191 DF,  p-value: < 2.2e-16
ggplot(h_y_m_comuna_corr, 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^{13.97259 +0.9759537 \cdot ln{X}} \]


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$est_ing <- exp(aa+bb * log(h_y_m_comuna_corr$Freq.x))

r3_100 <- h_y_m_comuna_corr[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
4101011001 04101 376 2017 La Serena 279340.1 2017 4101 221054 61749247282 1455 0.0065821 04101 406439851 381488742
4101021001 04101 532 2017 La Serena 279340.1 2017 4101 221054 61749247282 2431 0.0109973 04101 679075792 535280186
4101021002 04101 762 2017 La Serena 279340.1 2017 4101 221054 61749247282 2926 0.0132366 04101 817349143 760102649
4101021003 04101 738 2017 La Serena 279340.1 2017 4101 221054 61749247282 2699 0.0122097 04101 753938940 736729137
4101021004 04101 1306 2017 La Serena 279340.1 2017 4101 221054 61749247282 5323 0.0240801 04101 1486927372 1285979091
4101021005 04101 444 2017 La Serena 279340.1 2017 4101 221054 61749247282 2125 0.0096130 04101 593597720 448684253
4101031001 04101 1549 2017 La Serena 279340.1 2017 4101 221054 61749247282 4341 0.0196377 04101 1212615390 1519008209
4101031002 04101 876 2017 La Serena 279340.1 2017 4101 221054 61749247282 2583 0.0116849 04101 721535488 870894203
4101031003 04101 1441 2017 La Serena 279340.1 2017 4101 221054 61749247282 4026 0.0182127 04101 1124623257 1415557239
4101041001 04101 440 2017 La Serena 279340.1 2017 4101 221054 61749247282 1108 0.0050123 04101 309508835 444738823
4101041002 04101 480 2017 La Serena 279340.1 2017 4101 221054 61749247282 1015 0.0045916 04101 283530205 484155567
4101041003 04101 1578 2017 La Serena 279340.1 2017 4101 221054 61749247282 4721 0.0213568 04101 1318764630 1546756662
4101041004 04101 1157 2017 La Serena 279340.1 2017 4101 221054 61749247282 3560 0.0161047 04101 994450769 1142586686
4101041005 04101 359 2017 La Serena 279340.1 2017 4101 221054 61749247282 812 0.0036733 04101 226824164 364646040
4101041006 04101 343 2017 La Serena 279340.1 2017 4101 221054 61749247282 821 0.0037140 04101 229338225 348776565
4101051001 04101 473 2017 La Serena 279340.1 2017 4101 221054 61749247282 1419 0.0064192 04101 396383607 477263532
4101051002 04101 969 2017 La Serena 279340.1 2017 4101 221054 61749247282 2920 0.0132094 04101 815673103 961017665
4101051003 04101 922 2017 La Serena 279340.1 2017 4101 221054 61749247282 3348 0.0151456 04101 935230667 915498723
4101051004 04101 859 2017 La Serena 279340.1 2017 4101 221054 61749247282 2851 0.0128973 04101 796398636 854395818
4101051005 04101 1684 2017 La Serena 279340.1 2017 4101 221054 61749247282 5493 0.0248491 04101 1534415190 1648079415
4101051006 04101 1322 2017 La Serena 279340.1 2017 4101 221054 61749247282 4295 0.0194296 04101 1199765745 1301352714
4101051007 04101 787 2017 La Serena 279340.1 2017 4101 221054 61749247282 2336 0.0105676 04101 652538482 784431245
4101051008 04101 1238 2017 La Serena 279340.1 2017 4101 221054 61749247282 4235 0.0191582 04101 1183005339 1220589952
4101051009 04101 1146 2017 La Serena 279340.1 2017 4101 221054 61749247282 3882 0.0175613 04101 1084398283 1131983717
4101051010 04101 1143 2017 La Serena 279340.1 2017 4101 221054 61749247282 3226 0.0145937 04101 901151175 1129091574
4101051011 04101 951 2017 La Serena 279340.1 2017 4101 221054 61749247282 2966 0.0134175 04101 828522748 943591295
4101061001 04101 1359 2017 La Serena 279340.1 2017 4101 221054 61749247282 4424 0.0200132 04101 1235800619 1336887174
4101061002 04101 905 2017 La Serena 279340.1 2017 4101 221054 61749247282 3047 0.0137840 04101 851149296 899020823
4101061003 04101 1046 2017 La Serena 279340.1 2017 4101 221054 61749247282 3472 0.0157066 04101 969868840 1035477704
4101061004 04101 1643 2017 La Serena 279340.1 2017 4101 221054 61749247282 5333 0.0241253 04101 1489720773 1608907274
4101061005 04101 68 2017 La Serena 279340.1 2017 4101 221054 61749247282 288 0.0013028 04101 80449950 71888837
4101071001 04101 212 2017 La Serena 279340.1 2017 4101 221054 61749247282 1056 0.0047771 04101 294983150 218078929
4101091001 04101 290 2017 La Serena 279340.1 2017 4101 221054 61749247282 1292 0.0058447 04101 360907414 296076579
4101141001 04101 622 2017 La Serena 279340.1 2017 4101 221054 61749247282 2872 0.0129923 04101 802264778 623487412
4101141002 04101 672 2017 La Serena 279340.1 2017 4101 221054 61749247282 2750 0.0124404 04101 768185285 672355761
4101141003 04101 1357 2017 La Serena 279340.1 2017 4101 221054 61749247282 4706 0.0212889 04101 1314574528 1334966993
4101141004 04101 1096 2017 La Serena 279340.1 2017 4101 221054 61749247282 3750 0.0169642 04101 1047525389 1083757186
4101141005 04101 1850 2017 La Serena 279340.1 2017 4101 221054 61749247282 5866 0.0265365 04101 1638609048 1806450125
4101141006 04101 579 2017 La Serena 279340.1 2017 4101 221054 61749247282 2114 0.0095633 04101 590524979 581385226
4101151001 04101 1585 2017 La Serena 279340.1 2017 4101 221054 61749247282 4957 0.0224244 04101 1384688894 1553452719
4101151002 04101 545 2017 La Serena 279340.1 2017 4101 221054 61749247282 1602 0.0072471 04101 447502846 548042093
4101151003 04101 656 2017 La Serena 279340.1 2017 4101 221054 61749247282 1900 0.0085952 04101 530746197 656727725
4101151004 04101 894 2017 La Serena 279340.1 2017 4101 221054 61749247282 2649 0.0119835 04101 739971935 888354695
4101151005 04101 751 2017 La Serena 279340.1 2017 4101 221054 61749247282 2047 0.0092602 04101 571809192 749392021
4101151006 04101 1028 2017 La Serena 279340.1 2017 4101 221054 61749247282 3173 0.0143540 04101 886346149 1018083635
4101161001 04101 1537 2017 La Serena 279340.1 2017 4101 221054 61749247282 5756 0.0260389 04101 1607881637 1507522449
4101161002 04101 735 2017 La Serena 279340.1 2017 4101 221054 61749247282 3690 0.0166928 04101 1030764983 733806175
4101161003 04101 611 2017 La Serena 279340.1 2017 4101 221054 61749247282 2952 0.0133542 04101 824611986 612723946
4101161004 04101 1074 2017 La Serena 279340.1 2017 4101 221054 61749247282 5185 0.0234558 04101 1448378438 1062520886
4101161005 04101 1257 2017 La Serena 279340.1 2017 4101 221054 61749247282 4746 0.0214699 04101 1325748132 1238868944
4101161006 04101 1234 2017 La Serena 279340.1 2017 4101 221054 61749247282 4464 0.0201942 04101 1246974223 1216740886
4101161007 04101 1226 2017 La Serena 279340.1 2017 4101 221054 61749247282 5497 0.0248672 04101 1535532550 1209041855
4101161008 04101 1216 2017 La Serena 279340.1 2017 4101 221054 61749247282 4352 0.0196875 04101 1215688131 1199416366
4101161009 04101 1192 2017 La Serena 279340.1 2017 4101 221054 61749247282 4309 0.0194930 04101 1203676507 1176307395
4101161010 04101 1146 2017 La Serena 279340.1 2017 4101 221054 61749247282 4752 0.0214970 04101 1327424173 1131983717
4101171001 04101 607 2017 La Serena 279340.1 2017 4101 221054 61749247282 2644 0.0119609 04101 738575234 608808808
4101171002 04101 735 2017 La Serena 279340.1 2017 4101 221054 61749247282 2927 0.0132411 04101 817628484 733806175
4101171003 04101 954 2017 La Serena 279340.1 2017 4101 221054 61749247282 5093 0.0230396 04101 1422679148 946496237
4101171004 04101 1210 2017 La Serena 279340.1 2017 4101 221054 61749247282 4747 0.0214744 04101 1326027472 1193640160
4101171005 04101 1252 2017 La Serena 279340.1 2017 4101 221054 61749247282 4515 0.0204249 04101 1261220568 1234059331
4101991999 04101 197 2017 La Serena 279340.1 2017 4101 221054 61749247282 796 0.0036009 04101 222354723 203006721
4102011001 04102 1296 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6389 0.0280552 04102 1719143162 1276368279
4102011002 04102 561 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2328 0.0102226 04102 626414976 563739026
4102021001 04102 1011 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4724 0.0207439 04102 1271127296 1001649180
4102021002 04102 488 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2101 0.0092258 04102 565334134 492029221
4102021003 04102 497 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2094 0.0091951 04102 563450584 500883376
4102021004 04102 881 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4472 0.0196373 04102 1203319490 875745198
4102021005 04102 543 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2188 0.0096079 04102 588743972 546079203
4102021006 04102 648 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3498 0.0153603 04102 941236935 648910283
4102031001 04102 634 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2056 0.0090282 04102 553225597 635224157
4102031002 04102 930 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3483 0.0152944 04102 937200756 923250492
4102031003 04102 622 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2188 0.0096079 04102 588743972 623487412
4102031004 04102 655 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2324 0.0102051 04102 625338661 655750671
4102041001 04102 534 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1800 0.0079041 04102 484341476 537244040
4102041002 04102 529 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1873 0.0082247 04102 503984214 532334072
4102051001 04102 1437 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4645 0.0203970 04102 1249870087 1411722223
4102051002 04102 1635 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 5393 0.0236816 04102 1451140878 1601261206
4102051003 04102 1366 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4578 0.0201028 04102 1231841821 1343607274
4102051004 04102 5 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 15 0.0000659 04102 4036179 5628335
4102051005 04102 1485 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4613 0.0202564 04102 1241259572 1457725678
4102051006 04102 1182 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4305 0.0189040 04102 1158383364 1166675367
4102051007 04102 924 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2872 0.0126114 04102 772793733 917436816
4102051008 04102 742 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2455 0.0107803 04102 660587958 740625976
4102061001 04102 978 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4034 0.0177140 04102 1085463064 969727923
4102061002 04102 1712 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6820 0.0299477 04102 1835116037 1674817911
4102061003 04102 81 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 309 0.0013569 04102 83145287 85272819
4102061004 04102 1279 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4293 0.0188513 04102 1155154421 1260025800
4102061005 04102 1852 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6111 0.0268344 04102 1644339312 1808356059
4102061006 04102 1375 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4633 0.0203443 04102 1246641144 1352246186
4102081001 04102 779 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2323 0.0102007 04102 625069583 776648145
4102081002 04102 863 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3139 0.0137839 04102 844637719 858278492
4102091001 04102 343 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1423 0.0062486 04102 382898845 348776565
4102091002 04102 735 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2821 0.0123875 04102 759070725 733806175
4102091003 04102 787 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3087 0.0135555 04102 830645632 784431245
4102091004 04102 599 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2580 0.0113292 04102 694222783 600976665
4102091005 04102 903 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3863 0.0169631 04102 1039450624 897081760
4102091006 04102 946 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3170 0.0139200 04102 852979155 938749236
4102091007 04102 1648 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6290 0.0276204 04102 1692504381 1613685611
4102091008 04102 1655 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 5782 0.0253897 04102 1555812453 1620374698
4102101001 04102 336 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1476 0.0064814 04102 397160010 341828119


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$ing_medio_zona <- h_y_m_comuna_corr$est_ing  /( h_y_m_comuna_corr$personas  * h_y_m_comuna_corr$p_poblacional)

r3_100 <- h_y_m_comuna_corr[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
4101011001 04101 376 2017 La Serena 279340.1 2017 4101 221054 61749247282 1455 0.0065821 04101 406439851 381488742 262191.6
4101021001 04101 532 2017 La Serena 279340.1 2017 4101 221054 61749247282 2431 0.0109973 04101 679075792 535280186 220189.3
4101021002 04101 762 2017 La Serena 279340.1 2017 4101 221054 61749247282 2926 0.0132366 04101 817349143 760102649 259775.3
4101021003 04101 738 2017 La Serena 279340.1 2017 4101 221054 61749247282 2699 0.0122097 04101 753938940 736729137 272963.7
4101021004 04101 1306 2017 La Serena 279340.1 2017 4101 221054 61749247282 5323 0.0240801 04101 1486927372 1285979091 241589.2
4101021005 04101 444 2017 La Serena 279340.1 2017 4101 221054 61749247282 2125 0.0096130 04101 593597720 448684253 211145.5
4101031001 04101 1549 2017 La Serena 279340.1 2017 4101 221054 61749247282 4341 0.0196377 04101 1212615390 1519008209 349921.3
4101031002 04101 876 2017 La Serena 279340.1 2017 4101 221054 61749247282 2583 0.0116849 04101 721535488 870894203 337163.8
4101031003 04101 1441 2017 La Serena 279340.1 2017 4101 221054 61749247282 4026 0.0182127 04101 1124623257 1415557239 351603.9
4101041001 04101 440 2017 La Serena 279340.1 2017 4101 221054 61749247282 1108 0.0050123 04101 309508835 444738823 401388.8
4101041002 04101 480 2017 La Serena 279340.1 2017 4101 221054 61749247282 1015 0.0045916 04101 283530205 484155567 477000.6
4101041003 04101 1578 2017 La Serena 279340.1 2017 4101 221054 61749247282 4721 0.0213568 04101 1318764630 1546756662 327633.3
4101041004 04101 1157 2017 La Serena 279340.1 2017 4101 221054 61749247282 3560 0.0161047 04101 994450769 1142586686 320951.3
4101041005 04101 359 2017 La Serena 279340.1 2017 4101 221054 61749247282 812 0.0036733 04101 226824164 364646040 449071.5
4101041006 04101 343 2017 La Serena 279340.1 2017 4101 221054 61749247282 821 0.0037140 04101 229338225 348776565 424819.2
4101051001 04101 473 2017 La Serena 279340.1 2017 4101 221054 61749247282 1419 0.0064192 04101 396383607 477263532 336337.9
4101051002 04101 969 2017 La Serena 279340.1 2017 4101 221054 61749247282 2920 0.0132094 04101 815673103 961017665 329115.6
4101051003 04101 922 2017 La Serena 279340.1 2017 4101 221054 61749247282 3348 0.0151456 04101 935230667 915498723 273446.5
4101051004 04101 859 2017 La Serena 279340.1 2017 4101 221054 61749247282 2851 0.0128973 04101 796398636 854395818 299682.9
4101051005 04101 1684 2017 La Serena 279340.1 2017 4101 221054 61749247282 5493 0.0248491 04101 1534415190 1648079415 300032.7
4101051006 04101 1322 2017 La Serena 279340.1 2017 4101 221054 61749247282 4295 0.0194296 04101 1199765745 1301352714 302992.5
4101051007 04101 787 2017 La Serena 279340.1 2017 4101 221054 61749247282 2336 0.0105676 04101 652538482 784431245 335801.0
4101051008 04101 1238 2017 La Serena 279340.1 2017 4101 221054 61749247282 4235 0.0191582 04101 1183005339 1220589952 288214.9
4101051009 04101 1146 2017 La Serena 279340.1 2017 4101 221054 61749247282 3882 0.0175613 04101 1084398283 1131983717 291598.1
4101051010 04101 1143 2017 La Serena 279340.1 2017 4101 221054 61749247282 3226 0.0145937 04101 901151175 1129091574 349997.4
4101051011 04101 951 2017 La Serena 279340.1 2017 4101 221054 61749247282 2966 0.0134175 04101 828522748 943591295 318136.0
4101061001 04101 1359 2017 La Serena 279340.1 2017 4101 221054 61749247282 4424 0.0200132 04101 1235800619 1336887174 302189.7
4101061002 04101 905 2017 La Serena 279340.1 2017 4101 221054 61749247282 3047 0.0137840 04101 851149296 899020823 295051.1
4101061003 04101 1046 2017 La Serena 279340.1 2017 4101 221054 61749247282 3472 0.0157066 04101 969868840 1035477704 298236.7
4101061004 04101 1643 2017 La Serena 279340.1 2017 4101 221054 61749247282 5333 0.0241253 04101 1489720773 1608907274 301689.0
4101061005 04101 68 2017 La Serena 279340.1 2017 4101 221054 61749247282 288 0.0013028 04101 80449950 71888837 249614.0
4101071001 04101 212 2017 La Serena 279340.1 2017 4101 221054 61749247282 1056 0.0047771 04101 294983150 218078929 206514.1
4101091001 04101 290 2017 La Serena 279340.1 2017 4101 221054 61749247282 1292 0.0058447 04101 360907414 296076579 229161.4
4101141001 04101 622 2017 La Serena 279340.1 2017 4101 221054 61749247282 2872 0.0129923 04101 802264778 623487412 217091.7
4101141002 04101 672 2017 La Serena 279340.1 2017 4101 221054 61749247282 2750 0.0124404 04101 768185285 672355761 244493.0
4101141003 04101 1357 2017 La Serena 279340.1 2017 4101 221054 61749247282 4706 0.0212889 04101 1314574528 1334966993 283673.4
4101141004 04101 1096 2017 La Serena 279340.1 2017 4101 221054 61749247282 3750 0.0169642 04101 1047525389 1083757186 289001.9
4101141005 04101 1850 2017 La Serena 279340.1 2017 4101 221054 61749247282 5866 0.0265365 04101 1638609048 1806450125 307952.6
4101141006 04101 579 2017 La Serena 279340.1 2017 4101 221054 61749247282 2114 0.0095633 04101 590524979 581385226 275016.7
4101151001 04101 1585 2017 La Serena 279340.1 2017 4101 221054 61749247282 4957 0.0224244 04101 1384688894 1553452719 313385.7
4101151002 04101 545 2017 La Serena 279340.1 2017 4101 221054 61749247282 1602 0.0072471 04101 447502846 548042093 342098.7
4101151003 04101 656 2017 La Serena 279340.1 2017 4101 221054 61749247282 1900 0.0085952 04101 530746197 656727725 345646.2
4101151004 04101 894 2017 La Serena 279340.1 2017 4101 221054 61749247282 2649 0.0119835 04101 739971935 888354695 335354.7
4101151005 04101 751 2017 La Serena 279340.1 2017 4101 221054 61749247282 2047 0.0092602 04101 571809192 749392021 366092.8
4101151006 04101 1028 2017 La Serena 279340.1 2017 4101 221054 61749247282 3173 0.0143540 04101 886346149 1018083635 320858.4
4101161001 04101 1537 2017 La Serena 279340.1 2017 4101 221054 61749247282 5756 0.0260389 04101 1607881637 1507522449 261904.5
4101161002 04101 735 2017 La Serena 279340.1 2017 4101 221054 61749247282 3690 0.0166928 04101 1030764983 733806175 198863.5
4101161003 04101 611 2017 La Serena 279340.1 2017 4101 221054 61749247282 2952 0.0133542 04101 824611986 612723946 207562.3
4101161004 04101 1074 2017 La Serena 279340.1 2017 4101 221054 61749247282 5185 0.0234558 04101 1448378438 1062520886 204922.1
4101161005 04101 1257 2017 La Serena 279340.1 2017 4101 221054 61749247282 4746 0.0214699 04101 1325748132 1238868944 261034.3
4101161006 04101 1234 2017 La Serena 279340.1 2017 4101 221054 61749247282 4464 0.0201942 04101 1246974223 1216740886 272567.4
4101161007 04101 1226 2017 La Serena 279340.1 2017 4101 221054 61749247282 5497 0.0248672 04101 1535532550 1209041855 219945.8
4101161008 04101 1216 2017 La Serena 279340.1 2017 4101 221054 61749247282 4352 0.0196875 04101 1215688131 1199416366 275601.2
4101161009 04101 1192 2017 La Serena 279340.1 2017 4101 221054 61749247282 4309 0.0194930 04101 1203676507 1176307395 272988.5
4101161010 04101 1146 2017 La Serena 279340.1 2017 4101 221054 61749247282 4752 0.0214970 04101 1327424173 1131983717 238212.1
4101171001 04101 607 2017 La Serena 279340.1 2017 4101 221054 61749247282 2644 0.0119609 04101 738575234 608808808 230260.5
4101171002 04101 735 2017 La Serena 279340.1 2017 4101 221054 61749247282 2927 0.0132411 04101 817628484 733806175 250702.5
4101171003 04101 954 2017 La Serena 279340.1 2017 4101 221054 61749247282 5093 0.0230396 04101 1422679148 946496237 185842.6
4101171004 04101 1210 2017 La Serena 279340.1 2017 4101 221054 61749247282 4747 0.0214744 04101 1326027472 1193640160 251451.5
4101171005 04101 1252 2017 La Serena 279340.1 2017 4101 221054 61749247282 4515 0.0204249 04101 1261220568 1234059331 273324.3
4101991999 04101 197 2017 La Serena 279340.1 2017 4101 221054 61749247282 796 0.0036009 04101 222354723 203006721 255033.6
4102011001 04102 1296 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6389 0.0280552 04102 1719143162 1276368279 199775.9
4102011002 04102 561 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2328 0.0102226 04102 626414976 563739026 242155.9
4102021001 04102 1011 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4724 0.0207439 04102 1271127296 1001649180 212034.1
4102021002 04102 488 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2101 0.0092258 04102 565334134 492029221 234188.1
4102021003 04102 497 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2094 0.0091951 04102 563450584 500883376 239199.3
4102021004 04102 881 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4472 0.0196373 04102 1203319490 875745198 195828.5
4102021005 04102 543 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2188 0.0096079 04102 588743972 546079203 249579.2
4102021006 04102 648 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3498 0.0153603 04102 941236935 648910283 185508.9
4102031001 04102 634 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2056 0.0090282 04102 553225597 635224157 308961.2
4102031002 04102 930 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3483 0.0152944 04102 937200756 923250492 265073.4
4102031003 04102 622 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2188 0.0096079 04102 588743972 623487412 284957.7
4102031004 04102 655 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2324 0.0102051 04102 625338661 655750671 282164.7
4102041001 04102 534 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1800 0.0079041 04102 484341476 537244040 298468.9
4102041002 04102 529 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1873 0.0082247 04102 503984214 532334072 284214.7
4102051001 04102 1437 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4645 0.0203970 04102 1249870087 1411722223 303923.0
4102051002 04102 1635 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 5393 0.0236816 04102 1451140878 1601261206 296914.7
4102051003 04102 1366 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4578 0.0201028 04102 1231841821 1343607274 293492.2
4102051004 04102 5 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 15 0.0000659 04102 4036179 5628335 375222.3
4102051005 04102 1485 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4613 0.0202564 04102 1241259572 1457725678 316003.8
4102051006 04102 1182 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4305 0.0189040 04102 1158383364 1166675367 271004.7
4102051007 04102 924 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2872 0.0126114 04102 772793733 917436816 319441.8
4102051008 04102 742 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2455 0.0107803 04102 660587958 740625976 301680.6
4102061001 04102 978 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4034 0.0177140 04102 1085463064 969727923 240388.7
4102061002 04102 1712 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6820 0.0299477 04102 1835116037 1674817911 245574.5
4102061003 04102 81 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 309 0.0013569 04102 83145287 85272819 275963.8
4102061004 04102 1279 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4293 0.0188513 04102 1155154421 1260025800 293507.1
4102061005 04102 1852 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6111 0.0268344 04102 1644339312 1808356059 295918.2
4102061006 04102 1375 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 4633 0.0203443 04102 1246641144 1352246186 291872.7
4102081001 04102 779 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2323 0.0102007 04102 625069583 776648145 334329.8
4102081002 04102 863 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3139 0.0137839 04102 844637719 858278492 273424.2
4102091001 04102 343 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1423 0.0062486 04102 382898845 348776565 245099.5
4102091002 04102 735 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2821 0.0123875 04102 759070725 733806175 260122.7
4102091003 04102 787 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3087 0.0135555 04102 830645632 784431245 254108.0
4102091004 04102 599 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 2580 0.0113292 04102 694222783 600976665 232936.7
4102091005 04102 903 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3863 0.0169631 04102 1039450624 897081760 232224.1
4102091006 04102 946 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 3170 0.0139200 04102 852979155 938749236 296135.4
4102091007 04102 1648 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 6290 0.0276204 04102 1692504381 1613685611 256547.8
4102091008 04102 1655 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 5782 0.0253897 04102 1555812453 1620374698 280244.7
4102101001 04102 336 2017 Coquimbo 269078.6 2017 4102 227730 61277269093 1476 0.0064814 04102 397160010 341828119 231590.9


Guardamos:

saveRDS(h_y_m_comuna_corr, "P03C/region_04_P03C_u.rds")