La Estructura de la pobreza multidimensional en Querétaro

Coloquio. “Investigación Cuantitativa y Estadística en la UAQ”

Alejandro Guzmán Rodríguez

Facultad de Ciencias Políticas y Sociales

21 de Noviembre de 2013

Para ver las diapositivas puedes ir a: http://alejandroguzmanro.wix.com/inicio#!estadisticauaq/cxii


Carga de los datos y paquetes requeridos

Los paquetes utilizados son:

library(foreign)
library(survey)
## Warning: package 'survey' was built under R version 2.15.3
## Attaching package: 'survey'
## The following object(s) are masked from 'package:graphics':
## 
## dotchart
library(RColorBrewer)
## Warning: package 'RColorBrewer' was built under R version 2.15.2

Los datos utilizados son públicos y disponibles en línea:

http://internet.coneval.gob.mx/Informes/Pobreza/Estatal2012/NACIONAL_2010-2012/PC_R_2010-2012_Oficial.zip

Se cargan las tablas requeridas y se ajustó para poder trabajarlas conjuntamente:

ENIGH10 <- read.dbf("C:/Users/AG/Documents/Bases de datos/ENIGH - CONEVAL/R_2010/Base final/pobreza_10.dbf")
ENIGH12 <- read.dbf("C:/Users/AG/Documents/Bases de datos/ENIGH - CONEVAL/R_2012/Base final/pobreza_12.dbf")
ENIGH10 <- ENIGH10[ENIGH10$ent == "22", ]
ENIGH12 <- ENIGH12[ENIGH12$ent == "22", ]
viv10 <- read.dbf("C:/Users/AG/Documents/Bases de datos/ENIGH - CONEVAL/R_2010/Bases de datos/hogares.dbf")
viv12 <- read.dbf("C:/Users/AG/Documents/Bases de datos/ENIGH - CONEVAL/R_2012/Bases de datos/Vivienda.dbf")
names(viv10) <- tolower(names(viv10))
names(ENIGH10) <- tolower(names(ENIGH10))
ENIGH10 <- merge(ENIGH10, viv10[, c(1:3, 23)], by = c("proyecto", "folioviv", 
    "foliohog"), all.x = 1)
ENIGH12 <- merge(ENIGH12, viv12[, c(1:2, 22)], by = c("proyecto", "folioviv"), 
    all.x = 1)
names(ENIGH12)[91] <- names(ENIGH10)[95]
names(ENIGH10) <- tolower(names(ENIGH10))
ENIGH10 <- ENIGH10[-c(42:44, 47)]
names(ENIGH12)[34] <- "factor"
names(ENIGH10)[42:46] <- names(ENIGH12)[42:46]

Se calcularon variables adicionales a partir de las variables originales en la BD

# número de carencias
ENIGH10$num_car <- ENIGH10$ic_asalud + ENIGH10$ic_segsoc + ENIGH10$ic_cv + ENIGH10$ic_sbv + 
    ENIGH10$ic_ali + ENIGH10$ic_rezedu
ENIGH12$num_car <- ENIGH12$ic_asalud + ENIGH12$ic_segsoc + ENIGH12$ic_cv + ENIGH12$ic_sbv + 
    ENIGH12$ic_ali + ENIGH12$ic_rezedu
# carencias y pobreza
ENIGH10$p_asalud <- ENIGH10$pobreza * ENIGH10$ic_asalud
ENIGH10$p_segsoc <- ENIGH10$pobreza * ENIGH10$ic_segsoc
ENIGH10$p_cv <- ENIGH10$pobreza * ENIGH10$ic_cv
ENIGH10$p_sbv <- ENIGH10$pobreza * ENIGH10$ic_sbv
ENIGH10$p_ali <- ENIGH10$pobreza * ENIGH10$ic_ali
ENIGH10$p_rezedu <- ENIGH10$pobreza * ENIGH10$ic_rezedu
ENIGH12$p_asalud <- ENIGH12$pobreza * ENIGH12$ic_asalud
ENIGH12$p_segsoc <- ENIGH12$pobreza * ENIGH12$ic_segsoc
ENIGH12$p_cv <- ENIGH12$pobreza * ENIGH12$ic_cv
ENIGH12$p_sbv <- ENIGH12$pobreza * ENIGH12$ic_sbv
ENIGH12$p_ali <- ENIGH12$pobreza * ENIGH12$ic_ali
ENIGH12$p_rezedu <- ENIGH12$pobreza * ENIGH12$ic_rezedu
# año
ENIGH10$year <- "2010"
ENIGH12$year <- "2012"
# servicios de salud colapsados
ENIGH10$serv_sal_c <- 8
ENIGH10$serv_sal_c[ENIGH10$serv_sal == 0 | ENIGH10$serv_sal == 1 | ENIGH10$serv_sal == 
    2 | ENIGH10$serv_sal == 3] <- ENIGH10$serv_sal[ENIGH10$serv_sal == 0 | ENIGH10$serv_sal == 
    1 | ENIGH10$serv_sal == 2 | ENIGH10$serv_sal == 3]
