Carrega pacotes

options(scipen=999, dplyr.summarise.inform = FALSE)

library(pacman)
p_load(dplyr, lme4, ggplot2, tidyr, stringr, stringi, labelled, hrbrthemes, lmtest, multilevel, stargazer, scales, ggthemes, ggpubr, ggcorrplot, ggeffects, corrplot, effects, forcats, Hmisc, rio, directlabels, gghighlight, forcats, sjPlot, sjlabelled, sjmisc, ggstance, merTools, ggalluvial, grid, cowplot, magick, rlang, eulerr, ggpmisc, reshape2)

select <- dplyr::select
summarise <- dplyr::summarise
replace_na <- tidyr::replace_na

point <- scales::label_number(accuracy = 0.1, big.mark = ".", decimal.mark = ",")
log_change_to_pct <- function(x) {(exp(x)-1)*100} # Transforma os coeficientes de um modelo log-linear em percentuais
fun_mil <- function(x) sprintf("%.0f", x/1000)

Carrega bases principais

CTEM_3 <- readRDS("CTEM_3.rds")
EGP <- readRDS("EGP.rds")
CTEM_M <- readRDS("CTEM_M_so.rds")

Prepara bases para Diagramas de Euler

base_euler <- CTEM_3 %>% filter(idade<41) %>% 
   select(trabalhava_1214, trabalhava_1618, starts_with(c("socio", "IN_POS_2", "in_2a_"))) %>% 
    mutate(
       socio_1214 = pmax(socio_2012, socio_2013, socio_2014),
       estuda_1214 = pmax(IN_POS_2012, IN_POS_2013, IN_POS_2014, in_2a_grad_2012, in_2a_grad_2013, in_2a_grad_2014),
       socio_1618 = pmax(socio_2016, socio_2017, socio_2018),
       estuda_1618 = pmax(IN_POS_2016, IN_POS_2017, IN_POS_2018, in_2a_grad_2016, in_2a_grad_2017, in_2a_grad_2018)
    ) %>% 
   select(trabalhava_1214, trabalhava_1618, socio_1214, socio_1618, estuda_1214, estuda_1618) %>%
   arrange(desc(trabalhava_1214), desc(estuda_1214), desc(socio_1214))

base_euler$id <- row.names(base_euler)

trabalhava_1214 <- base_euler %>% filter(trabalhava_1214==1) %>% select(id)
socio_1214 <- base_euler %>% filter(socio_1214==1) %>% select(id)
estuda_1214 <- base_euler %>% filter(estuda_1214==1) %>% select(id)
semvinculo_1214 <- base_euler %>% filter(trabalhava_1214==0 & socio_1214==0 & estuda_1214==0) %>% select(id)

trabalhava_1618 <- base_euler %>% filter(trabalhava_1618==1) %>% select(id)
socio_1618 <- base_euler %>% filter(socio_1618==1) %>% select(id)
estuda_1618 <- base_euler %>% filter(estuda_1618==1) %>% select(id)
semvinculo_1618 <- base_euler %>% filter(trabalhava_1618==0 & socio_1618==0 & estuda_1618==0) %>% select(id)

euler1 <- list(Empregado = trabalhava_1214$id,
                  `Sócio` = socio_1214$id,
                  Estuda = estuda_1214$id,
                `Sem vínculo` = semvinculo_1214$id
               )

euler2 <- list(Empregado = trabalhava_1618$id,
                  `Sócio` = socio_1618$id,
                  Estuda = estuda_1618$id,
               `Sem vínculo` = semvinculo_1618$id
               )

Faz gráficos de Euler e salva resultados

euler1214 <- euler(euler1,
           shape = "ellipse")

euler1618 <- euler(euler2,
           shape = "ellipse")

png("euler1214.png", 
    width = 400, 
    height = 400, 
    pointsize = 13)
plot(euler1214,
   quantities = TRUE,
   fills = c("#9DBBE3", "#BFE3DF", "#FFF5CC", "#EE9D94"),
   edges = FALSE
   )
dev.off()

png("euler1618.png",
    width = 400, 
    height = 400, 
    pointsize = 13)
plot(euler1618,
   quantities = TRUE,
   fills = c("#9DBBE3", "#BFE3DF", "#FFF5CC", "#EE9D94"),
   edges = FALSE
   )
dev.off()

Faz a legenda dos gráficos:

euler_legenda <- ggplot(data.frame(x = rep(letters[1:3], each = 4), 
                  y = sample(30:70, 12, replace=TRUE), 
                  colour = rep(c("Empregados\n(Rais)",
                             "Sócios\n(RBF)",
                             "Estudam\n(Capes & CES)",
                             "Sem vínculos\nidentificáveis"), 3)), 
         aes(x = x, y = y, fill = colour))+
  geom_bar(position="stack",  stat="identity") + 
  scale_fill_manual(
     #Essa é uma maneira de ordenar os fatores especificamente na legenda, sem modificar a base de dados;
     breaks = c("Empregados\n(Rais)",
                 "Sócios\n(RBF)",
                 "Estudam\n(Capes & CES)",
                 "Sem vínculos\nidentificáveis"),
     values=c("Empregados\n(Rais)" = "#9DBBE3", 
              "Sócios\n(RBF)" = "#BFE3DF", 
              "Estudam\n(Capes & CES)" = "#FFF5CC", 
              "Sem vínculos\nidentificáveis"= "#EE9D94"), drop=FALSE)  +
  guides(fill = guide_legend(override.aes = list(alpha=1, size = 10)))+ # showing the point in the legend
  theme(axis.title = element_blank(),
        axis.text = element_blank(),
        axis.ticks = element_blank(),
        legend.position = c(0.5, 0.5), # move the legend to the center
        legend.direction="horizontal",
        legend.title = element_blank(),
        legend.text = element_text(size = 12),
        legend.key = element_rect(fill='NA'),
        panel.grid = element_blank(),
        panel.border = element_rect(colour = "white", fill='white', size=1)
  )

ggsave("euler_legenda.png", euler_legenda,
       width = 6, height = 1, dpi = 300, units = "in", device='png')

Faz tabela com os dados formatados:

tabela_euler <- 
   data.frame(`Período` = c("2012-2014", " ",  "2016-2018", " "),
              `valor`= c("n", "%", "n", "%"),
              Empregados = c(format(length(trabalhava_1214$id), 
                                    big.mark = ".",
                                    decimal.mark = ","),
                             paste0(format(round(100*length(trabalhava_1214$id)/ length(base_euler$id), 1), big.mark = ".", decimal.mark = ","),"%"), 
                             format(length(trabalhava_1618$id),
                                    big.mark = ".",
                                    decimal.mark = ","),
                             paste0(format(round(100*length(trabalhava_1618$id)/ length(base_euler$id), 1), big.mark = ".", decimal.mark = ","),"%")),
               `Sócios` = c(format(length(socio_1214$id), 
                                    big.mark = ".",
                                    decimal.mark = ","),
                             paste0(format(round(100*length(socio_1214$id)/ length(base_euler$id), 1), big.mark = ".", decimal.mark = ","),"%"), 
                             format(length(socio_1618$id),
                                    big.mark = ".",
                                    decimal.mark = ","),
                             paste0(format(round(100*length(socio_1618$id)/ length(base_euler$id), 1), big.mark = ".", decimal.mark = ","),"%")),
               Estudam = c(format(length(estuda_1214$id), 
                                    big.mark = ".",
                                    decimal.mark = ","),
                             paste0(format(round(100*length(estuda_1214$id)/ length(base_euler$id), 1), big.mark = ".", decimal.mark = ","),"%"), 
                             format(length(estuda_1618$id),
                                    big.mark = ".",
                                    decimal.mark = ","),
                             paste0(format(round(100*length(estuda_1618$id)/ length(base_euler$id), 1), big.mark = ".", decimal.mark = ","),"%")),
              `Sem vínculo` = c(format(length(semvinculo_1214$id), 
                                    big.mark = ".",
                                    decimal.mark = ","),
                             paste0(format(round(100*length(semvinculo_1214$id)/ length(base_euler$id), 1), big.mark = ".", decimal.mark = ","),"%"), 
                             format(length(semvinculo_1618$id),
                                    big.mark = ".",
                                    decimal.mark = ","),
                             paste0(format(round(100*length(semvinculo_1618$id)/ length(base_euler$id), 1), big.mark = ".", decimal.mark = ","),"%")),
              Total = c(format(length(base_euler$id), 
                                    big.mark = ".",
                                    decimal.mark = ","),
                             paste0(format(round(100*length(base_euler$id)/ length(base_euler$id), 1), big.mark = ".", decimal.mark = ","),"%"), 
                             format(length(base_euler$id),
                                    big.mark = ".",
                                    decimal.mark = ","),
                             paste0(format(round(100*length(base_euler$id)/ length(base_euler$id), 1), big.mark = ".", decimal.mark = ","),"%"))
              ) %>%
   rename(`Sem \nvínculos` = `Sem.vínculo`,
          `Tipo de\nvalor` = valor)
# Junta os gráficos de Euler, a legenda e a tabela em uma única figura:
euler1 <- file.path("euler1214.png")
euler2 <- file.path("euler1618.png")
legenda_euler <- file.path("euler_legenda.png")

euler_final <- ggdraw() +
   draw_image(euler1,  x = -0.25, y = 0, scale = 0.6) +
   draw_image(euler2,  x = 0.26, y = 0, scale = 0.6) + 
   draw_image(legenda_euler,  x = 0, y = 0.4, scale = 0.7) +
   annotate(geom="text", x=0.26, y=0.8, label="2012-2014", color="black", fontface = 2, size = 7) + 
   annotate(geom="text", x=0.71, y=0.8, label="2016-2018", color="black", fontface = 2, size = 7) +
   annotate(geom = "table",
           x = 0.5,
           y = 0.02,
           label = list(tabela_euler),
           table.theme = ttheme_gtstripes,
           size = 5)

Gráfico 1 – Diagramas de Euler com distribuição dos egressos por tipos de vínculos (2012-2014 e 2016-2018)

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2012-2018)


Faz gráfico para identificar o percentual de egressos que fazem pós-graduação ou segunda graduação.

estudam <- CTEM_3 %>% filter(idade<41) %>%
   dplyr::select(starts_with(c("IN_POS_2", "in_2a_"))) %>%
    pivot_longer(cols = starts_with(c("IN_POS_2", "in_2a_")),
               names_to = c(".value", "ano"),
               names_pattern = "(.*)_(\\d*)") %>%
   group_by(ano) %>%
   summarise(`Pós-graduação` = sum(IN_POS),
             `2ª graduação` = sum(in_2a_grad)) %>%
   ungroup() %>%
   mutate(total = `Pós-graduação` + `2ª graduação`) %>%
   mutate(`Pós-graduação` = 100*`Pós-graduação`/total,
          `2ª graduação` = 100*`2ª graduação`/total)

estudam_dados_grafico <- estudam %>% select(ano, `Pós-graduação`) %>%
   mutate(`Condição` = "Pós-graduação") %>% rename(valor = `Pós-graduação`) %>%
   rbind(estudam %>% select(ano, `2ª graduação`) %>% 
            mutate(`Condição` = "2ª graduação") %>% rename(valor = `2ª graduação`)) %>%
   mutate(ano = as.character(ano))
   
