Introdução

Este relatório analisa fluxos internacionais de resíduos perigosos enviados para Ghana e Nigeria, investigando padrões de envio, países exportadores dominantes e tendências anuais em peso e valor financeiro.

A análise utiliza dados extraídos da plataforma UN Comtrade e segue as hipóteses de pesquisa:


1. Carregar pacotes

library(readr)
## Warning: pacote 'readr' foi compilado no R versão 4.5.2
library(readxl)
## Warning: pacote 'readxl' foi compilado no R versão 4.5.2
library(dplyr)
## Warning: pacote 'dplyr' foi compilado no R versão 4.5.2
## 
## Anexando pacote: 'dplyr'
## Os seguintes objetos são mascarados por 'package:stats':
## 
##     filter, lag
## Os seguintes objetos são mascarados por 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
## Warning: pacote 'ggplot2' foi compilado no R versão 4.5.2
library(stringr)
## Warning: pacote 'stringr' foi compilado no R versão 4.5.2

2. Importação da base

df <- read_excel("GREGOIRE NECROPOLITICA.xlsx")
cat("Colunas detectadas:\n")
## Colunas detectadas:
print(names(df))
##  [1] "Period"             "Reporter"           "Partner"           
##  [4] "Commodity Code"     "Trade Value (US)"   "Net Weight (kg)"   
##  [7] "Gross Weight"       "Qty"                "Qty Unit"          
## [10] "Alternate Quantity" "Alt Qty Unit"

3. Padronização dos nomes das colunas

df <- df %>% 
  rename_with(~ str_to_lower(.x)) %>%
  rename_with(~ str_replace_all(.x, " ", "_"))

col_year    <- grep("year|period", names(df), value = TRUE)[1]
col_partner <- grep("partner|destination|country", names(df), value = TRUE)[1]
col_weight  <- grep("weight|kg|tons|net", names(df), value = TRUE)[1]
col_value   <- grep("value|usd|dollar", names(df), value = TRUE)[1]

cat("\nVariáveis detectadas:\n")
## 
## Variáveis detectadas:
cat("Ano:", col_year, "\n")
## Ano: period
cat("País:", col_partner, "\n")
## País: partner
cat("Peso:", col_weight, "\n")
## Peso: net_weight_(kg)
cat("Valor:", col_value, "\n")
## Valor: trade_value_(us)

4. Conversão das colunas numéricas

df <- df %>%
  mutate(
    !!col_weight := as.numeric(gsub(",", "", .data[[col_weight]])),
    !!col_value  := as.numeric(gsub(",", "", .data[[col_value]])),
    !!col_year   := as.numeric(.data[[col_year]])
  )

5. Classificação dos países por continente

df <- df %>%
  mutate(
    continente = case_when(
      reporter %in% c("Austria","Belgium","Czechia","Denmark","France","Germany","Hungary",
                      "Netherlands","Norway","Poland","Romania","Russian Federation",
                      "Sweden","United Kingdom","Türkiye") ~ "Europe",
      reporter %in% c("USA","Canada") ~ "America",
      reporter %in% c("China","India","Rep. of Korea","Singapore","United Arab Emirates") ~ "Asia",
      reporter %in% c("Australia") ~ "Oceania",
      reporter %in% c("Benin","Cameroon","Congo","Côte d'Ivoire","Ghana","Kenya","Namibia",
                      "Nigeria","Senegal","South Africa","Uganda","United Rep. of Tanzania") ~ "Africa",
      TRUE ~ "Other"
    )
  )

6. Filtrar apenas Ghana e Nigeria

df_africa <- df %>%
  filter(.data[[col_partner]] %in% c("Ghana", "Nigeria"))

if (nrow(df_africa) == 0) stop("Nenhum dado encontrado para Ghana e Nigeria.")

7. Continente que mais envia resíduos

resultado <- df_africa %>%
  group_by(continente, .data[[col_partner]]) %>%
  summarise(total_peso = sum(.data[[col_weight]], na.rm = TRUE)) %>%
  arrange(.data[[col_partner]], desc(total_peso))
