library(tidyverse)
library(targets)
library(brms)
library(broom)
library(tidybayes)
library(sf)
library(scico)
library(colorspace)
library(scales)
library(patchwork)
library(ggtext)
library(here)

CHAINS <- 4
ITER <- 2000
WARMUP <- 1000
BAYES_SEED <- 1234
options(mc.cores = parallel::detectCores())  # Use all cores

# Generated via random.org
set.seed(9936)

# Load data
# Need to use this withr thing because tar_read() and tar_load() need to see the
# _targets folder in the current directory, but this .Rmd file is in a subfolder
withr::with_dir(here::here(), {
  source(tar_read(plot_funs))
  
  canary <- tar_read(panel)
  tar_load(world_map)
})

Civil society restrictions over time

things_to_map <- canary %>% 
  filter(year %in% c(1993, 2013)) %>% 
  select(country, year, iso3, barriers_total, PTS_factor, v2csreprss) %>% 
  pivot_wider(names_from = year, values_from = c(barriers_total, PTS_factor, v2csreprss)) %>% 
  mutate(new_laws = barriers_total_2013 - barriers_total_1993,
         new_laws = ifelse(new_laws <= 0, 0, new_laws),
         new_laws = ceiling(new_laws),
         new_laws_cat = ifelse(new_laws >= 5, "5+", as.character(new_laws))) %>% 
  mutate(diff_csrepress = v2csreprss_2013 - v2csreprss_1993,
         diff_csrepress_trunc = case_when(
           diff_csrepress >= 2 ~ 2,
           diff_csrepress <= -2 ~ -2,
           TRUE ~ diff_csrepress
         )) %>% 
  mutate(pct_change_csrepress = diff_csrepress / v2csreprss_1993,
         pct_change_csrepress_trunc = case_when(
           pct_change_csrepress >= 5 ~ 5,
           pct_change_csrepress <= -5 ~ -5,
           TRUE ~ pct_change_csrepress
         ))

map_data <- world_map %>% 
  left_join(things_to_map, by = c("ADM0_A3_IS" = "iso3"))

Legislation

map_ngo_laws <- ggplot() +
  geom_sf(data = map_data, aes(fill = factor(new_laws_cat)),
          color = "black", size = 0.1) +
  coord_sf(crs = st_crs("ESRI:54030"), datum = NA) +  # Robinson
  scale_fill_manual(values = seq_gradient_pal("#FFFFFF", "#CF4446")(seq(0, 1, length.out = 6)),
                    na.value = "grey95", breaks = c(as.character(0:4), "5+")) +
  # scale_fill_manual(values = scico(7, palette = "devon", direction = -1),
  #                   na.value = "grey80", breaks = 0:6) +
  guides(fill = guide_legend(nrow = 1, label.position = "bottom",
                             keywidth = unit(1, units = "lines"),
                             keyheight = unit(0.6, units = "lines"))) +
  labs(fill = "Restrictive NGO laws passed between 1993 and 2013") +
  theme_ngo() +
  theme(panel.border = element_blank(),
        legend.box.margin = margin(t = 5),
        legend.spacing.x = unit(0, "pt"),
        legend.title = element_textbox_simple(halign = 1,
                                              lineheight = 1.3,
                                              minwidth = unit(2, "lines"),
                                              maxwidth = unit(10, "lines"),
                                              padding = margin(r = 10)))
map_ngo_laws

Civil society repression