g_estudam <- ggplot(estudam_dados_grafico, aes(fill=`Condição`, y=valor, x=ano)) + 
    geom_bar(position="fill", stat="identity") +
    scale_fill_manual(
    breaks = c("Pós-graduação",
                "2ª graduação"),
    values=c("Pós-graduação" = "#063970",
             "2ª graduação" = "#76b5c5"), drop=FALSE) +
    theme_pubclean() +
    theme(
    legend.position = "bottom",
    legend.title = element_blank(), 
    legend.text = element_text(size=12, face = "bold"),
    legend.justification = 0.5,
    axis.text.x = element_text(size=11), 
    axis.text.y = element_text(size=11),
        ) +
  scale_x_discrete(name = "") +
  scale_y_continuous(name = "", 
                     labels = scales::label_number(accuracy=1, scale=100, suffix ="%")) +
   geom_text(data = estudam_dados_grafico %>% filter(`Condição` == "Pós-graduação"),
             aes(x = ano, y = valor/200, label = paste0(format(round(valor, 1), decimal.mark ="."), "%"), fontface = "bold"),  
             color="#FFFFFF") +
   geom_text(data = estudam_dados_grafico %>% filter(`Condição` == "2ª graduação"),
             aes(x = ano, y = valor/200 + (100-valor)/100, label = paste0(format(round(valor, 1), decimal.mark ="."), "%"), fontface = "bold"),  
             color="#000000")

Gráfico 2 - Evolução da etapa de ensino dos egressos que estudam

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2012-2018)


Prepara dados para gráfico com distribuição dos tipos de vínculo por área de formação. Nesse gráfico, iremos priorizar mostrar os vínculos de emprego, em seguida os vínculos de empresa, e depois os vínculos de estudo. Ou seja, quando o egresso for empregado e também tiver empresa ou estudar, aparecerá apenas como empregado. Quando tiver empresa e estudar, aparecerá apenas como empresa.

# Prepara dados
vinculos_excludentes <- CTEM_3 %>% filter(idade < 41) %>%
  mutate(
    vinculos_2012_2014 = case_when(
    pmax(trabalha_2012, trabalha_2013, trabalha_2014) == 1 ~ "empregado",
    pmax(socio_2012, socio_2013, socio_2014) == 1 ~ "empregador ou conta-própria",
    pmax(IN_POS_2012, IN_POS_2013, IN_POS_2014, in_2a_grad_2012, in_2a_grad_2013, in_2a_grad_2014) == 1 ~ "estuda",
    T ~ "sem vínculo"),
    vinculos_2016_2018 = case_when(
    pmax(trabalha_2016, trabalha_2017, trabalha_2018) == 1 ~ "empregado",
    pmax(socio_2016, socio_2017, socio_2018) == 1 ~ "empregador ou conta-própria",
    pmax(IN_POS_2016, IN_POS_2017, IN_POS_2018, in_2a_grad_2016, in_2a_grad_2017, in_2a_grad_2018) == 1 ~ "estuda",
    T ~ "sem vínculo")) %>%
  mutate(
    empregado_2012_2014 = case_when(vinculos_2012_2014 == "empregado" ~ 1, T ~ 0),
    socio_2012_2014 = case_when(vinculos_2012_2014 == "empregador ou conta-própria" ~ 1, T ~ 0),
    estuda_2012_2014 = case_when(vinculos_2012_2014 == "estuda" ~ 1, T ~ 0),
    empregado_2016_2018 = case_when(vinculos_2016_2018 == "empregado" ~ 1, T ~ 0),
    socio_2016_2018 = case_when(vinculos_2016_2018 == "empregador ou conta-própria" ~ 1, T ~ 0),
    estuda_2016_2018 = case_when(vinculos_2016_2018 == "estuda" ~ 1, T ~ 0),
    sem_vinculo_2012_2014 = case_when(vinculos_2012_2014 == "sem vínculo" ~ 1, T ~ 0),
    sem_vinculo_2016_2018 = case_when(vinculos_2016_2018 == "sem vínculo" ~ 1, T ~ 0)) %>%
   group_by(carreira) %>%
    summarise(
    n=n(),
    empregados_2012_2014 = sum(empregado_2012_2014)/n,
    empregados_2016_2018 = sum(empregado_2016_2018)/n,
    socios_2012_2014 = sum(socio_2012_2014)/n,
    socios_2016_2018 = sum(socio_2016_2018)/n,
    estudam_2012_2014 = sum(estuda_2012_2014)/n,
    estudam_2016_2018 = sum(estuda_2016_2018)/n,
    sem_vinculos_2012_2014 = sum(sem_vinculo_2012_2014)/n,
    sem_vinculos_2016_2018 = sum(sem_vinculo_2016_2018)/n,
    tot_empregados_2012_2014 = sum(empregado_2012_2014),
    tot_empregados_2016_2018 = sum(empregado_2016_2018),
    tot_socios_2012_2014 = sum(socio_2012_2014),
    tot_socios_2016_2018 = sum(socio_2016_2018),
    tot_estudam_2012_2014 = sum(estuda_2012_2014),
    tot_estudam_2016_2018 = sum(estuda_2016_2018),
    tot_sem_vinculos_2012_2014 = sum(sem_vinculo_2012_2014),
    tot_sem_vinculos_2016_2018 = sum(sem_vinculo_2016_2018)) %>%
  ungroup()
#Faz gráfico de 2012 a 2014
vin_area_2012_2014 <- vinculos_excludentes %>% 
  select(`Área` = carreira, empregado = empregados_2012_2014, `empregador ou conta-própria` = socios_2012_2014, estuda = estudam_2012_2014, `sem vínculo` = sem_vinculos_2012_2014) 

vin_exc_2012_2014 <- vinculos_excludentes %>% 
  select(`Área` = carreira, n, tot_empregados_2012_2014, tot_socios_2012_2014, tot_estudam_2012_2014, tot_sem_vinculos_2012_2014) %>%
  mutate(`Área` = case_when(`Área` = T ~ "Total")) %>%
  group_by(`Área`) %>%
    summarise(
      n_tot = sum(n),
    empregado = sum(tot_empregados_2012_2014)/n_tot,
    `empregador ou conta-própria` = sum(tot_socios_2012_2014)/n_tot,
    estuda = sum(tot_estudam_2012_2014)/n_tot,
    `sem vínculo` = sum(tot_sem_vinculos_2012_2014)/n_tot) %>%
  ungroup() %>% select(!n_tot) %>% 
  rbind(vin_area_2012_2014) %>%
  pivot_longer(!`Área`, names_to = "Condição", values_to = "Percentual") %>%
  mutate(`Condição` = factor(`Condição`, levels = c("sem vínculo", "estuda", "empregador ou conta-própria", "empregado")),
         `Área` = fct_reorder(`Área`, desc(`Área`)))
                           
vinc1 <- vin_exc_2012_2014 %>% 
  ggplot(aes(fill=`Condição`, y=Percentual, x=`Área`)) + 
    geom_bar(position="fill", stat="identity") +
    theme_pubclean() + 
  scale_fill_manual(values = c("#BBBBBB", "#b3e7ff", "#1ab6ff", "#005780"),  aesthetics = c("fill"), guide = guide_legend(reverse = TRUE)) +
  theme(
    plot.subtitle = element_text(hjust = 0.4, size=12, face = "bold"), # Centraliza o título
    plot.margin = margin(10, 5, 10, 0, "pt"),
    legend.position = "bottom",
    legend.title = element_blank(), 
    legend.text = element_text(size=12, face = "bold"),
    legend.justification = 0.4,
    axis.text.y = element_text(size=12)
        ) +
  scale_x_discrete(name = "") +
  scale_y_continuous(name = "",
                     labels = scales::label_number(scale=100, accuracy = 1, suffix = "%")) +
  labs(subtitle = "2012 - 2014") +
  coord_flip() +
  #Rótulos das barras:
  #empregados:
  geom_text(data = vin_exc_2012_2014 %>% filter(`Condição` == "empregado" & Percentual > 0.035), aes(y = Percentual/2, label = point(Percentual*100), fontface = "bold"),  color="white", size=2.9, position="stack") + 
  #empregadores ou conta-propria:
  geom_text(data = vin_exc_2012_2014 %>% 
              filter(`Condição` %in% c("empregado", "empregador ou conta-própria")) %>%
            group_by(`Área`) %>%
              mutate(posicao = sum(Percentual)) %>%
              ungroup() %>%
              filter(`Condição` == "empregador ou conta-própria" & Percentual > 0.035) %>%
              mutate(posicao = posicao-(Percentual/2)), 
            aes(y = posicao, label = point(Percentual*100), fontface = "bold"),  color="white", size=2.9, position="stack") +
  #estudam (pós ou segunda graduação):
  geom_text(data = vin_exc_2012_2014 %>% 
              filter(`Condição` %in% c("empregado", "empregador ou conta-própria", "estuda")) %>%
            group_by(`Área`) %>%
              mutate(posicao = sum(Percentual)) %>%
              ungroup() %>%
              filter(`Condição` == "estuda" & Percentual > 0.035) %>%
              mutate(posicao = posicao-(Percentual/2)), 
            aes(y = posicao, label = point(Percentual*100), fontface = "bold"),  color="black", size=2.9, position="stack") +
  #sem vínculos:
  geom_text(data = vin_exc_2012_2014 %>% 
              filter(`Condição` == "sem vínculo" & Percentual > 0.035) %>%
              mutate(posicao = 1-(Percentual/2)), 
            aes(y = posicao, label = point(Percentual*100), fontface = "bold"),  color="black", size=2.9, position="stack")
#Faz gráfico de 2016 a 2018
vin_area_2016_2018 <- vinculos_excludentes %>% 
  select(`Área` = carreira, empregado = empregados_2016_2018, `empregador ou conta-própria` = socios_2016_2018, estuda = estudam_2016_2018, `sem vínculo` = sem_vinculos_2016_2018)
  
vin_exc_2016_2018 <- vinculos_excludentes %>% 
  select(`Área` = carreira, n, tot_empregados_2016_2018, tot_socios_2016_2018, tot_estudam_2016_2018, tot_sem_vinculos_2016_2018) %>%
  mutate(`Área` = case_when(`Área` = T ~ "Total")) %>%
  group_by(`Área`) %>%
    summarise(
      n_tot = sum(n),
    empregado = sum(tot_empregados_2016_2018)/n_tot,
    `empregador ou conta-própria` = sum(tot_socios_2016_2018)/n_tot,
    estuda = sum(tot_estudam_2016_2018)/n_tot,
    `sem vínculo` = sum(tot_sem_vinculos_2016_2018)/n_tot) %>%
  ungroup() %>% select(!n_tot) %>% 
  rbind(vin_area_2016_2018) %>%
  pivot_longer(!`Área`, names_to = "Condição", values_to = "Percentual") %>%
  mutate(`Condição` = factor(`Condição`, levels = c("sem vínculo", "estuda", "empregador ou conta-própria", "empregado")),
        `Área` = fct_reorder(`Área`, desc(`Área`)))