## `summarise()` has grouped output by 'continente'. You can override using the
## `.groups` argument.
resultado
## # A tibble: 10 × 3
## # Groups:   continente [5]
##    continente partner total_peso
##    <chr>      <chr>        <dbl>
##  1 Africa     Ghana      16384. 
##  2 Europe     Ghana       1752. 
##  3 Oceania    Ghana          2.8
##  4 America    Ghana          0  
##  5 Asia       Ghana          0  
##  6 Africa     Nigeria    36306. 
##  7 Europe     Nigeria     3731. 
##  8 Asia       Nigeria     2283. 
##  9 America    Nigeria      668. 
## 10 Oceania    Nigeria       50

Gráfico

ggplot(resultado, aes(x = continente, y = total_peso, fill = continente)) +
  geom_bar(stat = "identity") +
  facet_wrap(~ .data[[col_partner]]) +
  theme_minimal() +
  labs(
    title = "Continentes que mais enviam resíduos radioativos",
    subtitle = "Destinos: Ghana e Nigeria",
    x = "Continente",
    y = "Peso total enviado (kg)"
  )

8. Hipótese H1 — Comparação entre Ghana e Nigeria

t.test(df_africa[[col_weight]] ~ df_africa[[col_partner]])
## 
##  Welch Two Sample t-test
## 
## data:  df_africa[[col_weight]] by df_africa[[col_partner]]
## t = -0.89638, df = 157.73, p-value = 0.3714
## alternative hypothesis: true difference in means between group Ghana and group Nigeria is not equal to 0
## 95 percent confidence interval:
##  -583.2227  219.0991
## sample estimates:
##   mean in group Ghana mean in group Nigeria 
##              188.9518              371.0135

9. Hipótese H3 — Regressão e tendência temporal

modelos <- df_africa %>%
  group_by(.data[[col_partner]]) %>%
  do(modelo = summary(lm(.data[[col_weight]] ~ .data[[col_year]], data = .)))

modelos
## # A tibble: 2 × 2
## # Rowwise: 
##   partner modelo    
##   <chr>   <list>    
## 1 Ghana   <smmry.lm>
## 2 Nigeria <smmry.lm>

10. Evolução do peso por ano

peso_por_ano <- df %>%
  group_by(partner, period) %>%
  summarise(total_peso = sum(`net_weight_(kg)`, na.rm = TRUE)) %>%
  arrange(partner, period)
## `summarise()` has grouped output by 'partner'. You can override using the
## `.groups` argument.
peso_por_ano
## # A tibble: 24 × 3
## # Groups:   partner [2]
##    partner period total_peso
##    <chr>    <dbl>      <dbl>
##  1 Ghana     2013      240. 
##  2 Ghana     2014      341. 
##  3 Ghana     2015     1852. 
##  4 Ghana     2016      224. 
##  5 Ghana     2017      230  
##  6 Ghana     2018      729. 
##  7 Ghana     2019     6044. 
##  8 Ghana     2020     5925. 
##  9 Ghana     2021       21.7
## 10 Ghana     2022     2041. 
## # ℹ 14 more rows

Gráfico

ggplot(peso_por_ano, aes(x = period, y = total_peso, color = partner)) +
  geom_line(size = 1.2) +
  geom_point() +
  labs(
    title = "Evolução do peso de resíduos radioativos enviados",
    y = "Peso total (kg)",
    x = "Ano"
  ) +
  theme_minimal()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

11. Principais exportadores

exportadores <- df_africa %>%
  group_by(partner, reporter) %>%
  summarise(
    peso_total = sum(`net_weight_(kg)`, na.rm = TRUE),
    valor_total = sum(`trade_value_(us)`, na.rm = TRUE)
  ) %>%
  arrange(partner, desc(peso_total))