map_cs_repression <- ggplot() +
  geom_sf(data = map_data, aes(fill = diff_csrepress_trunc),
          color = "black", size = 0.1) +
  coord_sf(crs = st_crs("ESRI:54030"), datum = NA) +  # Robinson
  scale_fill_scico(palette = "vik", direction = -1,
                   limits = c(-1, 1) * max(abs(map_data$diff_csrepress_trunc), na.rm = TRUE),
                   breaks = seq(-4, 4, 1), na.value = "grey80") +
  guides(fill = guide_colorbar(reverse = FALSE, ticks = FALSE,
                               barwidth = unit(7, units = "lines"),
                               barheight = unit(0.5, units = "lines"))) +
  labs(fill = "Change in V-Dem civil society repression between 1990 and 2013") +
  theme_ngo() +
  theme(panel.border = element_blank(),
        legend.box.margin = margin(t = 5),
        legend.title = element_textbox_simple(halign = 1,
                                              lineheight = 1.3,
                                              minwidth = unit(2, "lines"),
                                              maxwidth = unit(12, "lines"),
                                              padding = margin(r = 10)))
map_cs_repression

PTS and civil society restrictions

V-Dem civil society repression and the PTS

diff_cs_pts <- brm(
  bf(v2csreprss ~ 0 + PTS_factor, sigma ~ 0 + PTS_factor),
  family = student,
  data = filter(canary, year == 2010) %>% select(v2csreprss, PTS_factor),
  prior = c(
    # Set group mean prior
    set_prior("normal(0, 1)", class = "b", lb = -4, ub = 4),
    # Set group variance priors. We keep the less informative cauchy(0, 1).
    set_prior("cauchy(0, 1)", class = "b", dpar = "sigma"),
    set_prior("exponential(1.0/29)", class = "nu")
  ),
  chains = CHAINS, iter = ITER, warmup = WARMUP, seed = BAYES_SEED,
  file = here("analysis", "cache", "diff_cs_pts")
)
diff_cs_pts_summary <- diff_cs_pts %>%
  gather_draws(`b_PTS.*`, regex = TRUE) %>% 
  median_hdci(.width = 0.95) %>% 
  to_broom_names()

diff_cs_pts_draws <- diff_cs_pts %>% 
  gather_draws(`b_PTS.*`, regex = TRUE) %>% 
  ungroup() %>% 
  mutate(.variable = str_replace(.variable, "b_PTS_factorLevel", "Level ")) %>% 
  mutate(pts_level = fct_rev(.variable))

diff_cs_pts_posterior <- canary %>% 
  filter(year == 2010) %>% 
  modelr::data_grid(PTS_factor) %>% 
  add_predicted_draws(diff_cs_pts, seed = BAYES_SEED)
ggplot(diff_cs_pts_draws, aes(y = pts_level, x = .value, fill = pts_level)) + 
  stat_halfeye() +
  scale_x_reverse() +
  scale_fill_viridis_d(option = "inferno", begin = 0.2, end = 0.9, guide = FALSE) +
  labs(x = "Civil society repression", y = "Political Terror Scale (PTS)") +
  theme_ngo()

ggplot(diff_cs_pts_posterior, aes(x = .prediction, y = fct_rev(PTS_factor), color = fct_rev(PTS_factor))) +
  stat_dots(quantiles = 100, shape = 19) +
  stat_pointinterval(aes(point_colour = after_scale(colorspace::darken(color, 0.65)),
                         interval_colour = after_scale(colorspace::darken(color, 0.35)))) +
  scale_x_reverse() +
  scale_color_viridis_d(option = "inferno", begin = 0.2, end = 0.9, guide = FALSE) +
  labs(x = "Civil society repression", y = "Political Terror Scale (PTS)",
       caption = "Each • represents an equally likely outcome from the posterior distribution") +
  theme_ngo()

Chaudhry NGO regulations and V-Dem’s v2csreprss

canary_barriers <- canary %>% 
  pivot_longer(cols = c(advocacy, entry, funding, barriers_total), 
               names_to = "barrier", values_to = "count") %>% 
  mutate(barrier = recode(barrier, advocacy = "Barriers to advocacy",
                          entry = "Barriers to entry", 
                          funding = "Barriers to funding",
                          barriers_total = "Total NGO barriers"))