ENIGH12$serv_sal_c <- 8
ENIGH12$serv_sal_c[ENIGH12$serv_sal == 0 | ENIGH12$serv_sal == 1 | ENIGH12$serv_sal == 
    2 | ENIGH12$serv_sal == 3] <- ENIGH12$serv_sal[ENIGH12$serv_sal == 0 | ENIGH12$serv_sal == 
    1 | ENIGH12$serv_sal == 2 | ENIGH12$serv_sal == 3]
# combustible para cocinar
ENIGH10$isb_combus <- 0
ENIGH10$isb_combus[ENIGH10$estufa == 2] <- 1
ENIGH12$isb_combus <- 0
ENIGH12$isb_combus[ENIGH12$estufa == 2] <- 1
# grupos de edad de interes
ENIGH10$edadg[ENIGH10$edad < 16] <- 1
ENIGH10$edadg[ENIGH10$edad > 15 & ENIGH10$edad < 30] <- 2
ENIGH10$edadg[ENIGH10$edad > 29] <- 3
ENIGH12$edadg[ENIGH12$edad < 16] <- 1
ENIGH12$edadg[ENIGH12$edad > 15 & ENIGH12$edad < 30] <- 2
ENIGH12$edadg[ENIGH12$edad > 29] <- 3
# nombres de carencias
nom_car <- c("Salud", "Seguridad social", "Calidad de la vivienda", "Servicios en la vivienda", 
    "Alimentación", "Educación")

Objetos “survey”

pob10 <- svydesign(~1, weights = ENIGH10$factor, data = ENIGH10)
pob12 <- svydesign(~1, weights = ENIGH12$factor, data = ENIGH12)
pob <- svydesign(~1, weights = rbind(ENIGH12, ENIGH10)$factor, data = rbind(ENIGH12, 
    ENIGH10))

Comparación de elementos 2010-2012

Análisis de cuadrantes

cuadrantes <- matrix(nrow = 2, ncol = 4, dimnames = list(c(2010, 2012), c("Pobres", 
    "Vulnerables por carencias", "Vulnerables por ingresos", "No pobres y no vulnerables")))
cuadrantes[1, ] <- svytable(~cuadrantes, pob10)
cuadrantes[2, ] <- svytable(~cuadrantes, pob12)

col10_12 <- brewer.pal(3, "Dark2")
barplot(cuadrantes/1000, beside = 1, cex.names = 0.9, col = col10_12[1:2], ylab = "miles")
legend("topright", legend = c(2010, 2012), bty = "n", pch = 15, pt.cex = 3, 
    col = col10_12[1:2])

plot of chunk unnamed-chunk-5


barplot(c(sum(cuadrantes[1, ]), sum(cuadrantes[2, ]))/1000, names.arg = c(2010, 
    2012), col = col10_12[1:2], ylab = "miles", ylim = c(0, 2000), space = 1.5)
abline(h = sum(cuadrantes[2, ])/1000, lty = 2)
legend("center", legend = c((sum(cuadrantes[2, ]) - sum(cuadrantes[1, ])), "más personas en 2012"), 
    bty = "n", yjust = 1)

plot of chunk unnamed-chunk-5

Ingresos

p_ing <- matrix(nrow = 2, ncol = 3, dimnames = list(c(2010, 2012), c("pob", 
    "lim_inf", "lim_sup")))
p_ing[, 1] <- svyby(~plb, ~year, pob, svytotal)[, 2]
p_ing[, 2:3] <- confint(svyby(~plb, ~year, pob, svytotal))

ictpc <- matrix(nrow = 2, ncol = 3, dimnames = list(c(2010, 2012), c("pob", 
    "lim_inf", "lim_sup")))
ictpc[, 1] <- svyby(~ictpc, ~year, pob, svymean)[, 2]
ictpc[, 2:3] <- confint(svyby(~ictpc, ~year, pob, svymean))
ictpc[2, ] <- ictpc[2, ] * 0.92746374  #aplicando un deflacionador