## `summarise()` has grouped output by 'partner'. You can override using the
## `.groups` argument.
exportadores
## # A tibble: 54 × 4
## # Groups:   partner [2]
##    partner reporter                peso_total valor_total
##    <chr>   <chr>                        <dbl>       <dbl>
##  1 Ghana   United Rep. of Tanzania     11215.       94482
##  2 Ghana   South Africa                 2426.      545557
##  3 Ghana   Cameroon                     1046        11636
##  4 Ghana   Côte d'Ivoire                 928.       50114
##  5 Ghana   Congo                         759.      139966
##  6 Ghana   United Kingdom                756        30751
##  7 Ghana   Belgium                       435       820548
##  8 Ghana   Türkiye                       253       173661
##  9 Ghana   Czechia                       147.       85810
## 10 Ghana   Norway                         78        26666
## # ℹ 44 more rows

Top 5 exportadores

exportadores_top5 <- exportadores %>%
  group_by(partner) %>%
  slice_max(peso_total, n = 5)

exportadores_top5
## # A tibble: 10 × 4
## # Groups:   partner [2]
##    partner reporter                peso_total valor_total
##    <chr>   <chr>                        <dbl>       <dbl>
##  1 Ghana   United Rep. of Tanzania     11215.       94482
##  2 Ghana   South Africa                 2426.      545557
##  3 Ghana   Cameroon                     1046        11636
##  4 Ghana   Côte d'Ivoire                 928.       50114
##  5 Ghana   Congo                         759.      139966
##  6 Nigeria Ghana                       21082.      180212
##  7 Nigeria South Africa                14584.     3624995
##  8 Nigeria Singapore                    2249.       29104
##  9 Nigeria Netherlands                  1522.      337833
## 10 Nigeria France                       1161       225126

12. Evolução do valor enviado

valor_por_ano <- df_africa %>%
  group_by(partner, period) %>%
  summarise(total_valor = sum(`trade_value_(us)`, na.rm = TRUE)) %>%
  arrange(partner, period)
## `summarise()` has grouped output by 'partner'. You can override using the
## `.groups` argument.
valor_por_ano
## # A tibble: 24 × 3
## # Groups:   partner [2]
##    partner period total_valor
##    <chr>    <dbl>       <dbl>
##  1 Ghana     2013      896760
##  2 Ghana     2014      488512
##  3 Ghana     2015      676722
##  4 Ghana     2016      184136
##  5 Ghana     2017      131228
##  6 Ghana     2018      393597
##  7 Ghana     2019      142580
##  8 Ghana     2020      186189
##  9 Ghana     2021      265845
## 10 Ghana     2022      192205
## # ℹ 14 more rows

Gráfico

ggplot(valor_por_ano, aes(x = period, y = total_valor, color = partner)) +
  geom_line(size = 1.2) +
  geom_point() +
  labs(
    title = "Evolução do valor gasto para enviar resíduos radioativos",
    y = "Trade Value (US$)",
    x = "Ano"
  ) +
  theme_minimal()

13. Hipótese H2 — Valor cresce ao longo do tempo

for(i in 1:nrow(modelos)){
  cat("\n====", modelos$partner[i], "====\n")
  print(modelos$modelo[[i]])
}
## 
## ==== Ghana ====
## 
## Call:
## lm(formula = .data[["net_weight_(kg)"]] ~ .data[["period"]], 
##     data = .)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -261.4 -206.8 -147.7 -112.3 5409.5 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)
## (Intercept)       -25321.52   47536.65  -0.533    0.596
## .data[["period"]]     12.64      23.55   0.537    0.593
## 
## Residual standard error: 813.5 on 94 degrees of freedom
## Multiple R-squared:  0.003054,   Adjusted R-squared:  -0.007551 
## F-statistic: 0.288 on 1 and 94 DF,  p-value: 0.5928
## 
## 
## ==== Nigeria ====
## 
## Call:
## lm(formula = .data[["net_weight_(kg)"]] ~ .data[["period"]], 
##     data = .)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
##  -663.9  -441.0  -300.6  -143.5 20538.3 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)
## (Intercept)       111327.85  115603.82   0.963    0.338
## .data[["period"]]    -54.97      57.28  -0.960    0.339
## 
## Residual standard error: 1999 on 114 degrees of freedom
## Multiple R-squared:  0.008016,   Adjusted R-squared:  -0.0006855 
## F-statistic: 0.9212 on 1 and 114 DF,  p-value: 0.3392

Conclusões


Fim do Relatório.