vinc2 <- vin_exc_2016_2018 %>% 
  ggplot(aes(fill=`Condição`, y=Percentual, x=`Área`)) + 
    geom_bar(position="fill", stat="identity") +
    theme_pubclean() + 
  scale_fill_manual(values = c("#BBBBBB", "#b3e7ff", "#1ab6ff", "#005780"),  aesthetics = c("fill"), guide = guide_legend(reverse = TRUE)) +
  theme(
    plot.subtitle = element_text(hjust = 0.4, size=12, face = "bold"), # Centraliza o título
    plot.margin = margin(10, 10, 10, 5, "pt"),
    legend.position = "bottom",
    legend.title = element_blank(), 
    legend.text = element_text(size=12, face = "bold"),
    legend.justification = 0.4,
    axis.text.y = element_text(size=12)
        ) +
  scale_x_discrete(name = "") +
  scale_y_continuous(name = "",
                     labels = scales::label_number(scale=100, accuracy = 1, suffix = "%")) +
  labs(subtitle = "2016 - 2018") +
  coord_flip() +
    #Rótulos das barras:
  #empregados:
  geom_text(data = vin_exc_2016_2018 %>% filter(`Condição` == "empregado"  & Percentual > 0.035), aes(y = Percentual/2, label = point(Percentual*100), fontface = "bold"),  color="white", size=2.9, position="stack") + 
  #empregadores ou conta-propria:
  geom_text(data = vin_exc_2016_2018 %>% 
              filter(`Condição` %in% c("empregado", "empregador ou conta-própria")) %>%
            group_by(`Área`) %>%
              mutate(posicao = sum(Percentual)) %>%
              ungroup() %>%
              filter(`Condição` == "empregador ou conta-própria" & Percentual > 0.035) %>%
              mutate(posicao = posicao-(Percentual/2)), 
            aes(y = posicao, label = point(Percentual*100), fontface = "bold"),  color="white", size=2.9, position="stack") +
  #estudam (pós ou segunda graduação):
  geom_text(data = vin_exc_2016_2018 %>% 
              filter(`Condição` %in% c("empregado", "empregador ou conta-própria", "estuda")) %>%
            group_by(`Área`) %>%
              mutate(posicao = sum(Percentual)) %>%
              ungroup() %>%
              filter(`Condição` == "estuda" & Percentual > 0.035) %>%
              mutate(posicao = posicao-(Percentual/2)), 
            aes(y = posicao, label = point(Percentual*100), fontface = "bold"),  color="black", size=2.9, position="stack") +
  #sem vínculos:
  geom_text(data = vin_exc_2016_2018 %>% 
              filter(`Condição` == "sem vínculo" & Percentual > 0.035) %>%
              mutate(posicao = 1-(Percentual/2)), 
            aes(y = posicao, label = point(Percentual*100), fontface = "bold"),  color="black", size=2.9, position="stack")
#Faz gráfico com os totais e junta os três gráficos:
vinc_excl_totais <- vin_exc_2016_2018 %>% 
  filter(`Condição` == "empregado") %>%
  mutate(periodo="2016 a 2018",
         #ordeno as áreas pelos percentuais de empregados de 2018
         `Área` = fct_reorder(`Área`, Percentual),
         # coloco o total como o primeiro fator, para aparecer por último no gráfico
         `Área` = fct_relevel(`Área`, "Total", after = 0)) %>% 
  rbind(vin_exc_2016_2018 %>% filter(`Condição` != "empregado") %>% mutate(periodo ="2016 a 2018")) %>%
  rbind(vin_exc_2012_2014 %>% mutate(periodo ="2012 a 2014"))

vinct <- vinc_excl_totais %>% 
  ggplot(aes(fill=`Condição`, y=Percentual, x=`Área`)) + 
    geom_bar(position="fill", stat="identity") +
    theme_pubclean() + 
  scale_fill_manual(values = c("#BBBBBB", "#b3e7ff", "#1ab6ff", "#005780"),  aesthetics = c("fill"), guide = guide_legend(reverse = TRUE)) +
  theme(
    plot.subtitle = element_text(hjust = 0.4, size=12, face = "bold"), # Centraliza o título
    plot.margin = margin(10, 10, 10, 5, "pt"),
    legend.position = "bottom",
    legend.title = element_blank(), 
    legend.text = element_text(size=12, face = "bold"),
    legend.justification = 0.4,
    axis.text.y = element_text(size=12)
        ) +
  scale_x_discrete(name = "") +
  scale_y_continuous(name = "",
                     labels = scales::label_number(scale=100, accuracy = 1, suffix = "%")) +
  coord_flip() +
    #Rótulos das barras:
  #empregados:
  geom_text(data = vinc_excl_totais %>% filter(`Condição` == "empregado"  & Percentual > 0.035), aes(y = Percentual/2, label = point(Percentual*100), fontface = "bold"),  color="white", size=3.5, position="stack") + 
  #empregadores ou conta-propria:
  geom_text(data = vinc_excl_totais %>% 
              filter(`Condição` %in% c("empregado", "empregador ou conta-própria")) %>%
            group_by(`Área`, periodo) %>%
              mutate(posicao = sum(Percentual)) %>%
              ungroup() %>%
              filter(`Condição` == "empregador ou conta-própria" & Percentual > 0.035) %>%
              mutate(posicao = posicao-(Percentual/2)), 
            aes(y = posicao, label = point(Percentual*100), fontface = "bold"),  color="white", size=3.5, position="stack") +
  #estudam (pós ou segunda graduação):
  geom_text(data = vinc_excl_totais %>% 
              filter(`Condição` %in% c("empregado", "empregador ou conta-própria", "estuda")) %>%
            group_by(`Área`, periodo) %>%
              mutate(posicao = sum(Percentual)) %>%
              ungroup() %>%
              filter(`Condição` == "estuda" & Percentual > 0.035) %>%
              mutate(posicao = posicao-(Percentual/2)), 
            aes(y = posicao, label = point(Percentual*100), fontface = "bold"),  color="black", size=3.5, position="stack") +
  #sem vínculos:
  geom_text(data = vinc_excl_totais %>% 
              filter(`Condição` == "sem vínculo" & Percentual > 0.035) %>%
              mutate(posicao = 1-(Percentual/2)), 
            aes(y = posicao, label = point(Percentual*100), fontface = "bold"),  color="black", size=3.5, position="stack") +
  facet_wrap(~periodo) +
  theme(strip.background = element_rect(fill="white"),
        strip.text = element_text(colour = 'black', size = 13, face = "bold")) +
  geom_vline(xintercept=1.5, size=1.5)

Gráfico 4 – Tipos de vínculos dos egressos dos cursos CTEM entre 2012 e 2018,

em %

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2012-2018)


Prepara dados para gráfico com fluxos de mobilidade:

dados_sankey_pre <- CTEM_3 %>% select(randomID, idade, pais_ES, starts_with("ocu_tip_")) %>%
  filter(idade<41) %>% 
  mutate(
    ocutip_0810 = case_when(
      ocu_tip_2008 == "TIPICA" ~ "Típica",
      ocu_tip_2009 == "TIPICA" ~ "Típica",
      ocu_tip_2010 == "TIPICA" ~ "Típica",
      ocu_tip_2008 == "SUPERIOR" ~ "Superior",
      ocu_tip_2009 == "SUPERIOR" ~ "Superior",
      ocu_tip_2010 == "SUPERIOR" ~ "Superior",
      ocu_tip_2008 == "OUTRAS" ~ "Outras",
      ocu_tip_2009 == "OUTRAS" ~ "Outras",
      ocu_tip_2010 == "OUTRAS" ~ "Outras",
      ocu_tip_2008 == "NAOCLASSIF" ~ "NAOCLASSIF",
      ocu_tip_2009 == "NAOCLASSIF" ~ "NAOCLASSIF",
      ocu_tip_2010 == "NAOCLASSIF" ~ "NAOCLASSIF",
      T ~ "Sem vínculo"),
    ocutip_1214 = case_when(
      ocu_tip_2012 == "TIPICA" ~ "Típica",
      ocu_tip_2013 == "TIPICA" ~ "Típica",
      ocu_tip_2014 == "TIPICA" ~ "Típica",
      ocu_tip_2012 == "SUPERIOR" ~ "Superior",
      ocu_tip_2013 == "SUPERIOR" ~ "Superior",
      ocu_tip_2014 == "SUPERIOR" ~ "Superior",
      ocu_tip_2012 == "OUTRAS" ~ "Outras",
      ocu_tip_2013 == "OUTRAS" ~ "Outras",
      ocu_tip_2014 == "OUTRAS" ~ "Outras",
      ocu_tip_2012 == "NAOCLASSIF" ~ "NAOCLASSIF",
      ocu_tip_2013 == "NAOCLASSIF" ~ "NAOCLASSIF",
      ocu_tip_2014 == "NAOCLASSIF" ~ "NAOCLASSIF",
      T ~ "Sem vínculo"),
    ocutip_1618 = case_when(
      ocu_tip_2016 == "TIPICA" ~ "Típica",
      ocu_tip_2017 == "TIPICA" ~ "Típica",
      ocu_tip_2018 == "TIPICA" ~ "Típica",
      ocu_tip_2016 == "SUPERIOR" ~ "Superior",
      ocu_tip_2017 == "SUPERIOR" ~ "Superior",
      ocu_tip_2018 == "SUPERIOR" ~ "Superior",
      ocu_tip_2016 == "OUTRAS" ~ "Outras",
      ocu_tip_2017 == "OUTRAS" ~ "Outras",
      ocu_tip_2018 == "OUTRAS" ~ "Outras",
      ocu_tip_2016 == "NAOCLASSIF" ~ "NAOCLASSIF",
      ocu_tip_2017 == "NAOCLASSIF" ~ "NAOCLASSIF",
      ocu_tip_2018 == "NAOCLASSIF" ~ "NAOCLASSIF",
      T ~ "Sem vínculo")) %>% 
      filter(ocutip_0810 != "NAOCLASSIF" & ocutip_1214 != "NAOCLASSIF" & ocutip_1618 != "NAOCLASSIF") %>%
      select(-c(starts_with("ocu_tip_"))) 

#Fluxo típicas total:
fluxo_tipicas_total <- dados_sankey_pre %>%
  group_by(ocutip_0810, ocutip_1214, ocutip_1618) %>%
  summarise(n_fluxo = n()) %>%
  ungroup() %>%
  group_by(ocutip_0810) %>%
  mutate(n_0810 = sum(n_fluxo)) %>%
  ungroup() %>%
  group_by(ocutip_1214) %>%
  mutate(n_1214 = sum(n_fluxo)) %>%
  ungroup() %>%
  group_by(ocutip_1618) %>%
  mutate(n_1618 = sum(n_fluxo)) %>%
  ungroup()
dados_alluvial_total <- fluxo_tipicas_total %>%
  mutate(id = row_number()) %>%
  rename(fluxo = n_fluxo) %>%
  select(!c(n_0810, n_1214, n_1618)) %>%
  pivot_longer(cols = starts_with("ocutip"),
               names_to = c(".value", "periodo"),
               names_pattern = "(.*)_(\\d*)") %>%
  mutate(periodo = case_when(
    periodo == "0810" ~ "2008 a 2010", 
    periodo == "1214" ~ "2012 a 2014",
    periodo == "1618" ~ "2016 a 2018",
    T ~ NA_character_),
    periodo = factor(periodo, levels = c("2008 a 2010", "2012 a 2014", "2016 a 2018")),
    ocutip = factor(ocutip, levels = c("Típica", "Superior", "Outras", "Sem vínculo"))) %>%
  group_by(ocutip, periodo) %>%
  mutate(n_estagio = sum(fluxo)) %>%
  ungroup() %>%
  mutate(rotulo = format(n_estagio, big.mark = ".", decimal.mark= ","))