par(mfrow = c(1, 2))
barplot(ictpc[, 1], col = col10_12[1:2], ylim = c(0, 4000), ylab = "Pesos ($)", 
    main = "Ingreso corriente per capita \n promedio")
segments(x0 = c(0.7, 1.9), x1 = c(0.7, 1.9), y0 = ictpc[, 2], y1 = ictpc[, 3])
segments(x0 = c(0.7, 1.9) - 0.2, x1 = c(0.7, 1.9) + 0.2, y0 = ictpc[, 2], y1 = ictpc[, 
    2])
segments(x0 = c(0.7, 1.9) - 0.2, x1 = c(0.7, 1.9) + 0.2, y0 = ictpc[, 3], y1 = ictpc[, 
    3])
barplot(p_ing[, 1]/1000, ylim = c(0, 1000), ylab = "miles de personas", col = col10_12[1:2], 
    main = "Población con un ingreso \n menor a la línea de bienestar")
segments(x0 = c(0.7, 1.9), x1 = c(0.7, 1.9), y0 = p_ing[, 2]/1000, y1 = p_ing[, 
    3]/1000)
segments(x0 = c(0.7, 1.9) - 0.2, x1 = c(0.7, 1.9) + 0.2, y0 = p_ing[, 2]/1000, 
    y1 = p_ing[, 2]/1000)
segments(x0 = c(0.7, 1.9) - 0.2, x1 = c(0.7, 1.9) + 0.2, y0 = p_ing[, 3]/1000, 
    y1 = p_ing[, 3]/1000)

plot of chunk unnamed-chunk-6

par(mfrow = c(1, 1))

Número de carencias

numcar <- matrix(nrow = 2, ncol = 6, dimnames = list(c(2010, 2012), 1:6))

numcar[1, ] <- svytable(~pobreza + num_car, pob10)[2, 2:7]
numcar[2, ] <- svytable(~pobreza + num_car, pob12)[2, 2:7]

plot(numcar[1, ]/1000, col = col10_12[1], ylab = "miles", xlab = "Número de carencias", 
    type = "b", lwd = 2, pch = 16, main = "Población en situación de pobreza según número de Carencias")
lines(numcar[2, ]/1000, col = col10_12[2], type = "b", lwd = 2, pch = 16)
legend("topright", legend = c(2010, 2012), bty = "n", lty = 1, lwd = 2, col = col10_12[1:2])

plot of chunk unnamed-chunk-7

Población por carencias

pob_car <- matrix(nrow = 2, ncol = 6, dimnames = list(c(2010, 2012), nom_car))

pob_car[1, 1] <- svytable(~pobreza + ic_asalud, pob10)[2, 2]
pob_car[2, 1] <- svytable(~pobreza + ic_asalud, pob12)[2, 2]
pob_car[1, 2] <- svytable(~pobreza + ic_segsoc, pob10)[2, 2]
pob_car[2, 2] <- svytable(~pobreza + ic_segsoc, pob12)[2, 2]
pob_car[1, 3] <- svytable(~pobreza + ic_cv, pob10)[2, 2]
pob_car[2, 3] <- svytable(~pobreza + ic_cv, pob12)[2, 2]
pob_car[1, 4] <- svytable(~pobreza + ic_sbv, pob10)[2, 2]
pob_car[2, 4] <- svytable(~pobreza + ic_sbv, pob12)[2, 2]
pob_car[1, 5] <- svytable(~pobreza + ic_ali, pob10)[2, 2]
pob_car[2, 5] <- svytable(~pobreza + ic_ali, pob12)[2, 2]
pob_car[1, 6] <- svytable(~pobreza + ic_rezedu, pob10)[2, 2]
pob_car[2, 6] <- svytable(~pobreza + ic_rezedu, pob12)[2, 2]

int_pcar10 <- matrix(nrow = 2, ncol = 6, dimnames = list(c("lim_inf", "lim_sup"), 
    nom_car))
int_pcar10[, 1] <- confint(svytotal(~p_asalud, pob10), level = 1 - (0.05/6))
int_pcar10[, 2] <- confint(svytotal(~p_segsoc, pob10), level = 1 - (0.05/6))
int_pcar10[, 3] <- confint(svytotal(~p_cv, pob10), level = 1 - (0.05/6))
int_pcar10[, 4] <- confint(svytotal(~p_sbv, pob10), level = 1 - (0.05/6))
int_pcar10[, 5] <- confint(svytotal(~p_ali, pob10), level = 1 - (0.05/6))
int_pcar10[, 6] <- confint(svytotal(~p_rezedu, pob10), level = 1 - (0.05/6))
int_pcar12 <- matrix(nrow = 2, ncol = 6, dimnames = list(c("lim_inf", "lim_sup"), 
    nom_car))
