# ============================================================================== # SCRIPT: 097I_Tese_Wagstaff_Direto_Sem_IC.R # # VERSAO ALTERNATIVA DAS FIGURAS DE WAGSTAFF (pedido do autor, 2026-11-04): # sem margem de erro e sem regressao, so o calculo do indice. # # C = 2 cov_w(y, r) / mu W = C / (1 - mu) # # onde y e o resultado binario, r o posto fracionario ponderado de renda e mu a # media ponderada de y. Nao usa o pacote survey, nao usa DEFF e nao desenha # faixa. Os valores devem coincidir com os das figuras atuais; a secao 3 confere. # # FIGURAS (rascunhos em output/graphs/; com PROMOVER = TRUE, a secao 9 # promove as quatro para 6-images-tables/final/, decisao do autor de 2026-11-08): # 1. Acesso e matricula, com painel de Gini e renda (versao de 097D) # 2. Decomposicao em elegibilidade e transicao (versao de 097H) # 3. Serie condicional com postos reordenados (versao de 097G) # 4. Matricula por rede (versao de 043) # # AMOSTRAS: as mesmas de cada script de origem. ANO_SPLICE = 2015, renda > 0. # # ENTRADAS: output/Microdados_Todas_Idades_1992_2025.parquet # output/238_serie_desigualdade_oficial.rds # output/242_serie_renda_domiciliar.rds # 4-DA-Code/output/dados_rede_publica_privada_2001_2025.rds # SAIDA: output/097I_wagstaff_direto_sem_ic.csv # # OPEN DATA ANALYSIS: copia do script da dissertacao (versao de 2026-11-08, # a mesma das figuras depositadas), com tres ajustes. # 1. Caminhos: data-raw/harmonizing-br-data/output/ e # data-raw/rede-publica-privada/ (gravado por # shared-pipeline/pnadc/043_Extrair_Rede_Publica_Privada.R). # 2. A conferencia da secao 3 so roda para as series de referencia que # existirem em data-raw/ (na dissertacao, todas existem). # 3. FIG_IDIOMA=pt (padrao, identico a dissertacao) ou en: muda so o texto # das figuras e a pasta de saida (sufixo -pt). # As quatro figuras saem em output/figures/[-pt]/. # Este mesmo script esta nos quatro posts das figuras de Wagstaff. # ============================================================================== suppressPackageStartupMessages({ library(arrow) library(dplyr) library(tidyr) library(ggplot2) library(here) library(patchwork) }) source(here::here("shared-pipeline", "utils", "plot_theme.R")) theme_set(thesis_theme(base_size = 14)) BASE_DIR <- here::here("data-raw", "harmonizing-br-data") ANO_SPLICE <- 2015L IDIOMA <- Sys.getenv("FIG_IDIOMA", "pt") stopifnot(IDIOMA %in% c("pt", "en")) TR <- function(pt, en) if (IDIOMA == "pt") pt else en SUFIXO <- if (IDIOMA == "pt") "-pt" else "" # ============================================================================== # 1. O INDICE # ============================================================================== # Posto fracionario ponderado. Empates recebem o mesmo posto: peso acumulado # antes do grupo mais metade do peso do grupo, dividido pelo peso total. posto_fracionario <- function(x, w) { ord <- order(x) xs <- x[ord] ws <- w[ord] g <- cumsum(c(TRUE, xs[-1L] != xs[-length(xs)])) Wg <- as.vector(rowsum(ws, g, reorder = FALSE)) r <- numeric(length(x)) r[ord] <- ((cumsum(Wg) - Wg / 2) / sum(Wg))[g] r } # Com `r` informado, usa esse posto (termo da transicao do 097H) e centra na # media ponderada de r, que so e 0,5 quando o posto e da propria amostra. indice <- function(y, w, x = NULL, r = NULL) { ok <- !is.na(y) & !is.na(w) & w > 0 if (is.null(r)) ok <- ok & !is.na(x) else ok <- ok & !is.na(r) y <- y[ok] w <- w[ok] r <- if (is.null(r)) posto_fracionario(x[ok], w) else r[ok] mu <- weighted.mean(y, w) if (length(y) < 20L || mu <= 0 || mu >= 1) { return(data.frame(mu = NA_real_, C = NA_real_, W = NA_real_)) } C <- 2 * weighted.mean((y - mu) * (r - weighted.mean(r, w)), w) / mu data.frame(mu = mu, C = C, W = C / (1 - mu)) } # ============================================================================== # 2. CALCULO # ============================================================================== cat("Carregando microdados...\n") base <- read_parquet( file.path(BASE_DIR, "output/Microdados_Todas_Idades_1992_2025.parquet"), col_select = c("ano", "fonte", "idade", "peso", "renda_dom_pcta", "renda_real", "medio_completo", "ens_sup", "ens_sup_a") ) |> filter(!is.na(peso), !is.na(renda_real), !is.na(renda_dom_pcta), renda_dom_pcta < 99999999999, renda_real > 0, !(fonte == "PNAD Contínua" & ano <= ANO_SPLICE)) acesso <- list() funil <- list() cond <- list() for (ano_cor in sort(unique(base$ano))) { d_ano <- base |> filter(ano == ano_cor) d1824 <- d_ano |> filter(idade >= 18L, idade <= 24L) d1864 <- d_ano |> filter(idade >= 18L, idade <= 64L) acesso[[length(acesso) + 1L]] <- bind_rows( cbind(cenario = "18-24 Access (ever enrolled)", indice(d1824$ens_sup, d1824$peso, d1824$renda_real)), cbind(cenario = "18-24 Enrollment (currently enrolled)", indice(d1824$ens_sup_a, d1824$peso, d1824$renda_real)), cbind(cenario = "18-64 Access (ever enrolled)", indice(d1864$ens_sup, d1864$peso, d1864$renda_real)), cbind(cenario = "18-64 Enrollment (currently enrolled)", indice(d1864$ens_sup_a, d1864$peso, d1864$renda_real)) ) |> mutate(ano = ano_cor, .before = 1) # Amostra do 097F/097H: 18-24 com os dois desfechos observados, peso > 0 d <- d1824 |> filter(!is.na(medio_completo), !is.na(ens_sup), peso > 0) d$r <- posto_fracionario(d$renda_real, d$peso) d_eleg <- d |> filter(medio_completo == 1L) i_sup <- indice(d$ens_sup, d$peso, r = d$r) i_em <- indice(d$medio_completo, d$peso, r = d$r) i_T <- indice(d_eleg$ens_sup, d_eleg$peso, r = d_eleg$r) i_em_w <- indice(d$medio_completo, d$peso, d$renda_real) i_cond <- indice(d_eleg$ens_sup, d_eleg$peso, d_eleg$renda_real) funil[[length(funil) + 1L]] <- data.frame( ano = ano_cor, mu_sup = i_sup$mu, C_sup = i_sup$C, C_em = i_em$C, C_T = i_T$C ) cond[[length(cond) + 1L]] <- data.frame( ano = ano_cor, W_em = i_em_w$W, W_sup = i_sup$W, W_cond = i_cond$W ) cat(sprintf(" %d ok\n", ano_cor)) } rm(base) invisible(gc()) acesso <- bind_rows(acesso) funil <- bind_rows(funil) |> mutate(W_sup = C_sup / (1 - mu_sup), W_part_em = C_em / (1 - mu_sup), W_part_T = C_T / (1 - mu_sup)) cond <- bind_rows(cond) CACHE_REDE <- here::here("data-raw", "rede-publica-privada", "dados_rede_publica_privada_2001_2025.rds") if (!file.exists(CACHE_REDE)) { stop("Dados por rede ausentes. Rode antes: ", "shared-pipeline/pnadc/043_Extrair_Rede_Publica_Privada.R", call. = FALSE) } dados_rede <- readRDS(CACHE_REDE) SERIES_REDE <- c(ens_sup_a = "Sistema como um todo", rede_pub = "Rede pública", rede_priv = "Rede privada") ROTULO_REDE <- TR(SERIES_REDE, c("Overall", "Public network", "Private network")) rede <- lapply(sort(unique(dados_rede$ano)), function(a) { df_a <- filter(dados_rede, ano == a) bind_rows(lapply(names(SERIES_REDE), function(col) { cbind(ano = a, serie = SERIES_REDE[[col]], indice(df_a[[col]], df_a$peso, df_a$renda_dom_pcta)) })) }) |> bind_rows() # ============================================================================== # 3. CONFERENCIA COM AS SERIES DAS FIGURAS ATUAIS # ============================================================================== dif_max <- function(a, b) max(abs(a - b), na.rm = TRUE) cat("\nCONFERENCIA (maior diferenca absoluta em W):\n") conferir <- function(f) file.exists(f) || {cat(" (sem referencia: ", basename(f), ")\n", sep = ""); FALSE} if (conferir(file.path(BASE_DIR, "output", "097D_Tese_cache_res_long.rds"))) { ref_d <- readRDS(file.path(BASE_DIR, "output", "097D_Tese_cache_res_long.rds")) |> filter(indice == "W") |> select(ano, cenario, W_ref = valor) chk_d <- acesso |> inner_join(ref_d, by = c("ano", "cenario")) cat(sprintf(" 097D (%d celulas): %.2e\n", nrow(chk_d), dif_max(chk_d$W, chk_d$W_ref))) } if (conferir(file.path(BASE_DIR, "output", "097H_wagstaff_decomposicao_funil.rds"))) { ref_h <- readRDS(file.path(BASE_DIR, "output", "097H_wagstaff_decomposicao_funil.rds")) chk_h <- funil |> inner_join(ref_h, by = "ano", suffix = c("", "_ref")) cat(sprintf(" 097H (%d anos): C_sup %.2e ; C_em %.2e ; C_T %.2e\n", nrow(chk_h), dif_max(chk_h$C_sup, chk_h$C_sup_ref), dif_max(chk_h$C_em, chk_h$C_em_ref), dif_max(chk_h$C_T, chk_h$C_T_ref))) } if (conferir(file.path(BASE_DIR, "output", "097F_diag_wagstaff_transicao_decomposicao.rds"))) { ref_f <- readRDS(file.path(BASE_DIR, "output", "097F_diag_wagstaff_transicao_decomposicao.rds")) |> filter(faixa == "Ages 18-24", serie == "Tertiary access | completed US") |> select(ano, W_ref = W) chk_f <- cond |> inner_join(ref_f, by = "ano") cat(sprintf(" 097F/097G condicional (%d anos): %.2e\n", nrow(chk_f), dif_max(chk_f$W_cond, chk_f$W_ref))) } REF_REDE <- here::here("data-raw", "rede-publica-privada", "wagstaff_timeseries_rede_publica_privada_2001_2025.csv") if (conferir(REF_REDE)) { ref_r <- read.csv(REF_REDE) |> mutate(serie = unname(c("Overall" = "Sistema como um todo", "Public network" = "Rede pública", "Private network" = "Rede privada")[serie])) |> select(ano, serie, W_ref = W) chk_r <- rede |> inner_join(ref_r, by = c("ano", "serie")) cat(sprintf(" 043 (%d celulas, CSV com 6 casas): %.2e\n", nrow(chk_r), dif_max(chk_r$W, chk_r$W_ref))) } erro_soma <- max(abs(funil$C_em + funil$C_T - funil$C_sup)) cat(sprintf(" Identidade C_sup = C_EM + T: %.2e\n", erro_soma)) if (erro_soma > 1e-6) stop("Decomposicao nao fecha.") write.csv( bind_rows( acesso |> transmute(ano, figura = "acesso", serie = cenario, W), funil |> pivot_longer(c(W_sup, W_part_em, W_part_T), names_to = "serie", values_to = "W") |> transmute(ano, figura = "funil", serie, W), cond |> pivot_longer(c(W_em, W_sup, W_cond), names_to = "serie", values_to = "W") |> transmute(ano, figura = "condicional", serie, W), rede |> transmute(ano, figura = "rede", serie, W) ), file.path(BASE_DIR, "output", "097I_wagstaff_direto_sem_ic.csv"), row.names = FALSE ) # ============================================================================== # 4. ELEMENTOS COMUNS # ============================================================================== FIM_DADOS <- max(acesso$ano) virgula <- function(digitos) { function(x) formatC(x, format = "f", digits = digitos, decimal.mark = TR(",", ".")) } scale_x_serie <- scale_x_anos_tese( anos = c(ANOS_TRANSICAO_GOV, FIM_DADOS), expand = expansion(mult = c(0.015, 0), add = c(0, 1.8)) ) banner_serie <- function(tamanho_pt = 7) { banner_governos(fim_dados = FIM_DADOS, ini_dados = min(acesso$ano), scale_x = scale_x_serie, tamanho_pt = tamanho_pt) + theme(plot.margin = margin(2, 5.5, 1, 5.5)) } tema_painel <- theme( panel.grid.minor = element_blank(), legend.position = "bottom", legend.box = "horizontal", legend.text = element_text(size = 9), legend.key.size = unit(0.7, "lines"), legend.spacing.x = unit(0.15, "cm"), plot.margin = margin(6, 5.5, 2, 5.5) ) salvar_duplo <- function(p, prefixo, altura) { for (formato in c("png", "pdf")) { salvar_grafico(p, prefixo = prefixo, largura = LARGURA_TEXTO, altura = altura, unidades = "in", formato = formato) } } # ============================================================================== # 5. FIGURA 1 -- ACESSO E MATRICULA, COM GINI E RENDA # ============================================================================== NIVEIS_A <- c("18-64 Access (ever enrolled)", "18-24 Access (ever enrolled)", "18-24 Enrollment (currently enrolled)", "18-64 Enrollment (currently enrolled)") LBL_A <- setNames(TR(c("18–64 anos, já ingressou", "18–24 anos, já ingressou", "18–24 anos, matriculado", "18–64 anos, matriculado"), c("Ages 18–64, ever enrolled", "Ages 18–24, ever enrolled", "Ages 18–24, currently enrolled", "Ages 18–64, currently enrolled")), NIVEIS_A) COR_ADULTO <- PALETA_QUALITATIVA[[1]] COR_JOVEM <- PALETA_QUALITATIVA[[2]] COR_A <- setNames(c(COR_ADULTO, COR_JOVEM, COR_JOVEM, COR_ADULTO), NIVEIS_A) LTY_A <- setNames(c("solid", "solid", "dashed", "dashed"), NIVEIS_A) SHP_A <- setNames(c(16, 16, 17, 17), NIVEIS_A) d_a <- acesso |> mutate(serie = factor(cenario, levels = NIVEIS_A)) p_a <- ggplot(d_a, aes(x = ano, y = W, colour = serie, linetype = serie)) + geom_line(linewidth = 1.0, na.rm = TRUE) + geom_point(aes(shape = serie), size = 2.4, na.rm = TRUE) + scale_colour_manual(name = NULL, values = COR_A, labels = LBL_A) + scale_linetype_manual(name = NULL, values = LTY_A, labels = LBL_A) + scale_shape_manual(name = NULL, values = SHP_A, labels = LBL_A) + guides(colour = guide_legend(nrow = 2, byrow = TRUE)) + scale_x_serie + scale_y_continuous(labels = virgula(1), expand = expansion(mult = c(0.02, 0.05))) + labs(x = TR("Ano", "Year"), y = TR("Índice de Wagstaff (W)", "Wagstaff index (W)")) + tema_painel + theme(axis.text.x = element_text(size = 11), axis.ticks.x = element_line()) serie_gini <- readRDS(file.path(BASE_DIR, "output", "238_serie_desigualdade_oficial.rds"))$oficial |> select(ano, gini, retroponderado) |> arrange(ano) |> mutate(seg = cumsum(c(1L, as.integer(diff(ano) > 1L)))) serie_renda <- readRDS(file.path(BASE_DIR, "output", "242_serie_renda_domiciliar.rds"))$principal |> select(ano, mediana, visita5) |> arrange(ano) |> mutate(seg = cumsum(c(1L, as.integer(diff(ano) > 1L)))) COR_GINI <- PALETA_QUALITATIVA[3] COR_RENDA <- "#0072B2" esc_b <- diff(range(serie_gini$gini)) / diff(range(serie_renda$mediana)) esc_a <- min(serie_gini$gini) - esc_b * min(serie_renda$mediana) serie_renda <- serie_renda |> mutate(y_plot = esc_a + esc_b * mediana) LBL_B <- TR(c(gini = "Índice de Gini", renda = "Renda mediana (eixo direito)"), c(gini = "Gini index", renda = "Median income (right axis)")) p_b <- ggplot(mapping = aes(x = ano, group = seg)) + geom_vline(xintercept = 2015.5, colour = "#9A9A9A", linewidth = 0.4) + geom_line(data = serie_gini, aes(y = gini, colour = "gini"), linewidth = 1.0) + geom_line(data = serie_renda, aes(y = y_plot, colour = "renda"), linewidth = 1.0) + geom_point(data = filter(serie_gini, !retroponderado), aes(y = gini, colour = "gini"), size = 2.4) + geom_point(data = filter(serie_gini, retroponderado), aes(y = gini, colour = "gini"), fill = "white", shape = 21, size = 2.6, stroke = 0.7) + geom_point(data = filter(serie_renda, !visita5), aes(y = y_plot, colour = "renda"), shape = 15, size = 2.2) + geom_point(data = filter(serie_renda, visita5), aes(y = y_plot, colour = "renda"), fill = "white", shape = 22, size = 2.4, stroke = 0.7) + scale_colour_manual(name = NULL, values = c(gini = COR_GINI, renda = COR_RENDA), labels = LBL_B, breaks = c("gini", "renda")) + guides(colour = guide_legend(override.aes = list(shape = c(16, 15), fill = NA, size = 2.4))) + scale_x_serie + scale_y_continuous(breaks = seq(0.48, 0.62, 0.02), labels = virgula(2), expand = expansion(mult = c(0.05, 0.12)), sec.axis = sec_axis(~ (. - esc_a) / esc_b, name = TR("Renda domiciliar per capita\nmediana (R$ de jan./2024)", "Median per capita household\nincome (R$, Jan. 2024)"), labels = function(x) format(round(x), big.mark = TR(".", ","), trim = TRUE))) + labs(x = TR("Ano", "Year"), y = TR("Índice de Gini\n(renda domiciliar)", "Gini index\n(household income)")) + theme( panel.grid.minor = element_blank(), axis.title.y = element_text(size = 9, colour = COR_GINI), axis.title.y.right = element_text(size = 9, colour = COR_RENDA), legend.position = "bottom", legend.text = element_text(size = 9), legend.key.size = unit(0.7, "lines"), axis.text.x = element_text(size = 11), plot.margin = margin(6, 5.5, 5.5, 5.5) ) p_fig1 <- banner_serie() / p_a / p_b + plot_layout(heights = c(0.6, 7, 5)) + plot_annotation(tag_levels = list(c("", "A", "B"))) & theme(plot.tag.position = "topleft", plot.tag = element_text(size = 12, face = "bold", family = THESIS_FONT, margin = margin(t = 2, l = 2, b = 4))) salvar_duplo(p_fig1, paste0("097I_Wagstaff_Direto_Acesso_Matricula_", IDIOMA), 7.45) # ============================================================================== # 6. FIGURA 2 -- DECOMPOSICAO EM ELEGIBILIDADE E TRANSICAO # ============================================================================== NIVEIS_F <- c("W_sup", "W_part_em", "W_part_T") LBL_F <- setNames(TR(c("Ingressou na educação terciária", "Elegibilidade (ensino médio)", "Transição (entre concluintes)"), c("Entered tertiary", "Eligibility (upper secondary)", "Transition (among completers)")), NIVEIS_F) COR_F <- c(W_sup = PALETA_QUALITATIVA[[2]], W_part_em = PALETA_QUALITATIVA[[1]], W_part_T = PALETA_QUALITATIVA[[3]]) LTY_F <- c(W_sup = "solid", W_part_em = "solid", W_part_T = "dashed") SHP_F <- c(W_sup = 17, W_part_em = 16, W_part_T = 15) d_f <- funil |> pivot_longer(all_of(NIVEIS_F), names_to = "serie", values_to = "valor") |> mutate(serie = factor(serie, levels = NIVEIS_F)) |> arrange(serie, ano) |> mutate(seg = cumsum(c(1L, as.integer(diff(ano) > 1L))), .by = serie) p_f <- ggplot(d_f, aes(x = ano, y = valor, colour = serie, linetype = serie, group = interaction(serie, seg))) + geom_line(linewidth = 1.0) + geom_point(aes(shape = serie), size = 2.4) + scale_colour_manual(name = NULL, values = COR_F, labels = LBL_F) + scale_linetype_manual(name = NULL, values = LTY_F, labels = LBL_F) + scale_shape_manual(name = NULL, values = SHP_F, labels = LBL_F) + guides(colour = guide_legend(nrow = 2, byrow = TRUE)) + scale_x_serie + scale_y_continuous(labels = virgula(1), expand = expansion(mult = c(0.02, 0.05))) + labs(x = TR("Ano", "Year"), y = TR("Índice de Wagstaff (W)", "Wagstaff index (W)")) + tema_painel p_fig2 <- banner_serie(8) / p_f + plot_layout(heights = c(1, 11)) salvar_duplo(p_fig2, paste0("097I_Wagstaff_Direto_Decomposicao_Funil_", IDIOMA), ALTURA_ALTA) # ============================================================================== # 7. FIGURA 3 -- SERIE CONDICIONAL COM POSTOS REORDENADOS # ============================================================================== NIVEIS_C <- c("W_em", "W_sup", "W_cond") LBL_C <- setNames(TR(c("Concluiu o ensino médio", "Ingressou na terciária", "Ingressou, entre concluintes"), c("Completed upper secondary", "Entered tertiary", "Entered tertiary, among completers")), NIVEIS_C) COR_C <- setNames(c(PALETA_QUALITATIVA[[1]], PALETA_QUALITATIVA[[2]], PALETA_QUALITATIVA[[3]]), NIVEIS_C) LTY_C <- setNames(c("solid", "solid", "dashed"), NIVEIS_C) SHP_C <- setNames(c(16, 17, 15), NIVEIS_C) d_c <- cond |> pivot_longer(all_of(NIVEIS_C), names_to = "serie", values_to = "valor") |> mutate(serie = factor(serie, levels = NIVEIS_C)) p_c <- ggplot(d_c, aes(x = ano, y = valor, colour = serie, linetype = serie)) + geom_line(linewidth = 1.0, na.rm = TRUE) + geom_point(aes(shape = serie), size = 2.4, na.rm = TRUE) + scale_colour_manual(name = NULL, values = COR_C, labels = LBL_C) + scale_linetype_manual(name = NULL, values = LTY_C, labels = LBL_C) + scale_shape_manual(name = NULL, values = SHP_C, labels = LBL_C) + guides(colour = guide_legend(nrow = 1)) + scale_x_serie + scale_y_continuous(labels = virgula(1), expand = expansion(mult = c(0.02, 0.05))) + labs(x = TR("Ano", "Year"), y = TR("Índice de Wagstaff (W)", "Wagstaff index (W)")) + tema_painel p_fig3 <- banner_serie(8) / p_c + plot_layout(heights = c(1, 11)) salvar_duplo(p_fig3, paste0("097I_Wagstaff_Direto_Transicao_Condicional_", IDIOMA), ALTURA_ALTA) # ============================================================================== # 8. FIGURA 4 -- MATRICULA POR REDE (2001-2025; linhas quebram nos anos sem dado) # ============================================================================== anos_rede <- seq(min(rede$ano), max(rede$ano)) d_r <- expand.grid(ano = anos_rede, serie = unname(SERIES_REDE), stringsAsFactors = FALSE) |> left_join(rede |> select(ano, serie, W), by = c("ano", "serie")) |> mutate(serie = factor(serie, levels = unname(SERIES_REDE))) scale_x_rede <- scale_x_anos_tese(anos = d_r$ano) banner_rede <- banner_governos(fim_dados = max(anos_rede), ini_dados = min(anos_rede), scale_x = scale_x_rede) + theme(plot.margin = margin(2, 5.5, 1, 5.5)) p_r <- ggplot(d_r, aes(x = ano, y = W, colour = serie)) + geom_line(linewidth = 0.9, na.rm = TRUE) + geom_point(size = 1.3, na.rm = TRUE) + scale_colour_thesis(name = NULL, labels = setNames(ROTULO_REDE, SERIES_REDE)) + scale_x_rede + scale_y_continuous(labels = virgula(2)) + labs(x = TR("Ano", "Year"), y = TR("Índice de Wagstaff (W)", "Wagstaff index (W)")) + theme(legend.position = "bottom", plot.margin = margin(1, 5.5, 5.5, 5.5)) p_fig4 <- banner_rede / p_r + plot_layout(heights = c(1, 11)) salvar_duplo(p_fig4, paste0("097I_Wagstaff_Direto_Rede_Publica_Privada_", IDIOMA), ALTURA_ALTA) # ============================================================================== # 9. PROMOCAO PARA final/ (decisao do autor, 2026-11-08) # ============================================================================== # Depois da critica do coorientador ao DEFF fixo de 2,0, o autor decidiu ficar # com o indice direto, sem faixas de IC e sem regressao. As quatro figuras # substituem as versoes de 097D, 097H, gerar_figuras_residuais_pt (097G) e 043 # nas mesmas pastas -pt. A legenda e a nota de cada figura ficam no capitulo; # o .qmd gerado aqui leva so a legenda e a fonte. PROMOVER <- TRUE if (PROMOVER) { script_097I <- here::here("posts", "wagstaff-decomposicao-funil", "plot.R") ANO_INI <- min(acesso$ano) FONTE_PNAD <- paste0("IBGE --- PNAD (", ANO_INI, "--2015) ", TR("e", "and"), " PNAD Contínua (2016--", FIM_DADOS, ")") promover <- function(plot, fig_label, fig_cap, altura, fonte = FONTE_PNAD) { finalizar_figura(plot = plot, fig_label = fig_label, fig_cap = fig_cap, script_path = script_097I, fonte = fonte, largura = LARGURA_TEXTO, altura = altura, unidades = "in", idioma = IDIOMA) } promover(p_fig1, paste0("wagstaff-acesso-matricula", SUFIXO), if (IDIOMA == "en") paste0("Relative inequality in access to and enrollment in tertiary education, ", "by age group, Brazil, ", ANO_INI, "–", FIM_DADOS, " (Wagstaff concentration index), with the Gini index and median per capita ", "household income over the same period.") else paste0("Desigualdade relativa no acesso e na matrícula na educação terciária, ", "por faixa etária, Brasil, ", ANO_INI, "–", FIM_DADOS, " (índice de concentração de Wagstaff), e índice de Gini e renda domiciliar ", "per capita mediana no mesmo período."), 7.45) promover(p_fig2, paste0("wagstaff-decomposicao-funil", SUFIXO), if (IDIOMA == "en") paste0("Income inequality in tertiary access decomposed into eligibility ", "and transition, ages 18 to 24, Brazil, ", ANO_INI, "–", FIM_DADOS, " (Wagstaff concentration index).") else paste0("Desigualdade de renda no ingresso na educação terciária decomposta em ", "elegibilidade e transição, 18 a 24 anos, Brasil, ", ANO_INI, "–", FIM_DADOS, " (índice de concentração de Wagstaff)."), ALTURA_ALTA) promover(p_fig3, paste0("wagstaff-transicao-condicional", SUFIXO), if (IDIOMA == "en") paste0("Relative inequality in upper secondary completion, tertiary access ", "and the transition to tertiary education among upper secondary completers, ", "ages 18 to 24, Brazil, ", ANO_INI, "–", FIM_DADOS, " (Wagstaff concentration index).") else paste0("Desigualdade relativa na conclusão do ensino médio, no acesso à educação ", "terciária e na transição à educação terciária entre concluintes do ensino ", "médio, 18 a 24 anos, Brasil, ", ANO_INI, "–", FIM_DADOS, " (índice de concentração de Wagstaff)."), ALTURA_ALTA) promover(p_fig4, paste0("wagstaff-rede-publica-privada-timeseries", SUFIXO), if (IDIOMA == "en") paste0("Income inequality in tertiary enrollment by network ", "(Wagstaff index), Brazil, ", min(anos_rede), "–", max(anos_rede), ".") else paste0("Desigualdade de renda na matrícula na educação terciária por rede ", "(índice de Wagstaff), Brasil, ", min(anos_rede), "–", max(anos_rede), "."), ALTURA_ALTA, fonte = paste0("IBGE --- PNAD Anual (", min(anos_rede), "--2015) ", TR("e", "and"), " PNAD Contínua (2016--", max(anos_rede), ")")) } cat("\n====== 097I concluido ======\n")