aluvial_total <- ggplot(dados_alluvial_total,
       aes(x = periodo, stratum = ocutip, alluvium = id,
           y = fluxo,
           fill = ocutip, label = rotulo)) +
  scale_x_discrete(expand = c(.1, .1)) +
  geom_flow(alpha = 0.5) +
  geom_stratum(alpha = 0.5) +
  geom_text(stat = "stratum", size = 3.5) +
  theme(legend.position = "bottom",
        legend.title = element_blank(),
        axis.title.x = element_blank(),
        axis.text.x = element_text(size=12, face="bold"),
        axis.ticks.x = element_blank(),
        axis.title.y = element_blank(),
        axis.text.y = element_blank(),
        axis.ticks.y = element_blank(),
        panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(),
        panel.background = element_blank()
        ) +
   scale_fill_manual(values = c("#005780", "#1ab6ff", "#b3e7ff", "#BBBBBB")) +
   annotate(geom="text", x = 1.25, y = 57500, label="9.116", color="black", size = 3.2) +
   annotate(geom="text", x = 1.25, y = 44000, label="9.413", color="black", size = 3.2) +
   annotate(geom="text", x = 1.25, y = 32000, label="9.240", color="black", size = 3.2) +
   annotate(geom="text", x = 1.25, y = 20500, label="11.526", color="black", size = 3.2) +
   annotate(geom="text", x = 1.25, y = 13550, label="2.748", color="black", size = 3.2) +
   annotate(geom="text", x = 1.25, y = 10000, label="4.544", color="black", size = 3.2) + 
   annotate(geom="text", x = 1.25, y = 3750, label="7.504", color="black", size = 3.2) +
   annotate(geom="text", x = 2.26, y = 51000, label="22.190", color="black", size = 3.2) + 
   annotate(geom="text", x = 2.24, y = 38500, label="2.872", color="black", size = 3.2) +
   annotate(geom="text", x = 2.24, y = 35500, label="2.536", color="black", size = 3.2) +
   annotate(geom="text", x = 2.24, y = 32500, label="3.472", color="black", size = 3.2) +
   annotate(geom="text", x = 2.24, y = 28500, label="3.480", color="black", size = 3.2) +
   annotate(geom="text", x = 2.24, y = 16500, label="8.900", color="black", size = 3.2) +
   annotate(geom="text", x = 2.24, y = 3700, label="6.333", color="black", size = 3.2)

Gráfico 5 - Fluxos de mobilidade ocupacional dos egressos das áreas CTEM entre 2012 e 2018

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2008-2018)


Prepara base com descritivas do salário por condição social

desc_rem_cm <- CTEM_3 %>% dplyr::select(randomID, CO_CURSO, carreira, area, sal_so_12_14, sal_so_16_18, genero, raca, geracao, idade, trabalhava, numero_de_pessoas_na_casa, em_escola_publica, em_escola_tecnica, intervalo_EM_ES, 
    chefe_de_familia, estagio, horas_de_estudo, atividade_academica, empenho_enade, curso_pago, faixa_etaria, trabalho, interacao, interacao_1, interacao_2, genero_raca, raca_geracao, genero_geracao, 
    trabalhava_1214, trabalhava_1618, starts_with("rem_so_"))  %>% filter(idade<41) 


#Faz base sem missing das variáveis dependentes e inclui todos os salários anuais
desc_rem <- na.omit(desc_rem_cm %>% select(-c(starts_with("rem_so_"))))
rem_anuais <- CTEM_3 %>% dplyr::select(randomID, CO_CURSO, starts_with("rem_so_"))
desc_rem <- left_join(desc_rem, rem_anuais, by = c("randomID", "CO_CURSO"))


# Faço uma base no formato longitudinal:
interacoes <- desc_rem_cm %>%
  pivot_longer(cols = starts_with("rem_so_2"),
               names_to = c(".value", "ano"),
               names_pattern = "(.*)_(\\d*)") %>% 
  mutate(ano = as.numeric(ano),  #transforma o ano em numerico
#Transforma as remunerações menores que 1000 em missing
         rem_so = case_when(rem_so < 1000 ~ NA_real_,
                            T ~ rem_so)) %>%
  # Variavel de interacao: atribui o rótulo de "Total" aos valores missing
         mutate(interacao = case_when(
             is.na(interacao_1) ~ "Total", 
             T ~ interacao_1)) %>%
  group_by(ano) %>%
  #Cria uma nova coluna com a média amostral do salário por ano; 
  mutate(todos_media_sal_ano = mean(rem_so, na.rm = T)) %>%
  ungroup() %>%
  group_by(interacao, ano, todos_media_sal_ano) %>%
  # Agrega a base por ano e interação, mantendo também a variável de média salarial por ano:
  summarise(salario = mean(rem_so, na.rm = T)) %>% 
  ungroup() %>%
  # Cada linha é um ano e uma interação. Quando a interação for missing, atribuo o valor da média amostral ao total; 
  mutate(salario = case_when(
    interacao == "Total" ~ todos_media_sal_ano, 
    T ~ salario)) %>%
  mutate(interacao = factor(interacao, levels = c(
   "Total",
   "Homem Branco 2ª geração",
   "Homem Negro 2ª geração",
   "Homem Branco 1ª geração",
   "Homem Negro 1ª geração",
   "Mulher Branca 2ª geração",
   "Mulher Negra 2ª geração",
   "Mulher Branca 1ª geração",
   "Mulher Negra 1ª geração")))
  
# Cria rótulos dos gráficos para dois pontos, 2011 ano de graduação e 2018 último ano da série:
rotulo_2018 <- interacoes %>% filter(ano==2018) %>%
  dplyr::select(interacao, salario) %>%
  mutate(salario = round(salario))

rotulo_2011 <- interacoes %>% filter(ano==2011) %>%
  dplyr::select(interacao, salario) %>%
  mutate(salario = round(salario))

#Calcula diferença e variação entre os dois pontos
rotulo_dif_18_11 <- left_join(rotulo_2018, rotulo_2011, by="interacao") %>%
  mutate(dif = paste0("Dif.: ", format(((salario.x - salario.y)/1000), digits = 3), "
                      \nVar.: ", format(((salario.x - salario.y)/salario.y)*100, digits = 3),"%"))
# Faz o gráfico:
p.high <- interacoes %>%
  ggplot( aes(x=ano, y=salario, group=interacao, color="black")) +
  geom_line(size = 2) + 
  #theme_wsj()+
  theme_pubr() +
  scale_fill_manual(values = c(rep("#000000", 9)),  aesthetics = c("colour", "fill")) +
  theme(
    plot.title = element_text(hjust = 0.4, size=14), # Centraliza o título
    plot.subtitle = element_text(hjust = 0.4, size=12), # Centraliza o subtítulo
    legend.justification = 0.4,  # Centraliza a legenda
    plot.caption = element_text(size = 11),
    panel.grid.minor = element_blank(), 
    axis.text.x = element_text(size=10, angle = 45, vjust = 0.7), # Coloca os rótulos do eixo x a 90o
    axis.title.x = element_text(size=10, face="bold"),
    axis.text.y = element_text(size=10),
    axis.title.y = element_text(size=10, face="bold", vjust=0.5),
    legend.position= "none", 
    strip.text.x = element_text( #define os parâmetros dos títulos dos gráficos pequenos
      size = 12, 
      colour = "black", 
      face= "bold", 
      margin = margin(6, 0, 8, 0, "pt"))) + # margins = t r b l
 gghighlight::gghighlight(use_direct_label = F,
                           unhighlighted_params = list(size = 0.5, alpha = 0.6)) + 
  scale_x_continuous(name ="Ano", 
                     breaks = c(seq(2008, 2018, 2))) +
  scale_y_continuous(name ="", 
                     labels = label_number(suffix = "", scale = 1e-3),
                     breaks = c(seq(25000, 100000, 25000)),
                     limits = c(NA ,110000) #Aumenta o limite do eixo, para o rótulo não grudar no título
                     ) +
 facet_wrap(vars(interacao)) + 
  geom_text(data = rotulo_2018, aes(x = 2017, y = salario+10000, label = sprintf("%0.1f", round((salario/1000), digits = 1)), color = "black", fontface = "bold")) +
  geom_text(data = rotulo_2011, aes(x = 2010, y = salario+10000, label = sprintf("%0.1f", round((salario/1000), digits = 1)), color = "black", fontface = "bold")) +
  geom_text(data = rotulo_dif_18_11, aes(x = 2017.5, y = 25000, label = dif, color = "grey"), size=3.5, lineheight = 0.5, hjust=1) +
    geom_vline(xintercept = 2011, color = "gray", size=0.1)

Gráfico 6 – Evolução da remuneração dos egressos das áreas CTEM entre 2007 e 2018, por característica demográfica

Em milhares de reais por ano, com destaque para os anos de 2011 e 2018 e para a variação nesse período

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2007-2018)


Gráficos com os resultados dos modelos multiníveis. Primeiro gráfico, modelos nulos.

# Especifica modelos de regressão nulos
nulo_12_14 <- lmer(ln_sal_so_12_14 ~ 1 + (1 | CO_IES/CO_CURSO),
                  data = CTEM_M)
nulo_16_18 <- lmer(ln_sal_so_16_18 ~ 1 + (1 | CO_IES/CO_CURSO),
                  data = CTEM_M)

# Salva os efeitos aleatórios de nível 2 e 3:
efeitos_aleatorios <- modelRandEffStats(c(nulo_12_14)) %>% 
  mutate(modelo = "2012-2014") %>%
  rbind (modelRandEffStats(c(nulo_16_18)) %>% 
  mutate(modelo = "2016-2018")) %>% 
  select(modelo, group, estimate) %>%
  rename(nivel = group, 
         desvio_padrao = estimate) %>%
  mutate(nivel = case_when(nivel == "CO_CURSO:CO_IES" ~ "Curso\n(Nível 2)",
                           nivel == "CO_IES" ~ "IES\n(Nível 3)",
                           nivel == "Residual" ~ "Residual\n(intra-grupo)",
                           T ~ NA_character_),
         variancia = desvio_padrao^2) %>%
  group_by(modelo) %>%
         mutate(variancia_total = sum(variancia)) %>%
  ungroup() %>%
  mutate(pct_var = (variancia/variancia_total)*100,
         nivel = factor(nivel, levels = c("Residual\n(intra-grupo)", 
                                          "Curso\n(Nível 2)",
                                          "IES\n(Nível 3)")),
         modelo = factor(modelo, levels = c("2016-2018", "2012-2014")))

# Faz o Gráfico: 
gra_nulo <- efeitos_aleatorios %>% 
  ggplot(aes(fill=modelo, y=nivel, x=pct_var)) +
  geom_bar(position="dodge", stat="identity", width=.75, color="black") +
  scale_fill_manual(
    values = c("#000099", "#0099ff"),
    aesthetics = c("fill"), 
    guide = guide_legend(reverse = TRUE)) +
  theme_pubr() +
  theme(
    plot.margin = margin(10, 5, 20, 10, "pt"),
    legend.position = "bottom",
    legend.title = element_blank(), 
    legend.text = element_text(size=12, face = "bold"),
    legend.justification = 0.4
        ) +
  scale_x_continuous(name = "",
                   labels = scales::label_number(accuracy = 1, suffix = "%", decimal.mark = ","), 
                   limits = c(0, 100),
                   breaks = c(seq(0, 100, 25))) +
  scale_y_discrete(name = "") +
  geom_text(aes(label = point(pct_var), fontface = "bold"),  color="black", position=position_dodge(width=0.9), hjust=-0.2)

Gráfico 7 - Variância da remuneração associada aos diferentes níveis dos modelos

(2012-2014 e 2016-2018)

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2012-2018)


Faz gráfico com efeitos das variáveis de características sociais