int_pcar12[, 1] <- confint(svytotal(~p_asalud, pob12), level = 1 - (0.05/6))
int_pcar12[, 2] <- confint(svytotal(~p_segsoc, pob12), level = 1 - (0.05/6))
int_pcar12[, 3] <- confint(svytotal(~p_cv, pob12), level = 1 - (0.05/6))
int_pcar12[, 4] <- confint(svytotal(~p_sbv, pob12), level = 1 - (0.05/6))
int_pcar12[, 5] <- confint(svytotal(~p_ali, pob12), level = 1 - (0.05/6))
int_pcar12[, 6] <- confint(svytotal(~p_rezedu, pob12), level = 1 - (0.05/6))

barplot(pob_car/1000, beside = 1, col = brewer.pal(12, "Paired"), cex.names = 0.85, 
    ylab = "miles", ylim = c(0, 700), main = "Población según carencia")
legend("topright", legend = c(2010, 2012), bty = "n", pch = 15, pt.cex = 3, 
    col = brewer.pal(12, "Paired")[3:4])
segments(x0 = seq(1.5, by = 3, length = 6), y0 = int_pcar10[1, ]/1000, x1 = seq(1.5, 
    by = 3, length = 6), y1 = int_pcar10[2, ]/1000)
segments(x0 = seq(1.5, by = 3, length = 6) - 0.3, y0 = int_pcar10[1, ]/1000, 
    x1 = seq(1.5, by = 3, length = 6) + 0.3, y1 = int_pcar10[1, ]/1000)
segments(x0 = seq(1.5, by = 3, length = 6) - 0.3, y0 = int_pcar10[2, ]/1000, 
    x1 = seq(1.5, by = 3, length = 6) + 0.3, y1 = int_pcar10[2, ]/1000)
segments(x0 = seq(2.5, by = 3, length = 6), y0 = int_pcar12[1, ]/1000, x1 = seq(2.5, 
    by = 3, length = 6), y1 = int_pcar12[2, ]/1000)
segments(x0 = seq(2.5, by = 3, length = 6) - 0.3, y0 = int_pcar12[1, ]/1000, 
    x1 = seq(2.5, by = 3, length = 6) + 0.3, y1 = int_pcar12[1, ]/1000)
segments(x0 = seq(2.5, by = 3, length = 6) - 0.3, y0 = int_pcar12[2, ]/1000, 
    x1 = seq(2.5, by = 3, length = 6) + 0.3, y1 = int_pcar12[2, ]/1000)

plot of chunk unnamed-chunk-8

Componentes de las carencias 2010-2012

Acceso a los servicios de salud

salud <- matrix(nrow = 2, ncol = 5, dimnames = list(c(2010, 2012), c("No cuenta", 
    "Seguro Popular", "IMSS", "ISSSTE", "Otros")))
salud[, 1:4] <- svytable(~year + serv_sal, pob)[, 1:4]
salud[1, 5] <- sum(svytable(~year + serv_sal, pob)[1, 5:7])
salud[2, 5] <- sum(svytable(~year + serv_sal, pob)[2, 5:7])

int_sal10 <- t(confint(svytotal(~as.factor(serv_sal_c), pob10), level = 1 - 
    (0.05/4)))
int_sal12 <- t(confint(svytotal(~as.factor(serv_sal_c), pob12), level = 1 - 
    (0.05/4)))

barplot(salud/1000, beside = 1, ylab = "miles", col = brewer.pal(12, "Paired")[1:2], 
    ylim = c(0, 900), main = "Población según institución de acceso a servicios de salud")
segments(x0 = seq(1.5, by = 3, length = 5), y0 = int_sal10[1, ]/1000, x1 = seq(1.5, 
    by = 3, length = 5), y1 = int_sal10[2, ]/1000)
segments(x0 = seq(1.5, by = 3, length = 5) - 0.3, y0 = int_sal10[1, ]/1000, 
    x1 = seq(1.5, by = 3, length = 5) + 0.3, y1 = int_sal10[1, ]/1000)