ggplot(canary_barriers, aes(x = count, y = v2csreprss)) +
  geom_point(alpha = 0.2) +
  geom_smooth(method = "lm") +
  labs(x = "Number of restrictive NGO laws", 
       y = "V-Dem's civil society repression score") +
  facet_wrap(vars(barrier), scales = "free_x") +
  theme_ngo()

Chaudhry NGO regulations and the PTS

diff_ngo_pts <- brm(
  bf(barriers_total ~ 0 + PTS_factor, sigma ~ 0 + PTS_factor),
  family = student,
  data = select(canary, barriers_total, PTS_factor),
  prior = c(
    # Set group mean prior
    set_prior("normal(0, 1)", class = "b", lb = -4, ub = 4),
    # Set group variance priors. We keep the less informative cauchy(0, 1).
    set_prior("cauchy(0, 1)", class = "b", dpar = "sigma"),
    set_prior("exponential(1.0/29)", class = "nu")
  ),
  chains = CHAINS, iter = ITER, warmup = WARMUP, seed = BAYES_SEED,
  file = here("analysis", "cache", "diff_ngo_pts")
)
diff_ngo_pts_summary <- diff_ngo_pts %>%
  gather_draws(`b_PTS.*`, regex = TRUE) %>% 
  median_hdci(.width = 0.95) %>% 
  to_broom_names()

diff_ngo_pts_draws <- diff_ngo_pts %>% 
  gather_draws(`b_PTS.*`, regex = TRUE) %>% 
  ungroup() %>% 
  mutate(.variable = str_replace(.variable, "b_PTS_factorLevel", "Level ")) %>% 
  mutate(pts_level = fct_rev(.variable))

diff_ngo_pts_posterior <- canary %>% 
  filter(year == 2010) %>% 
  modelr::data_grid(PTS_factor) %>% 
  add_predicted_draws(diff_ngo_pts, seed = BAYES_SEED)
ggplot(diff_ngo_pts_draws, aes(y = pts_level, x = .value, fill = pts_level)) + 
  stat_halfeye() +
  scale_fill_viridis_d(option = "inferno", begin = 0.2, end = 0.9, guide = FALSE) +
  labs(x = "Number of restrictive NGO laws", y = "Political Terror Scale (PTS)") +
  theme_ngo()

ggplot(diff_ngo_pts_posterior, aes(x = .prediction, y = fct_rev(PTS_factor), color = fct_rev(PTS_factor))) +
  stat_dots(quantiles = 100, shape = 19) +
  stat_pointinterval(aes(point_colour = after_scale(colorspace::darken(color, 0.65)),
                         interval_colour = after_scale(colorspace::darken(color, 0.35)))) +
  scale_color_viridis_d(option = "inferno", begin = 0.2, end = 0.9, guide = FALSE) +
  labs(x = "Number of restrictive NGO laws", y = "Political Terror Scale (PTS)",
       caption = "Each • represents an equally likely outcome from the posterior distribution") +
  theme_ngo()

Conflict and civil society restrictions

diff_cs_conflict <- brm(
  bf(v2csreprss ~ 0 + armed_conflict, sigma ~ 0 + armed_conflict),
  family = student,
  data = select(canary, v2csreprss, armed_conflict),
  prior = c(
    # Set group mean prior
    set_prior("normal(0, 1)", class = "b", lb = -4, ub = 4),
    # Set group variance priors. We keep the less informative cauchy(0, 1).
    set_prior("cauchy(0, 1)", class = "b", dpar = "sigma"),
    set_prior("exponential(1.0/29)", class = "nu")
  ),
  chains = CHAINS, iter = ITER, warmup = WARMUP, seed = BAYES_SEED,
  file = here("analysis", "cache", "diff_cs_conflict")
)
diff_cs_conflict_summary <- diff_cs_conflict %>%
  gather_draws(`b_armed.*`, regex = TRUE) %>% 
  median_hdci(.width = 0.95) %>% 
  to_broom_names()