Salva as informações dos modelos em um novo objeto, formatando já os labels para os gráficos

#Extrai os dados dos modelos
grafico_modelos <- plot_models(m122, m125, m162, m165)
dados <- grafico_modelos$data
dados_modelos <- dados %>% 
   rename(model = group) %>%
   mutate(
      stars = case_when(as.character(p.stars) == "n.s." ~ "  ",
                        as.character(p.stars) == "*" ~ "* ",
                        T ~ as.character(p.stars)),
      label = paste0(format(round(estimate, 3), decimal.mark =","), " ", stars),
      percent = log_change_to_pct(estimate),
      conf.low.pct = log_change_to_pct(conf.low),
      conf.high.pct = log_change_to_pct(conf.high),
      label_percent = paste0(format(round(percent, 1), decimal.mark =","), stars),
      ) %>%
   mutate(
       tipo_modelo = case_when(
         str_detect(model, "sociais") ~ "origens\nsociais",
         str_detect(model, "Ed.Sup") ~ "origens +\nEd.Sup", T ~ ""),
        ano = case_when(
         str_detect(model, "2014") ~ "2012-2014",
         str_detect(model, "2018") ~ "2016-2018", T ~ ""))

Faz gráfico com coeficientes das origens sociais

grafico_origens <- dados_modelos %>%
   filter(term %in% c("HB1", "HN2", "HN1", "MB2", "MN2", "MB1", "MN1")) %>%
   mutate(term = factor(term, levels = c("HB1", "HN2", "HN1", "MB2", "MN2", "MB1", "MN1")),
          model = factor(model, levels = c("2016-2018\n(origens +\nEd.Sup)", "2012-2014\n(origens +\nEd.Sup)", "2016-2018\n(origens\nsociais)", "2012-2014\n(origens\nsociais)"))) %>%
   ggplot(aes(x = percent, y=term)) +
   ggstance::geom_pointrangeh(
      aes(xmin=conf.low.pct, xmax=conf.high.pct, 
          group=model, color=model, shape=model), 
      position = position_dodge(width = 0.8), size=1) +
   scale_color_manual(values = c("#000000", "#999999", "#000000", "#999999"), 
                      guide = guide_legend(reverse=TRUE)) + 
   scale_shape_manual(values = c(17, 17, 16, 16), 
                      guide = guide_legend(reverse=TRUE)) +
   labs(y="", 
        x = "Variação % na remuneração em comparação com os homens brancos de 2ª geração") + 
   geom_text(aes(label = label_percent,  
                 group=model), 
             position = position_dodge(width = 0.8), 
             hjust = 1.7
             ) +
   scale_x_continuous(
      limits = c(-70, 5)
   ) +
   scale_y_discrete(
      labels=c(
                "HB1" = "Homem\nBranco\n1ª geração",     
                "HN2" = "Homem\nNegro\n2ª geração",
                "HN1" = "Homem\nNegro\n1ª geração",
                "MB2" = "Mulher\nBranca\n2ª geração",
                "MN2" = "Mulher\nNegra\n2ª geração",
                "MB1" = "Mulher\nBranca\n1ª geração",
                "MN1" = "Mulher\nNegra\n1ª geração")) +
   geom_vline(xintercept = 0, color = "blue", linetype='dotted', size = 1) +
   geom_hline(yintercept = 1.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 2.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 3.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 4.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 5.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 6.5, color= "black", linetype='dotted', size = 1) + 
   theme_pubr() +
   theme(legend.title = element_blank(), 
       legend.justification = 0.3)  # Centraliza a legenda

Gráfico 9 – Efeitos de gênero, cor/raça e escolaridade dos pais sobre a remuneração

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2012-2018)


Faz gráfico com efeitos de outras características individuais

grafico_carac_indiv <- dados_modelos %>%
   filter(term %in% c("idade_media", "idade_quad", "numero_de_pessoas_na_casa", "privada_regular", "privada_tecnica", "publica_tecnica")) %>%
   mutate(term = factor(term, levels = c("publica_tecnica", "privada_tecnica", "privada_regular", "numero_de_pessoas_na_casa", "idade_quad", "idade_media"))) %>%
   ggplot(aes(x = percent, y=term)) +
   ggstance::geom_pointrangeh(
      aes(xmin=conf.low.pct, xmax=conf.high.pct, 
          group=model, color=model, shape=model), 
      position = position_dodge(width = 0.8), size=1) +
   scale_color_manual(values = c("#000000", "#000000", "#999999", "#999999"), 
                      guide = guide_legend(reverse=TRUE)) + 
   scale_shape_manual(values = c(16, 17, 16, 17), 
                      guide = guide_legend(reverse=TRUE)) +
   labs(y="", 
        x = "Variação marginal % na remuneração média") + 
   geom_text(aes(label = label_percent,  
                 group=model), 
             position = position_dodge(width = 0.8), 
             hjust = -0.7, 
             vjust = -0.01
             ) +
   scale_x_continuous(
      limits = c(-5, 70)
   ) +
   scale_y_discrete(
      labels=c(
                "idade_media" = "Idade",     
                "idade_quad" = "Idade²",
                "numero_de_pessoas_na_casa" = "Nº pessoas\nno domicílio",
                "privada_regular" = "EM Privado\nRegular",
                "privada_tecnica" = "EM Privado\nTécnico",
                "publica_tecnica" = "EM Público\nTécnico")) +
   geom_vline(xintercept = 0, color = "blue", linetype='dotted', size = 1) +
   geom_hline(yintercept = 1.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 2.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 3.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 4.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 5.5, color= "black", linetype='dotted', size = 1) + 
   theme_pubr() +
   theme(legend.title = element_blank(), 
       legend.justification = 0.3)  # Centraliza a legenda

Gráfico 10 – Efeitos de outros fatores individuais sobre a remuneração

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2012-2018)


Faz gráfico com variáveis relativas às experiências dos egressos durante o curso:

grafico_exp_curso <- dados_modelos %>%
   filter(term %in% c("tempo_graduacao", "horas_de_estudo", "trabalhava", "atividade_academica", "empenho_enade")) %>%
   mutate(term = factor(term, levels = c("atividade_academica", "tempo_graduacao", "horas_de_estudo", "empenho_enade", "trabalhava"))) %>%
   ggplot(aes(x = percent, y=term)) +
   ggstance::geom_pointrangeh(
      aes(xmin=conf.low.pct, xmax=conf.high.pct, 
          group=model, color=model, shape=model), 
      position = position_dodge(width = 0.8), size=1) +
   scale_color_manual(values = c("#000000", "#999999"), 
                      guide = guide_legend(reverse=TRUE)) + 
   scale_shape_manual(values = c(16, 16), 
                      guide = guide_legend(reverse=TRUE)) +
   labs(y="", 
        x = "Variação marginal % na remuneração média") + 
   geom_text(aes(label = label_percent,  
                 group=model), 
             position = position_dodge(width = 0.8), 
             hjust = -0.5, 
             vjust = -0.3
             ) +
   scale_x_continuous(
      limits = c(-25, 30)
   ) +
   scale_y_discrete(
      labels=c(
                "tempo_graduacao" = "Tempo de\ngraduação\n(anos)",     
                "horas_de_estudo" = "Horas\nsemanais\nde estudo",
                "atividade_academica" = "Atividade\nacadêmica",
                "empenho_enade" = "Empenho\nno Enade",
                "trabalhava" = "Trabalhava"
                )) +
   geom_vline(xintercept = 0, color = "blue", linetype='dotted', size = 1) +
   geom_hline(yintercept = 1.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 2.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 3.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 4.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 5.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 6.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 7.5, color= "black", linetype='dotted', size = 1) + 
   theme_pubr() +
   theme(legend.title = element_blank(), 
       legend.justification = 0.3)  # Centraliza a legenda

Gráfico 11 – Efeitos de fatores relacionados às experiências durante o curso

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2012-2018)


Efeitos das áreas de formação:

grafico_area <- dados_modelos %>%
   filter(term %in% c("GRUPO_ANPOCS_QUIMIC", "GRUPO_ANPOCS_TEC_INF", "GRUPO_ANPOCS_ARQ_URB", "GRUPO_ANPOCS_FISICA", "GRUPO_ANPOCS_TEC_IND", "GRUPO_ANPOCS_MATEMA", "GRUPO_ANPOCS_ENG_FLO", "GRUPO_ANPOCS_ENG_AMB", "GRUPO_ANPOCS_COMPUT", "GRUPO_ANPOCS_ENG_OUT", "GRUPO_ANPOCS_ENG_CIV", "GRUPO_ANPOCS_ENG_QUI", "GRUPO_ANPOCS_ENG_PRO", "GRUPO_ANPOCS_ENG_MEC", "GRUPO_ANPOCS_ENG_ELE")) %>%
   mutate(term = factor(term, levels = c("GRUPO_ANPOCS_QUIMIC", "GRUPO_ANPOCS_TEC_INF", "GRUPO_ANPOCS_ARQ_URB", "GRUPO_ANPOCS_FISICA", "GRUPO_ANPOCS_TEC_IND", "GRUPO_ANPOCS_MATEMA", "GRUPO_ANPOCS_ENG_FLO", "GRUPO_ANPOCS_ENG_AMB", "GRUPO_ANPOCS_COMPUT", "GRUPO_ANPOCS_ENG_OUT", "GRUPO_ANPOCS_ENG_CIV", "GRUPO_ANPOCS_ENG_QUI", "GRUPO_ANPOCS_ENG_PRO", "GRUPO_ANPOCS_ENG_MEC", "GRUPO_ANPOCS_ENG_ELE"))) %>%
   ggplot(aes(x = percent, y=term)) +
   ggstance::geom_pointrangeh(
      aes(xmin=conf.low.pct, xmax=conf.high.pct, 
          group=model, color=model, shape=model), 
      position = position_dodge(width = 0.8), size=1) +
   scale_color_manual(values = c("#000000", "#999999"), 
                      guide = guide_legend(reverse=TRUE)) + 
   scale_shape_manual(values = c(16, 16), 
                      guide = guide_legend(reverse=TRUE)) +
   labs(y="", 
        x = "Variação % na remuneração em comparação com os egressos do curso de Biologia") + 
   geom_text(aes(label = label_percent,  
                 group=model), 
             position = position_dodge(width = 0.8), 
             hjust = -0.5, 
             vjust = -0.4
             ) +
   scale_x_continuous(
      #limits = c(-25, 20)
   ) +
   scale_y_discrete(
      labels=c(
                "GRUPO_ANPOCS_QUIMIC" = "Química",     
                "GRUPO_ANPOCS_TEC_INF" = "Tecnólogo\nem\nInformática",
                "GRUPO_ANPOCS_ARQ_URB" = "Arquitetura\ne Urbanismo",
                "GRUPO_ANPOCS_FISICA" = "Física",
                "GRUPO_ANPOCS_TEC_IND" = "Tecnólogo\nIndustrial",
                "GRUPO_ANPOCS_MATEMA" =  "Matemática",
                "GRUPO_ANPOCS_ENG_FLO" = "Engenharia\nFlorestal",
                "GRUPO_ANPOCS_ENG_AMB" =  "Engenharia\nAmbiental",
                "GRUPO_ANPOCS_COMPUT" = "Computação",
                "GRUPO_ANPOCS_ENG_OUT" =  "Outras\nEngenharias",
                "GRUPO_ANPOCS_ENG_CIV" =  "Engenharia\nCivil",
                "GRUPO_ANPOCS_ENG_QUI" =  "Engenharia\nQuímica",
                "GRUPO_ANPOCS_ENG_PRO" =  "Engenharia\nde Produção",
                "GRUPO_ANPOCS_ENG_MEC" = "Engenharia\nMecânica",
                "GRUPO_ANPOCS_ENG_ELE" = "Engenharia\nElétrica"
                )) +
   geom_vline(xintercept = 0, color = "blue", linetype='dotted', size = 1) +
   geom_hline(yintercept = 1.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 2.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 3.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 4.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 5.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 6.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 7.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 8.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 9.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 10.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 11.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 12.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 13.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 14.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 15.5, color= "black", linetype='dotted', size = 1) + 
   theme_pubr() +
   theme(legend.title = element_blank(), 
       legend.justification = 0.3)  # Centraliza a legenda