segments(x0 = seq(1.5, by = 3, length = 5) - 0.3, y0 = int_sal10[2, ]/1000, 
    x1 = seq(1.5, by = 3, length = 5) + 0.3, y1 = int_sal10[2, ]/1000)
segments(x0 = seq(2.5, by = 3, length = 5), y0 = int_sal12[1, ]/1000, x1 = seq(2.5, 
    by = 3, length = 5), y1 = int_sal12[2, ]/1000)
segments(x0 = seq(2.5, by = 3, length = 5) - 0.3, y0 = int_sal12[1, ]/1000, 
    x1 = seq(2.5, by = 3, length = 5) + 0.3, y1 = int_sal12[1, ]/1000)
segments(x0 = seq(2.5, by = 3, length = 5) - 0.3, y0 = int_sal12[2, ]/1000, 
    x1 = seq(2.5, by = 3, length = 5) + 0.3, y1 = int_sal12[2, ]/1000)
legend("topright", bty = "n", legend = c(2010, 2012), col = brewer.pal(12, "Paired")[1:2], 
    pch = 15, pt.cex = 3)

plot of chunk unnamed-chunk-9

Servicios básicos en la vivienda

servicios <- matrix(nrow = 2, ncol = 5, dimnames = list(c("2010", "2012"), c("Servicios básicos en la vivienda", 
    "Agua", "Drenaje", "Electricidad", "Combustible")))

servicios[1, 1] <- svytotal(~ic_sbv, pob10)[1]
servicios[1, 2] <- svytotal(~isb_agua, pob10)[1]
servicios[1, 3] <- svytotal(~isb_dren, pob10)[1]
servicios[1, 4] <- svytotal(~isb_luz, pob10)[1]
servicios[1, 5] <- svytotal(~isb_combus, pob10)[1]
servicios[2, 1] <- svytotal(~ic_sbv, pob12)[1]
servicios[2, 2] <- svytotal(~isb_agua, pob12)[1]
servicios[2, 3] <- svytotal(~isb_dren, pob12)[1]
servicios[2, 4] <- svytotal(~isb_luz, pob12)[1]
servicios[2, 5] <- svytotal(~isb_combus, pob12)[1]

int_serv10 <- matrix(nrow = 2, ncol = 5, dimnames = list(c("lim_inf", "lim_sup"), 
    c("Servicios básicos en la vivienda", "Agua", "Drenaje", "Electricidad", 
        "Combustible")))
int_serv10[, 1] <- confint(svytotal(~ic_sbv, pob10), level = 1 - (0.05))
int_serv10[, 2] <- confint(svytotal(~isb_agua, pob10), level = 1 - (0.05/4))
int_serv10[, 3] <- confint(svytotal(~isb_dren, pob10), level = 1 - (0.05/4))
int_serv10[, 4] <- confint(svytotal(~isb_luz, pob10), level = 1 - (0.05/4))
int_serv10[, 5] <- confint(svytotal(~isb_combus, pob10), level = 1 - (0.05/4))
int_serv12 <- matrix(nrow = 2, ncol = 5, dimnames = list(c("lim_inf", "lim_sup"), 
    c("Servicios básicos en la vivienda", "Agua", "Drenaje", "Electricidad", 
        "Combustible")))
int_serv12[, 1] <- confint(svytotal(~ic_sbv, pob12), level = 1 - (0.05))
int_serv12[, 2] <- confint(svytotal(~isb_agua, pob12), level = 1 - (0.05/4))
int_serv12[, 3] <- confint(svytotal(~isb_dren, pob12), level = 1 - (0.05/4))
int_serv12[, 4] <- confint(svytotal(~isb_luz, pob12), level = 1 - (0.05/4))
int_serv12[, 5] <- confint(svytotal(~isb_combus, pob12), level = 1 - (0.05/4))

barplot(servicios/1000, beside = 1, ylab = "miles", col = brewer.pal(12, "Paired")[7:8], 
    ylim = c(0, 400), main = "Población con carencia en servicios básicos en la vivienda \n según carencia específica")
segments(x0 = seq(1.5, by = 3, length = 5), y0 = int_serv10[1, ]/1000, x1 = seq(1.5, 
    by = 3, length = 5), y1 = int_serv10[2, ]/1000)
segments(x0 = seq(1.5, by = 3, length = 5) - 0.3, y0 = int_serv10[1, ]/1000, 
    x1 = seq(1.5, by = 3, length = 5) + 0.3, y1 = int_serv10[1, ]/1000)