diff_cs_conflict_draws <- diff_cs_conflict %>% 
  gather_draws(`b_armed.*`, regex = TRUE) %>% 
  ungroup() %>% 
  mutate(.variable = recode(.variable, `b_armed_conflictFALSE` = "No armed conflict",
                            `b_armed_conflictTRUE` = "Armed conflict"))

diff_cs_conflict_posterior <- canary %>% 
  filter(year == 2010) %>% 
  modelr::data_grid(armed_conflict) %>% 
  add_predicted_draws(diff_cs_conflict, seed = BAYES_SEED) %>% 
  ungroup() %>% 
  mutate(armed_conflict = factor(armed_conflict, labels = c("No armed conflict", "Armed conflict")))
ggplot(diff_cs_conflict_draws, aes(y = .variable, x = .value, fill = .variable)) + 
  stat_halfeye() +
  scale_x_reverse() +
  scale_fill_viridis_d(option = "inferno", begin = 0.2, end = 0.9, guide = FALSE) +
  labs(x = "Civil society repression", y = "Armed conflict") +
  theme_ngo()

ggplot(diff_cs_conflict_posterior, aes(x = .prediction, y = fct_rev(armed_conflict), color = fct_rev(armed_conflict))) +
  stat_dots(quantiles = 100, shape = 19) +
  stat_pointinterval(aes(point_colour = after_scale(colorspace::darken(color, 0.65)),
                         interval_colour = after_scale(colorspace::darken(color, 0.35)))) +
  scale_x_reverse() +
  scale_color_viridis_d(option = "inferno", begin = 0.2, end = 0.9, guide = FALSE) +
  labs(x = "Civil society repression", y = "Armed conflict",
       caption = "Each • represents an equally likely outcome from the posterior distribution") +
  theme_ngo()