Gráfico 12 – Efeitos das áreas de formação sobre a remuneração

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2012-2018)


Efeitos da qualidade dos cursos e IES:

grafico_qual_curso_ies <- dados_modelos %>%
   filter(term %in% c("turno_noturno", "EaD", "privado_bolsista", "publico", "publico_cotista", "CWC_conceito_enade", "SD_enem_curso_mt_cn", "SD_perc_doutorado", "SD_enem_ies")) %>%
   mutate(term = factor(term, levels = c("EaD", "turno_noturno", "publico_cotista", "publico", "privado_bolsista", "SD_perc_doutorado", "CWC_conceito_enade", "SD_enem_curso_mt_cn", "SD_enem_ies"))) %>%
   ggplot(aes(x = percent, y=term)) +
   ggstance::geom_pointrangeh(
      aes(xmin=conf.low.pct, xmax=conf.high.pct, 
          group=model, color=model, shape=model), 
      position = position_dodge(width = 0.8), size=1) +
   scale_color_manual(values = c("#000000", "#999999"), 
                      guide = guide_legend(reverse=TRUE)) + 
   scale_shape_manual(values = c(16, 16), 
                      guide = guide_legend(reverse=TRUE)) +
   labs(y="", 
        x = "Variação marginal % na remuneração média") + 
   geom_text(aes(label = label_percent,  
                 group=model), 
             position = position_dodge(width = 0.8), 
             hjust = -0.5, 
             vjust = -0.4
             ) +
   scale_x_continuous(
      #limits = c(-25, 20)
   ) +
   scale_y_discrete(
      labels=c(
                "turno_noturno" = "Noturno",     
                "EaD" = "EaD",
                "privado_bolsista" = "Bolsista\nem curso\nprivado",
                "publico" = "Curso\npúblico\n(sem cota)",
                "publico_cotista" = "Cotista\nem curso\npúblico",
                "CWC_conceito_enade" = "Conceito\nEnade",
                "SD_enem_curso_mt_cn" = "Nota média\nEnem\nCurso",
                "SD_perc_doutorado" = "Percentual\ndocentes\ndoutorado",
                "SD_enem_ies" = "Nota média\nEnem\nIES"
                )) +
   geom_vline(xintercept = 0, color = "blue", linetype='dotted', size = 1) +
   geom_hline(yintercept = 1.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 2.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 3.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 4.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 5.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 6.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 7.5, color= "black", linetype='dotted', size = 1) + 
   geom_hline(yintercept = 8.5, color= "black", linetype='dotted', size = 1) + 
   theme_pubr() +
   theme(legend.title = element_blank(), 
       legend.justification = 0.3)  # Centraliza a legenda

Gráfico 13 – Efeitos associados a qualidade e prestígio dos cursos e instituições

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2012-2018)


Gráficos do Anexo

Histogramas de renda:

CTEM_M <- CTEM_M %>% left_join(CTEM_3 %>% select(randomID, sal_so_12_14, sal_so_16_18), by = "randomID")

hist_sal_1214 <- ggplot(CTEM_M, aes(x=sal_so_12_14)) +
  geom_histogram(bins = 500) +
  theme_pubclean() +
  scale_x_continuous(name = "2012 e 2014\n(milhares de R$)", 
                     labels = fun_mil,
                     breaks_extended(7)) +
  scale_y_continuous(name = "",
                     breaks = c(seq(0, 800, 200)))

hist_ln_1214 <- ggplot(CTEM_M, aes(x=sal_so_12_14)) +
  geom_histogram(bins = 500) +
  theme_pubclean() +
  scale_x_continuous(name = "2012 e 2014\n(escala logarítmica)", 
                     trans = "log2",
                     labels = fun_mil, 
                     scales::breaks_log(7, base = 2.7182)) +
  scale_y_continuous(name = "", 
                      breaks = c(seq(0, 200, 50)))

hist_sal_1618 <- ggplot(CTEM_M, aes(x=sal_so_16_18)) +
  geom_histogram(bins = 500) +
  theme_pubclean() +
  scale_x_continuous(name = "2016 e 2018\n(milhares de R$)", labels = fun_mil,
                     breaks_extended(7)) +
  scale_y_continuous(name = "",
                     breaks = c(seq(0, 800, 200)))

hist_ln_1618 <- ggplot(CTEM_M, aes(x=sal_so_16_18)) +
  geom_histogram(bins = 500) +
  theme_pubclean() +
  scale_x_continuous(name = "2016 e 2018\n(escala logarítmica)", 
                     trans = "log2", 
                     labels = fun_mil, 
                     scales::breaks_log(7, base = 2.7182)) +
   scale_y_continuous(name = "", 
                      breaks = c(seq(0, 200, 50)))

hist_renda <- ggarrange(hist_sal_1214, hist_ln_1214, hist_sal_1618, hist_ln_1618, 
          labels = c("A", "B", "C", "D"))

Gráfico 8 - Histogramas das variáveis dependentes (mediana do salário por período)

escala original e logarítmica

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2012-2018)


Análise de resíduos dos modelos de regressão:

CTEM_residuos <- CTEM_M

CTEM_residuos$pred_m122 <- predict(m122)
CTEM_residuos$pred_m162 <- predict(m162)
CTEM_residuos$pred_m125 <- predict(m125)
CTEM_residuos$pred_m165 <- predict(m165)

CTEM_residuos <- CTEM_residuos %>%
   mutate(res_m122 = pred_m122-ln_sal_so_12_14,
          res_m162 = pred_m162-ln_sal_so_16_18,
          res_m125 = pred_m125-ln_sal_so_12_14,
          res_m165 = pred_m165-ln_sal_so_16_18) %>%
   mutate(across(starts_with("res_"),  ~ (.x - mean(.x))/sd(.x), .names = "z{.col}"))
hist_res_incompleto_1214 <- ggplot(CTEM_residuos, aes(x=zres_m122)) +
  geom_histogram(bins = 500) +
  theme_pubclean() +
  scale_x_continuous(name = "Resíduos modelo incompleto\n2012 e 2014", 
                     #breaks_extended(5)
                     ) +
  scale_y_continuous(name = ""
                     #breaks = c(seq(0, 800, 200))
                     ) +
   geom_text(aes(x=2, y=250, label = R2), 
             data = (CTEM_residuos %>% 
                        rename(y = ln_sal_so_12_14, r = pred_m122) %>%
                        mutate(media_y = mean(y)) %>%
                        mutate(pred_med_2 = (y-media_y)^2,
                               pred_mod_2 = (y-r)^2) %>%
                           summarise(TSS=sum(pred_med_2),
                                     RSS=sum(pred_mod_2)) %>%
                           mutate(R2 = paste0("R² = ",round(1-(RSS/TSS), 4))
                           )
             )
   )

hist_res_completo_1214 <- ggplot(CTEM_residuos, aes(x=zres_m125)) +
  geom_histogram(bins = 500) +
  theme_pubclean() +
  scale_x_continuous(name = "Resíduos modelo completo\n2012 e 2014", 
                     #breaks_extended(5)
                     ) +
  scale_y_continuous(name = "" 
                     #breaks = c(seq(0, 200, 50))
                     ) +
   geom_text(aes(x=2, y=350, label = R2), 
             data = (CTEM_residuos %>% 
                        rename(y = ln_sal_so_12_14, r = pred_m125) %>%
                        mutate(media_y = mean(y)) %>%
                        mutate(pred_med_2 = (y-media_y)^2,
                               pred_mod_2 = (y-r)^2) %>%
                           summarise(TSS=sum(pred_med_2),
                                     RSS=sum(pred_mod_2)) %>%
                           mutate(R2 = paste0("R² = ",round(1-(RSS/TSS), 4))
                           )
             )
   )

hist_res_incompleto_1618 <- ggplot(CTEM_residuos, aes(x=zres_m162)) +
  geom_histogram(bins = 500) +
  theme_pubclean() +
  scale_x_continuous(name = "Resíduos modelo incompleto\n2016 e 2018", 
                     #breaks_extended(5)
                     ) +
  scale_y_continuous(name = ""
                     #breaks = c(seq(0, 800, 200))
                     ) +
   geom_text(aes(x=2, y=250, label = R2), 
             data = (CTEM_residuos %>% 
                        rename(y = ln_sal_so_16_18, r = pred_m162) %>%
                        mutate(media_y = mean(y)) %>%
                        mutate(pred_med_2 = (y-media_y)^2,
                               pred_mod_2 = (y-r)^2) %>%
                           summarise(TSS=sum(pred_med_2),
                                     RSS=sum(pred_mod_2)) %>%
                           mutate(R2 = paste0("R² = ",round(1-(RSS/TSS), 4))
                           )
             )
   )


hist_res_completo_1618 <- ggplot(CTEM_residuos, aes(x=zres_m165)) +
  geom_histogram(bins = 500) +
  theme_pubclean() +
  scale_x_continuous(name = "Resíduos modelo completo\n2016 e 2018", 
                     #breaks_extended(5)
                     ) +
  scale_y_continuous(name = "" 
                     #breaks = c(seq(0, 200, 50))
  ) +
   geom_text(aes(x=2, y=350, label = R2), 
             data = (CTEM_residuos %>% 
                        rename(y = ln_sal_so_16_18, r = pred_m165) %>%
                        mutate(media_y = mean(y)) %>%
                        mutate(pred_med_2 = (y-media_y)^2,
                               pred_mod_2 = (y-r)^2) %>%
                           summarise(TSS=sum(pred_med_2),
                                     RSS=sum(pred_mod_2)) %>%
                           mutate(R2 = paste0("R² = ",round(1-(RSS/TSS), 4))
                           )
             )
   )

hist_residuos <- ggarrange(hist_res_incompleto_1214,
                                    hist_res_completo_1214, hist_res_incompleto_1618,
                                    hist_res_completo_1618,
                           labels = c("A", "B", "C", "D"))

Gráfico A2 - Análise de resíduos dos modelos de regressão

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2012-2018)


Analisa diferenças de remuneração por carreira e gênero

mulheres_areas <- desc_rem_cm %>% select(genero, carreira, starts_with("rem_so_2")) %>%
  pivot_longer(cols = starts_with("rem_so_2"),
               names_to = c(".value", "ano"),
               names_pattern = "(.*)_(\\d*)") %>% 
  mutate(ano = as.numeric(ano)) %>% 
   group_by(carreira, ano, genero) %>%
  summarise(renda = mean(rem_so, na.rm = T)) %>% 
  ungroup()