segments(x0 = seq(1.5, by = 3, length = 5) - 0.3, y0 = int_serv10[2, ]/1000, 
    x1 = seq(1.5, by = 3, length = 5) + 0.3, y1 = int_serv10[2, ]/1000)
segments(x0 = seq(2.5, by = 3, length = 5), y0 = int_serv12[1, ]/1000, x1 = seq(2.5, 
    by = 3, length = 5), y1 = int_serv12[2, ]/1000)
segments(x0 = seq(2.5, by = 3, length = 5) - 0.3, y0 = int_serv12[1, ]/1000, 
    x1 = seq(2.5, by = 3, length = 5) + 0.3, y1 = int_serv12[1, ]/1000)
segments(x0 = seq(2.5, by = 3, length = 5) - 0.3, y0 = int_serv12[2, ]/1000, 
    x1 = seq(2.5, by = 3, length = 5) + 0.3, y1 = int_serv12[2, ]/1000)
legend("topright", bty = "n", legend = c(2010, 2012), col = brewer.pal(12, "Paired")[7:8], 
    pch = 15, pt.cex = 3)

plot of chunk unnamed-chunk-10

Resto de los componentes de la pobreza multidimencional

Acceso a la seguridad social

seg_soc <- svytable(~ic_segsoc + pea, pob12)
dimnames(seg_soc) <- list(c("Sin carencia", "Con carencia"), c("PNEA", "PEA Ocupada", 
    "PEA Desocupada"))
int_seg0 <- t(confint(svytotal(~as.factor(pea), na.rm = 1, subset(pob12, ic_segsoc == 
    0))))
int_seg1 <- t(confint(svytotal(~as.factor(pea), na.rm = 1, subset(pob12, ic_segsoc == 
    1))))
dimnames(int_seg0) <- dimnames(int_seg1) <- list(c("lim_inf", "lim_sup"), c("PNEA", 
    "PEA Ocupada", "PEA Desocupada"))

barplot(seg_soc/1000, beside = 1, col = brewer.pal(12, "Paired")[3:4], ylab = "miles", 
    ylim = c(0, 550), main = "Población según acceso a seguridad social y \n condición de actividad económica")
segments(x1 = seq(1.5, by = 3, length = 3), x0 = seq(1.5, by = 3, length = 3), 
    y0 = int_seg0[1, ]/1000, y1 = int_seg0[2, ]/1000)
segments(x1 = seq(1.5, by = 3, length = 3) + 0.3, x0 = seq(1.5, by = 3, length = 3) - 
    0.3, y0 = int_seg0[1, ]/1000, y1 = int_seg0[1, ]/1000)
segments(x1 = seq(1.5, by = 3, length = 3) + 0.3, x0 = seq(1.5, by = 3, length = 3) - 
    0.3, y0 = int_seg0[2, ]/1000, y1 = int_seg0[2, ]/1000)
segments(x1 = seq(2.5, by = 3, length = 3), x0 = seq(2.5, by = 3, length = 3), 
    y0 = int_seg1[1, ]/1000, y1 = int_seg1[2, ]/1000)
segments(x1 = seq(2.5, by = 3, length = 3) + 0.3, x0 = seq(2.5, by = 3, length = 3) - 
    0.3, y0 = int_seg1[1, ]/1000, y1 = int_seg1[1, ]/1000)
segments(x1 = seq(2.5, by = 3, length = 3) + 0.3, x0 = seq(2.5, by = 3, length = 3) - 
    0.3, y0 = int_seg1[2, ]/1000, y1 = int_seg1[2, ]/1000)
legend("topright", bty = "n", legend = c("Sin carencia", "Con carencia"), col = brewer.pal(12, 
    "Paired")[3:4], pch = 15, pt.cex = 3)

plot of chunk unnamed-chunk-11

Calidad y espacios en la vivienda

cviv <- matrix(nrow = 2, ncol = 5, dimnames = list(c("Urbano", "Rural"), c("Vivienda", 
    "Pisos", "Muros", "Techos", "Hacinamiento")))
cviv[, 1] <- svytable(~rururb + ic_cv, pob12)[, 2]
cviv[, 2] <- svytable(~rururb + icv_mat_pi, pob12)[, 2]
cviv[, 3] <- svytable(~rururb + icv_mat_mu, pob12)[, 2]
cviv[, 4] <- svytable(~rururb + icv_mat_te, pob12)[, 2]
cviv[, 5] <- svytable(~rururb + icv_hac, pob12)[, 2]
int_cvivU <- matrix(nrow = 2, ncol = 5, dimnames = list(c("lim_inf", "lim_sup"), 
    c("Vivienda", "Pisos", "Muros", "Techos", "Hacinamiento")))