LS0tCnRpdGxlOiAiRGVzY3JpcHRpdmUgYW5hbHlzaXMiCmF1dGhvcjogIlN1cGFybmEgQ2hhdWRocnkgYW5kIEFuZHJldyBIZWlzcyIKZGF0ZTogIkxhc3QgcnVuOiBgciBmb3JtYXQoU3lzLnRpbWUoKSwgJyVGJylgIgpvdXRwdXQ6IAogIGh0bWxfZG9jdW1lbnQ6CiAgICBjb2RlX2ZvbGRpbmc6IGhpZGUKZWRpdG9yX29wdGlvbnM6IAogIGNodW5rX291dHB1dF90eXBlOiBjb25zb2xlCi0tLQoKYGBge3Igc2V0dXAsIGluY2x1ZGU9RkFMU0V9CmxpYnJhcnkoa25pdHIpCmxpYnJhcnkoa2FibGVFeHRyYSkKa25pdF9wcmludC5kYXRhLmZyYW1lIDwtIGZ1bmN0aW9uKHgsIC4uLikgewogIHJlcyA8LSBwYXN0ZShjKCcnLCAnJywga2FibGVfc3R5bGluZyhrYWJsZSh4LCBib29rdGFicyA9IFRSVUUpKSksIGNvbGxhcHNlID0gJ1xuJykKICBhc2lzX291dHB1dChyZXMpCn0KCnJlZ2lzdGVyUzNtZXRob2QoImtuaXRfcHJpbnQiLCAiZGF0YS5mcmFtZSIsIGtuaXRfcHJpbnQuZGF0YS5mcmFtZSkKcmVnaXN0ZXJTM21ldGhvZCgia25pdF9wcmludCIsICJncm91cGVkX2RmIiwga25pdF9wcmludC5kYXRhLmZyYW1lKQoKa25pdHI6Om9wdHNfY2h1bmskc2V0KGZpZy5yZXRpbmEgPSAzLAogICAgICAgICAgICAgICAgICAgICAgdGlkeS5vcHRzID0gbG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udmFsdWUgPSAiZ3JleTk1IiwgYnJlYWtzID0gYyhhcy5jaGFyYWN0ZXIoMDo0KSwgIjUrIikpICsKICAjIHNjYWxlX2ZpbGxfbWFudWFsKHZhbHVlcyA9IHNjaWNvKDcsIHBhbGV0dGUgPSAiZGV2b24iLCBkaXJlY3Rpb24gPSAtMSksCiAgIyAgICAgICAgICAgICAgICAgICBuYS52YWx1ZSA9ICJncmV5ODAiLCBicmVha3MgPSAwOjYpICsKICBndWlkZXMoZmlsbCA9IGd1aWRlX2xlZ2VuZChucm93ID0gMSwgbGFiZWwucG9zaXRpb24gPSAiYm90dG9tIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXl3aWR0aCA9IHVuaXQoMSwgdW5pdHMgPSAibGluZXMiKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXloZWlnaHQgPSB1bml0KDAuNiwgdW5pdHMgPSAibGluZXMiKSkpICsKICBsYWJzKGZpbGwgPSAiUmVzdHJpY3RpdmUgTkdPIGxhd3MgcGFzc2VkIGJldHdlZW4gMTk5MyBhbmQgMjAxMyIpICsKICB0aGVtZV9uZ28oKSArCiAgdGhlbWUocGFuZWwuYm9yZGVyID0gZWxlbWVudF9ibGFuaygpLAogICAgICAgIGxlZ2VuZC5ib3gubWFyZ2luID0gbWFyZ2luKHQgPSA1KSwKICAgICAgICBsZWdlbmQuc3BhY2luZy54ID0gdW5pdCgwLCAicHQiKSwKICAgICAgICBsZWdlbmQudGl0bGUgPSBlbGVtZW50X3RleHRib3hfc2ltcGxlKGhhbGlnbiA9IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5laGVpZ2h0ID0gMS4zLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlud2lkdGggPSB1bml0KDIsICJsaW5lcyIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4d2lkdGggPSB1bml0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MTk5MCBhbmQgMjAxMyIpICsKICB0aGVtZV9uZ28oKSArCiAgdGhlbWUocGFuZWwuYm9yZGVyID0gZWxlbWVudF9ibGFuaygpLAogICAgICAgIGxlZ2VuZC5ib3gubWFyZ2luID0gbWFyZ2luKHQgPSA1KSwKICAgICAgICBsZWdlbmQudGl0bGUgPSBlbGVtZW50X3RleHRib3hfc2ltcGxlKGhhbGlnbiA9IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5laGVpZ2h0ID0gMS4zLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlud2lkdGggPSB1bml0KDIsICJsaW5lcyIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4d2lkdGggPSB1bml0KDEyLCAibGluZXMiKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZGRpbmcgPSBtYXJnaW4ociA9IDEwKSkpCm1hcF9jc19yZXByZXNzaW9uCmBgYAoKCiMgUFRTIGFuZCBjaXZpbCBzb2NpZXR5IHJlc3RyaWN0aW9ucwoKIyMgVi1EZW0gY2l2aWwgc29jaWV0eSByZXByZXNzaW9uIGFuZCB0aGUgUFRTCgpgYGB7ciBtb2RlbC1wdHMtY3MsIG1lc3NhZ2U9RkFMU0UsIHJlc3VsdHM9ImhpZGUifQpkaWZmX2NzX3B0cyA8LSBicm0oCiAgYmYodjJjc3JlcHJzcyB+IDAgKyBQVFNfZmFjdG9yLCBzaWdtYSB+IDAgKyBQVFNfZmFjdG9yKSwKICBmYW1pbHkgPSBzdHVkZW50LAogIGRhdGEgPSBmaWx0ZXIoY2FuYXJ5LCB5ZWFyID09IDIwMTApICU+JSBzZWxlY3QodjJjc3JlcHJzcywgUFRTX2ZhY3RvciksCiAgcHJpb3IgPSBjKAogICAgIyBTZXQgZ3JvdXAgbWVhbiBwcmlvcgogICAgc2V0X3ByaW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