p.genero_anexo <- mulheres_areas %>%
  ggplot(aes(x=ano, y=renda, group=genero, colour=genero)) +
  geom_line(size = 1) +
   scale_color_wsj(name="", labels = c("homem", "mulher")) +
  theme_pubclean()+
  theme(
    plot.title = element_text(hjust = 0.4, size=14), # Centraliza o título
    plot.subtitle = element_text(hjust = 0.4, size=12), # Centraliza o subtítulo
    legend.justification = 0.4,  # Centraliza a legenda
    plot.caption = element_text(size = 11),
    panel.grid.minor = element_blank(), 
    axis.text.x = element_text(size=10, angle = 45, vjust = 0.7), 
    axis.title.x = element_text(size=10, face="bold"),
    axis.text.y = element_text(size=10),
    axis.title.y = element_text(size=10, face="bold", vjust=0.5),
    legend.position= "bottom", 
    strip.text.x = element_text(
      size = 12, 
      colour = "black", 
      face= "bold", 
      margin = margin(6, 0, 8, 0, "pt"))) + 
  scale_x_continuous(name ="Ano", 
                     breaks = c(seq(2008, 2018, 2))) +
  scale_y_continuous(name ="", 
                     labels = label_number(suffix = "", scale = 1e-3),
                     breaks = c(seq(25000, 100000, 25000)),
                     limits = c(NA ,120000)
                     ) +
  facet_wrap(vars(carreira)) + 
  geom_vline(xintercept = 2011.5, color = "#999999", size=0.4)

Gráfico A3 – Remuneração por gênero e carreira, em milhares de reais anuais (2007-2018)

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2007-2018)


Analisa correlação entre origem social e idade

# Idade - Box plot: 
df_box_idade <- desc_rem %>% 
  ungroup() %>% 
  group_by(interacao_2) %>%
  mutate(n=n()) %>% 
  ungroup() %>%
  mutate(interacao = fct_reorder(factor(interacao_2), idade, median, .desc = TRUE),
         interacao = factor(interacao_2, levels = c("HN1", "HB1", "MN1", "MB1", "HN2", "HB2", "MN2", "MB2")),
         x1 = case_when(
          substring(interacao_2, 1, 2) == "HN" ~ "Homem\nNegro",
          substring(interacao_2, 1, 2) == "HB" ~ "Homem\nBranco",
          substring(interacao_2, 1, 2) == "MN" ~ "Mulher\nNegra",
          substring(interacao_2, 1, 2) == "MB" ~ "Mulher\nBranca"),
         x2 = case_when(
          substring(interacao_2, 3) == "1" ~ "1ª ger.",
          substring(interacao_2, 3) == "2" ~ "2ª ger."),
         x3 = paste0("n=", n),
         eixox = paste0(x1, "\n", x2, "\n", x3),
         eixox = fct_reorder(factor(eixox), idade, median, .desc = F),
         eixox = fct_reorder(eixox, idade, mean, .desc = F)) 

# Faz rótulos para os quartis de idade, para plotar no boxplot
box_idade_rotutlos <- df_box_idade %>%
  group_by(eixox) %>%
  summarise(q25 = quantile(idade, 0.25),
            median = median(idade),
            q75 = quantile(idade, 0.75))

# Gera gráfico:
box_idade <- df_box_idade %>% 
  ggplot(aes(x = eixox, y=idade, fill=eixox)) + 
  geom_boxplot(
    outlier.shape=NA,
    outlier.size=0
  ) +
  theme_pubr() + 
  scale_fill_manual(values = c(rep("#DDDDDD", 8))) +
  theme(
     legend.position = "none",
      plot.title = element_text(size=16, hjust = 0.5),
      axis.text.x = element_text(size = 10),
      plot.caption = element_text(size = 8)) +
  scale_x_discrete(name = "") +
  scale_y_continuous(name = "Idade") +
  geom_text(data = box_idade_rotutlos, aes(x = eixox, y = q25 - 0.5, label = q25), color = "black", hjust = 1.1) +
  geom_text(data = box_idade_rotutlos, aes(x = eixox, y = median + 0.6, label = median), color = "black") + 
  geom_text(data = box_idade_rotutlos, aes(x = eixox, y = q75 + 0.6, label = q75), color = "black", hjust = 1.1)

Gráfico A4 – Distribuição etária dos concluintes com 18 a 40 anos completos em 2011, por características sociais.

  • Valores do 1º, 2º e 3º quartis indicados no gráfico.

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2007-2018)


Faz gráfico de correlações entre variáveis individuais

descritivas_origens <- CTEM_M %>%
   mutate(
      negro = case_when(
         str_detect(interacao, "Negr") ~ 1,
         T ~ 0),
      primeira = case_when(
         str_detect(interacao, "1") ~ 1,
         T ~ 0), 
      mulher = case_when(
         str_detect(interacao, "Mulher") ~ 1,
         T ~ 0),
      medio_publico = case_when(
         str_detect(ensino_medio, "publica") ~ 1,
         T ~ 0),
      medio_tecnico = case_when(
         str_detect(ensino_medio, "regular") ~ 0,
         T ~ 1)
      )

correlacoes <- descritivas_origens %>% 
   select(medio_tecnico, medio_publico, idade, primeira, negro, mulher) 

cormat <- round(cor(correlacoes),3)

get_upper_tri <- function(cormat){
    cormat[lower.tri(cormat)]<- NA
    return(cormat)
}

upper_tri <- get_upper_tri(cormat)
# Melt the correlation matrix
melted_cormat <- melt(upper_tri, na.rm = TRUE)
heatmap <- ggplot(data = melted_cormat, aes(Var2, Var1, fill = value))+
 geom_tile(color = "white")+
 scale_fill_gradient2(low = "blue", high = "red", mid = "white", 
   midpoint = 0, limit = c(-1,1), space = "Lab", 
   name="Coeficiente\nde Correlação") +
  theme_minimal()+ 
 theme(axis.text.x = element_text(angle = 45, vjust = 1, 
    size = 10, hjust = 1))+
 coord_fixed() +
   geom_text(aes(Var2, Var1, label = value), color = "black", size = 4) +
theme(
  axis.title.x = element_blank(),
  axis.title.y = element_blank(),
  panel.grid.major = element_blank(),
  panel.border = element_blank(),
  panel.background = element_blank(),
  axis.ticks = element_blank(),
  legend.justification = c(1, 0),
  legend.position = c(0.6, 0.9),
  legend.direction = "horizontal")+
  guides(fill = guide_colorbar(barwidth = 14, barheight = 2,
            title.position = "top", title.hjust = 0.5))

Gráfico A5 – Correlação entre as variáveis individuais anteriores ao ingresso na graduação

heatmap

Fonte: ENADE (2011), CES (2011, 2012) e RAIS (2012-2018)


Tabela A3 – Resultados dos modelos de regressão para o logaritmo do rendimento mediano entre 2012 e 2014

stargazer(m121, m122, m123, m124, m125,
          type="html",
          title = "Preditores do logaritmo do rendimento mediano entre 2012 e 2014 <br> para egressos dos cursos CTEM em 2011",
          out="Modelos_OIT_12_14.htm",
          column.labels = c("Origens<br>Sociais",
                            "Trajetória<br>Escolar<br>Pregressa",
                            "Tipo de<br>curso e<br>IES",
                            "Experiência<br>no curso",
                            "Indicadores<br>de Prestígio<br>e Qualidade"),
          df=T,
          dep.var.caption  = "",
          model.names = F,
          dep.var.labels.include = F,
          covariate.labels=c("Idade",
                             "Idade²",
                             "Homem Negro de 2ª geração",
                             "Homem Branco de 1ª geração", 
                             "Homem Negro de 1ª geração",
                             "Mulher Branca de 2ª geração",
                             "Mulher Negra de 2ª geração",
                             "Mulher Branca de 1ª geração",
                             "Mulher Negra de 1ª geração",
                             "Nº de pessoas no domicílio",
                             "EM Privado Regular",
                             "EM Privado Técnico",
                             "EM Público Técnico",
                             "Bolsista em curso privado",
                             "Curso público (sem cota)",
                             "Cotista em curso público",
                             "Noturno",
                             "EaD",
                             "Química",     
                             "Tecnólogo em Informática",
                             "Arquitetura e Urbanismo",
                             "Física",
                             "Tecnólogo Industrial",
                             "Matemática",
                             "Engenharia Florestal",
                             "Engenharia Ambiental",
                             "Computação",
                             "Outras Engenharias",
                             "Engenharia Civil",
                             "Engenharia Química",
                             "Engenharia de Produção",
                             "Engenharia Mecânica",
                             "Engenharia Elétrica",
                             "Tempo de graduação",
                             "Atividade acadêmica",
                             "Horas de Estudo",
                             "Estágio",
                             "Trabalhava",
                             "Empenho no Enade",
                             "Perc. Docentes Doutorado",
                             "Conceito Enade",
                             "Nota média Enem do Curso",
                             "Nota média Enem da IES",
                             "Intercepto"),
          font.size = "small",
          no.space = T,
          star.cutoffs = c(0.05, 0.01, 0.001),
          notes = c("* p<0.05; ** p<0.01; *** p<0.001", 
                    "Fonte: Enade (2011), CES (2011-2012), Rais (2010-2018)"), 
          omit.stat = c("bic"),
          notes.append = F,
          notes.align = "c",
          suppress.errors=T)