int_cvivU[, 1] <- confint(svytotal(~ic_cv, subset(pob12, rururb == 0)))
int_cvivU[, 2] <- confint(svytotal(~icv_mat_pi, subset(pob12, rururb == 0)))
int_cvivU[, 3] <- confint(svytotal(~icv_mat_mu, subset(pob12, rururb == 0)))
int_cvivU[, 4] <- confint(svytotal(~icv_mat_te, subset(pob12, rururb == 0)))
int_cvivU[, 5] <- confint(svytotal(~icv_hac, subset(pob12, rururb == 0)))
int_cvivR <- matrix(nrow = 2, ncol = 5, dimnames = list(c("lim_inf", "lim_sup"), 
    c("Vivienda", "Pisos", "Muros", "Techos", "Hacinamiento")))
int_cvivR[, 1] <- confint(svytotal(~ic_cv, subset(pob12, rururb == 1)))
int_cvivR[, 2] <- confint(svytotal(~icv_mat_pi, subset(pob12, rururb == 1)))
int_cvivR[, 3] <- confint(svytotal(~icv_mat_mu, subset(pob12, rururb == 1)))
int_cvivR[, 4] <- confint(svytotal(~icv_mat_te, subset(pob12, rururb == 1)))
int_cvivR[, 5] <- confint(svytotal(~icv_hac, subset(pob12, rururb == 1)))

barplot(cviv/1000, beside = 1, ylim = c(0, 150), ylab = "miles", col = brewer.pal(12, 
    "Paired")[5:6], main = "Población con carencia en calidad y espacios de la vivienda \n según tipo de localidad y carencia específica")
segments(x1 = seq(1.5, by = 3, length = 5), x0 = seq(1.5, by = 3, length = 5), 
    y0 = int_cvivU[1, ]/1000, y1 = int_cvivU[2, ]/1000)
segments(x1 = seq(1.5, by = 3, length = 5) + 0.25, x0 = seq(1.5, by = 3, length = 5) - 
    0.25, y0 = int_cvivU[1, ]/1000, y1 = int_cvivU[1, ]/1000)
segments(x1 = seq(1.5, by = 3, length = 5) + 0.25, x0 = seq(1.5, by = 3, length = 5) - 
    0.25, y0 = int_cvivU[2, ]/1000, y1 = int_cvivU[2, ]/1000)
segments(x1 = seq(2.5, by = 3, length = 5), x0 = seq(2.5, by = 3, length = 5), 
    y0 = int_cvivR[1, ]/1000, y1 = int_cvivR[2, ]/1000)
segments(x1 = seq(2.5, by = 3, length = 5) + 0.25, x0 = seq(2.5, by = 3, length = 5) - 
    0.25, y0 = int_cvivR[1, ]/1000, y1 = int_cvivR[1, ]/1000)
segments(x1 = seq(2.5, by = 3, length = 5) + 0.25, x0 = seq(2.5, by = 3, length = 5) - 
    0.25, y0 = int_cvivR[2, ]/1000, y1 = int_cvivR[2, ]/1000)
legend("topright", bty = "n", legend = c("Localidades urbanas", "Localidades rurales"), 
    col = brewer.pal(12, "Paired")[5:6], pch = 15, pt.cex = 3)

plot of chunk unnamed-chunk-12

Alimentación

alim <- svytable(~plb + ins_ali, pob12)
dimnames(alim) <- list(c("plb0", "plb1"), c("Seguridad", "Inseguridad Leve", 
    "Inseguridad Moderada", "Inseguridad Severa"))
int_alim0 <- t(confint(svytotal(~as.factor(ins_ali), subset(pob12, plb == 0))))
dimnames(int_alim0) <- list(c("inf", "sup"), c("Seguridad", "Inseguridad Leve", 
    "Inseguridad Moderada", "Inseguridad Severa"))
int_alim1 <- t(confint(svytotal(~as.factor(ins_ali), subset(pob12, plb == 1))))
dimnames(int_alim1) <- list(c("inf", "sup"), c("Seguridad", "Inseguridad Leve", 
    "Inseguridad Moderada", "Inseguridad Severa"))

barplot(alim/1000, beside = 1, col = brewer.pal(12, "Paired")[9:10], ylim = c(0, 
    800), main = "Población según grado de inseguridad alimentaria e  \n ingreso con respecto a la línea de bienestar")