Preditores do logaritmo do rendimento mediano entre 2012 e 2014
para egressos dos cursos CTEM em 2011
Origens
Sociais
Trajetória
Escolar
Pregressa
Tipo de
curso e
IES
Experiência
no curso
Indicadores
de Prestígio
e Qualidade
(1) (2) (3) (4) (5)
Idade 0.047*** 0.042*** 0.026*** 0.025*** 0.025***
(0.001) (0.001) (0.001) (0.001) (0.001)
Idade² -0.002*** -0.003*** -0.0003* -0.0002 -0.0002
(0.0002) (0.0002) (0.0001) (0.0001) (0.0001)
Homem Negro de 2ª geração -0.147*** -0.129*** -0.023 -0.024 -0.021
(0.018) (0.018) (0.015) (0.015) (0.015)
Homem Branco de 1ª geração -0.165*** -0.088*** 0.012 0.005 0.011
(0.011) (0.012) (0.010) (0.010) (0.010)
Homem Negro de 1ª geração -0.308*** -0.217*** -0.037** -0.040*** -0.031**
(0.013) (0.014) (0.012) (0.012) (0.012)
Mulher Branca de 2ª geração -0.337*** -0.327*** -0.140*** -0.131*** -0.130***
(0.014) (0.014) (0.013) (0.013) (0.013)
Mulher Negra de 2ª geração -0.566*** -0.531*** -0.234*** -0.222*** -0.211***
(0.025) (0.025) (0.022) (0.022) (0.021)
Mulher Branca de 1ª geração -0.642*** -0.538*** -0.212*** -0.209*** -0.203***
(0.013) (0.013) (0.012) (0.012) (0.012)
Mulher Negra de 1ª geração -0.772*** -0.660*** -0.270*** -0.267*** -0.253***
(0.016) (0.016) (0.015) (0.015) (0.015)
Nº de pessoas no domicílio -0.034*** -0.030*** -0.018*** -0.018*** -0.017***
(0.002) (0.002) (0.002) (0.002) (0.002)
EM Privado Regular 0.216*** 0.020* 0.029*** 0.016
(0.009) (0.009) (0.009) (0.009)
EM Privado Técnico 0.348*** 0.133*** 0.132*** 0.125***
(0.016) (0.015) (0.015) (0.015)
EM Público Técnico 0.380*** 0.158*** 0.151*** 0.146***
(0.013) (0.012) (0.011) (0.011)
Bolsista em curso privado -0.007 -0.012 -0.017*
(0.008) (0.008) (0.008)
Curso público (sem cota) 0.120*** 0.133*** -0.111***
(0.026) (0.025) (0.028)
Cotista em curso público 0.043 0.052 -0.189***
(0.032) (0.031) (0.033)
Noturno 0.083*** 0.048*** 0.080***
(0.012) (0.012) (0.012)
EaD 0.182*** 0.127** 0.169***
(0.045) (0.044) (0.042)
Química 0.270*** 0.255*** 0.216***
(0.025) (0.024) (0.024)
Tecnólogo em Informática 0.295*** 0.268*** 0.247***
(0.024) (0.024) (0.025)
Arquitetura e Urbanismo 0.428*** 0.417*** 0.350***
(0.028) (0.028) (0.028)
Física 0.186*** 0.198*** 0.149***
(0.040) (0.039) (0.038)
Tecnólogo Industrial 0.471*** 0.429*** 0.421***
(0.031) (0.030) (0.030)
Matemática 0.304*** 0.326*** 0.311***
(0.021) (0.021) (0.021)
Engenharia Florestal 0.297*** 0.309*** 0.319***
(0.055) (0.054) (0.051)
Engenharia Ambiental 0.491*** 0.476*** 0.414***
(0.034) (0.034) (0.032)
Computação 0.467*** 0.489*** 0.418***
(0.018) (0.018) (0.020)
Outras Engenharias 0.777*** 0.787*** 0.693***
(0.038) (0.037) (0.036)
Engenharia Civil 1.065*** 1.058*** 0.907***
(0.025) (0.025) (0.027)
Engenharia Química 0.724*** 0.756*** 0.639***
(0.031) (0.030) (0.030)
Engenharia de Produção 0.851*** 0.824*** 0.726***
(0.025) (0.024) (0.025)
Engenharia Mecânica 1.017*** 1.010*** 0.855***
(0.029) (0.029) (0.030)
Engenharia Elétrica 0.960*** 0.945*** 0.804***
(0.023) (0.023) (0.025)
Tempo de graduação -0.020*** -0.021***
(0.003) (0.003)
Atividade acadêmica -0.038*** -0.038***
(0.007) (0.007)
Horas de Estudo 0.002 0.001
(0.001) (0.001)
Estágio -0.026* -0.024*
(0.012) (0.012)
Trabalhava 0.189*** 0.193***
(0.009) (0.009)
Empenho no Enade 0.088*** 0.079***
(0.008) (0.008)
Perc. Docentes Doutorado 0.019
(0.011)
Conceito Enade 0.030***
(0.008)
Nota média Enem do Curso 0.143***
(0.010)
Nota média Enem da IES 0.040***
(0.012)
Intercepto 11.034*** 10.841*** 10.030*** 9.884*** 10.006***
(0.010) (0.012) (0.023) (0.028) (0.028)
Observations 40,439 40,439 40,439 40,439 40,439
Log Likelihood -45,396.710 -44,725.870 -38,848.830 -38,567.880 -38,397.040
Akaike Inf. Crit. 90,815.410 89,479.730 77,771.660 77,221.770 76,888.070
Note:
  • p<0.05; ** p<0.01; *** p<0.001
Fonte: Enade (2011), CES (2011-2012), Rais (2010-2018)

Tabela A4 – Resultados dos modelos de regressão para o logaritmo do rendimento mediano entre 2016 e 2018

stargazer(m161, m162, m163, m164, m165, 
          type="html",
          title = "Preditores do logaritmo do rendimento mediano entre 2016 e 2018 <br> para egressos dos cursos CTEM em 2011",
          out="Modelos_OIT_16_18.htm",
          column.labels = c("Origens<br>Sociais",
                            "Trajetória<br>Escolar<br>Pregressa",
                            "Tipo de<br>curso e<br>IES",
                            "Experiência<br>no curso",
                            "Indicadores<br>de Prestígio<br>e Qualidade"),
          df=T,
          dep.var.caption  = "",
          model.names = F,
          dep.var.labels.include = F,
          covariate.labels=c("Idade",
                             "Idade²",
                             "Homem Negro de 2ª geração",
                             "Homem Branco de 1ª geração", 
                             "Homem Negro de 1ª geração",
                             "Mulher Branca de 2ª geração",
                             "Mulher Negra de 2ª geração",
                             "Mulher Branca de 1ª geração",
                             "Mulher Negra de 1ª geração",
                             "Nº de pessoas no domicílio",
                             "EM Privado Regular",
                             "EM Privado Técnico",
                             "EM Público Técnico",
                             "Bolsista em curso privado",
                             "Curso público (sem cota)",
                             "Cotista em curso público",
                             "Noturno",
                             "EaD",
                             "Química",     
                             "Tecnólogo em Informática",
                             "Arquitetura e Urbanismo",
                             "Física",
                             "Tecnólogo Industrial",
                             "Matemática",
                             "Engenharia Florestal",
                             "Engenharia Ambiental",
                             "Computação",
                             "Outras Engenharias",
                             "Engenharia Civil",
                             "Engenharia Química",
                             "Engenharia de Produção",
                             "Engenharia Mecânica",
                             "Engenharia Elétrica",
                             "Tempo de graduação",
                             "Atividade acadêmica",
                             "Horas de Estudo",
                             "Estágio",
                             "Trabalhava",
                             "Empenho no Enade",
                             "Perc. Docentes Doutorado",
                             "Conceito Enade",
                             "Nota média Enem do Curso",
                             "Nota média Enem da IES",
                             "Intercepto"),
          font.size = "small",
          no.space = T,
          star.cutoffs = c(0.05, 0.01, 0.001),
          notes = c("* p<0.05; ** p<0.01; *** p<0.001", 
                    "Fonte: Enade (2011), CES (2011-2012), Rais (2010-2018)"), 
          omit.stat = c("bic"),
          notes.append = F,
          notes.align = "c",
          suppress.errors=T)
Preditores do logaritmo do rendimento mediano entre 2016 e 2018
para egressos dos cursos CTEM em 2011
Origens
Sociais
Trajetória
Escolar
Pregressa
Tipo de
curso e
IES
Experiência
no curso
Indicadores
de Prestígio
e Qualidade
(1) (2) (3) (4) (5)
Idade 0.020*** 0.017*** 0.005*** 0.007*** 0.007***
(0.001) (0.001) (0.001) (0.001) (0.001)
Idade² -0.001*** -0.002*** 0.0005** 0.0003* 0.0004*
(0.0002) (0.0002) (0.0002) (0.0002) (0.0002)
Homem Negro de 2ª geração -0.136*** -0.117*** -0.043* -0.044** -0.038*
(0.019) (0.018) (0.017) (0.017) (0.017)
Homem Branco de 1ª geração -0.170*** -0.084*** 0.010 0.002 0.009
(0.012) (0.012) (0.011) (0.011) (0.011)
Homem Negro de 1ª geração -0.295*** -0.197*** -0.048*** -0.054*** -0.042**
(0.014) (0.014) (0.013) (0.013) (0.013)
Mulher Branca de 2ª geração -0.363*** -0.357*** -0.203*** -0.200*** -0.199***
(0.015) (0.015) (0.014) (0.014) (0.014)
Mulher Negra de 2ª geração -0.522*** -0.488*** -0.251*** -0.243*** -0.229***
(0.026) (0.026) (0.024) (0.024) (0.024)
Mulher Branca de 1ª geração -0.666*** -0.556*** -0.271*** -0.271*** -0.264***
(0.013) (0.014) (0.013) (0.013) (0.013)
Mulher Negra de 1ª geração -0.750*** -0.630*** -0.316*** -0.315*** -0.297***
(0.016) (0.017) (0.016) (0.016) (0.016)
Nº de pessoas no domicílio -0.032*** -0.028*** -0.014*** -0.013*** -0.012***
(0.002) (0.002) (0.002) (0.002) (0.002)
EM Privado Regular 0.241*** 0.044*** 0.053*** 0.038***
(0.009) (0.010) (0.010) (0.010)
EM Privado Técnico 0.294*** 0.121*** 0.127*** 0.117***
(0.017) (0.016) (0.016) (0.016)
EM Público Técnico 0.360*** 0.171*** 0.166*** 0.159***
(0.014) (0.013) (0.013) (0.013)
Bolsista em curso privado 0.002 -0.006 -0.011
(0.009) (0.009) (0.009)
Curso público (sem cota) 0.238*** 0.238*** -0.020
(0.025) (0.025) (0.027)
Cotista em curso público 0.187*** 0.178*** -0.075*
(0.032) (0.031) (0.033)
Noturno 0.036** 0.019 0.052***
(0.012) (0.012) (0.012)
EaD 0.150*** 0.111** 0.141***
(0.043) (0.042) (0.040)
Química 0.238*** 0.223*** 0.195***
(0.024) (0.024) (0.023)
Tecnólogo em Informática 0.235*** 0.213*** 0.218***
(0.024) (0.024) (0.024)
Arquitetura e Urbanismo 0.295*** 0.265*** 0.236***
(0.027) (0.027) (0.028)
Física 0.264*** 0.275*** 0.239***
(0.040) (0.040) (0.039)
Tecnólogo Industrial 0.285*** 0.250*** 0.265***
(0.030) (0.030) (0.029)
Matemática 0.253*** 0.281*** 0.285***
(0.021) (0.021) (0.021)
Engenharia Florestal 0.308*** 0.313*** 0.329***
(0.053) (0.053) (0.051)
Engenharia Ambiental 0.460*** 0.443*** 0.401***
(0.033) (0.033) (0.032)
Computação 0.443*** 0.473*** 0.431***
(0.018) (0.018) (0.019)
Outras Engenharias 0.631*** 0.636*** 0.565***
(0.037) (0.037) (0.036)
Engenharia Civil 0.702*** 0.691*** 0.584***
(0.024) (0.024) (0.026)
Engenharia Química 0.637*** 0.659*** 0.570***
(0.030) (0.029) (0.029)
Engenharia de Produção 0.696*** 0.671*** 0.603***
(0.024) (0.024) (0.024)
Engenharia Mecânica 0.782*** 0.772*** 0.661***
(0.028) (0.027) (0.029)
Engenharia Elétrica 0.818*** 0.797*** 0.695***
(0.023) (0.023) (0.024)
Tempo de graduação -0.036*** -0.037***
(0.003) (0.003)
Atividade acadêmica -0.022** -0.022**
(0.008) (0.008)
Horas de Estudo 0.008*** 0.008***
(0.001) (0.001)
Estágio -0.040** -0.038**
(0.013) (0.013)
Trabalhava 0.110*** 0.115***
(0.010) (0.010)
Empenho no Enade 0.095*** 0.083***
(0.008) (0.008)
Perc. Docentes Doutorado 0.044***
(0.010)
Conceito Enade 0.038***
(0.008)
Nota média Enem do Curso 0.115***
(0.010)
Nota média Enem da IES 0.049***
(0.011)
Intercepto 11.235*** 11.034*** 10.336*** 10.219*** 10.317***
(0.011) (0.012) (0.024) (0.029) (0.029)
Observations 40,439 40,439 40,439 40,439 40,439
Log Likelihood -46,889.870 -46,292.070 -42,686.340 -42,470.730 -42,302.920
Akaike Inf. Crit. 93,801.740 92,612.150 85,446.680 85,027.460 84,699.840
Note:
  • p<0.05; ** p<0.01; *** p<0.001
Fonte: Enade (2011), CES (2011-2012), Rais (2010-2018)