legend("topright", bty = "n", legend = c("Ingreso superior a la línea de bienestar", 
    "Ingreso inferior a la línea de bienestar"), col = brewer.pal(12, "Paired")[9:10], 
    pch = 15, pt.cex = 3)
segments(x1 = seq(1.5, by = 3, length = 4), x0 = seq(1.5, by = 3, length = 4), 
    y0 = int_alim0[1, ]/1000, y1 = int_alim0[2, ]/1000)
segments(x1 = seq(1.5, by = 3, length = 4) + 0.25, x0 = seq(1.5, by = 3, length = 4) - 
    0.25, y0 = int_alim0[1, ]/1000, y1 = int_alim0[1, ]/1000)
segments(x1 = seq(1.5, by = 3, length = 4) + 0.25, x0 = seq(1.5, by = 3, length = 4) - 
    0.25, y0 = int_alim0[2, ]/1000, y1 = int_alim0[2, ]/1000)
segments(x1 = seq(2.5, by = 3, length = 4), x0 = seq(2.5, by = 3, length = 4), 
    y0 = int_alim1[1, ]/1000, y1 = int_alim1[2, ]/1000)
segments(x1 = seq(2.5, by = 3, length = 4) + 0.25, x0 = seq(2.5, by = 3, length = 4) - 
    0.25, y0 = int_alim1[1, ]/1000, y1 = int_alim1[1, ]/1000)
segments(x1 = seq(2.5, by = 3, length = 4) + 0.25, x0 = seq(2.5, by = 3, length = 4) - 
    0.25, y0 = int_alim1[2, ]/1000, y1 = int_alim1[2, ]/1000)
abline(v = 6.5, lty = 2)
legend(3, 500, bty = "n", legend = "Sin carencia")
legend(8.5, 500, bty = "n", legend = "Con carencia")

plot of chunk unnamed-chunk-13

Rezago educativo

edu <- svytable(~sexo + edadg, subset(pob12, ic_rezedu == 1))
dimnames(edu) <- list(c("Masculino", "Femenino"), c("Menos de 16", "16 a 29", 
    "Más de 29"))
int_edu1 <- t(confint(svytotal(~as.factor(edadg), subset(pob12, ic_rezedu == 
    1 & sexo == 1))))
int_edu2 <- t(confint(svytotal(~as.factor(edadg), subset(pob12, ic_rezedu == 
    1 & sexo == 2))))
dimnames(int_edu2) <- dimnames(int_edu1) <- list(c("Masculino", "Femenino"), 
    c("Menos de 16", "16 a 29", "Más de 29"))

barplot(edu/1000, beside = 1, ylab = "miles", xlab = "años en 2012", col = brewer.pal(12, 
    "Paired")[11:12], ylim = c(0, 150), main = "Población con carencia por rezago educativo \n según sexo y grupo de edad")
legend("topleft", bty = "n", legend = c("Masculino", "Femenino"), col = brewer.pal(12, 
    "Paired")[11:12], pch = 15, pt.cex = 3)
segments(x1 = seq(1.5, by = 3, length = 3), x0 = seq(1.5, by = 3, length = 3), 
    y0 = int_edu1[1, ]/1000, y1 = int_edu1[2, ]/1000)
segments(x1 = seq(1.5, by = 3, length = 3) + 0.25, x0 = seq(1.5, by = 3, length = 3) - 
    0.25, y0 = int_edu1[1, ]/1000, y1 = int_edu1[1, ]/1000)
segments(x1 = seq(1.5, by = 3, length = 3) + 0.25, x0 = seq(1.5, by = 3, length = 3) - 
    0.25, y0 = int_edu1[2, ]/1000, y1 = int_edu1[2, ]/1000)
segments(x1 = seq(2.5, by = 3, length = 3), x0 = seq(2.5, by = 3, length = 3), 
    y0 = int_edu2[1, ]/1000, y1 = int_edu2[2, ]/1000)
segments(x1 = seq(2.5, by = 3, length = 3) + 0.25, x0 = seq(2.5, by = 3, length = 3) - 
    0.25, y0 = int_edu2[1, ]/1000, y1 = int_edu2[1, ]/1000)
segments(x1 = seq(2.5, by = 3, length = 3) + 0.25, x0 = seq(2.5, by = 3, length = 3) - 
    0.25, y0 = int_edu2[2, ]/1000, y1 = int_edu2[2, ]/1000)

plot of chunk unnamed-chunk-14