library(tidyverse)
library(targets)
library(scales)
library(ggbeeswarm)
library(patchwork)
library(here)

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

matrix_from_vector <- function(x, ncol) {
  n_balanced <- ceiling(length(x) / ncol) * ncol
  matrix(c(x, rep(NA, n_balanced - length(x))), ncol = ncol)
}

# 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))
  
  tar_load(pandem_clean)
  tar_load(pandem_single)
  tar_load(derogations_clean)
  tar_load(vdem_clean)
  tar_load(pandem_derog)
})

V-Dem pandemic emergency declarations

A majority of countries made some sort of official public health response to the pandemic, and most used legal avenues for their responses: 80% of countries used legal instruments to declare public emergencies at some point during 2020, while 16% used extralegal avenues. Only a handful had no official national emergency response throughout 2020: Canada, China, Germany, Nicaragua, and North Korea.

pandem_single %>% 
  count(emlaw_cond_min) %>% 
  mutate(prop = n / sum(n))
emlaw_cond_min n prop
Emergency response with legal instruments 116 0.8055556
Emergency response without legal instruments 23 0.1597222
No emergency response 5 0.0347222
pandem_single %>% 
  count(emlaw_fct_min) %>% 
  mutate(prop = n / sum(n))
emlaw_fct_min n prop
Declaration in existing legal framework 49 0.3402778
Declaration in existing legal framework, distinguishes public health emergency 15 0.1041667
Declaration of disaster where different from emergency 8 0.0555556
Declaration using other legislation 44 0.3055556
Emergency response without legal instruments 23 0.1597222
No emergency response 5 0.0347222
pandem_single %>% 
  filter(emlaw_cond_min == "No emergency response") %>% 
  select(country_name, emlaw_cond)
country_name emlaw_cond
Canada No emergency response
China No emergency response
Germany No emergency response
Nicaragua No emergency response
North Korea No emergency response

There are distinct patterns that help determine which kind of response a country made. There is a uniform distribution of adherence to democratic values within countries that used legal methods for declaring emergencies. For instance, both Denmark and Tajikistan used legal instruments to declare their respective emergencies. However, among countries that declared emergencies without any legal instruments, there are no countries that score above 0.5 on V-Dem’s liberal democracy index.

This is also true when looking at regime type specifically. Only one democracy—Sri Lanka—declared an emergency extralegally.

pandem_single %>% 
  group_by(emlaw_cond_min) %>% 
  arrange(v2x_libdem) %>% 
  slice(c(1, 2, n() - 1, n())) %>% 
  select(country_name, emlaw_cond_min, v2x_libdem)
country_name emlaw_cond_min v2x_libdem
Tajikistan Emergency response with legal instruments 0.062
Azerbaijan Emergency response with legal instruments 0.070
Sweden Emergency response with legal instruments 0.829
Denmark Emergency response with legal instruments 0.858
Eritrea Emergency response without legal instruments 0.012
Saudi Arabia Emergency response without legal instruments 0.040
Benin Emergency response without legal instruments 0.461
Sri Lanka Emergency response without legal instruments 0.469
North Korea No emergency response 0.014
China No emergency response 0.050
Canada No emergency response 0.776
Germany No emergency response 0.779
pandem_single %>% 
  ggplot(aes(y = fct_rev(emlaw_cond_min), x = v2x_libdem, color = emlaw_cond_min)) +
  geom_quasirandom(groupOnX = FALSE, width = 0.1) +
  guides(color = FALSE) +
  scale_color_viridis_d(option = "plasma", end = 0.8) +
  scale_y_discrete(labels = function(x) str_wrap(x, width = 15)) +
  coord_cartesian(xlim = c(0, 1)) +
  labs(x = "V-Dem liberal democracy index", y = NULL,
       caption = "Lower values indicate less democracy") +
  theme_pandem() +
  theme(panel.grid.major.y = element_blank())

pandem_single %>% 
  group_by(emlaw_cond_min, regime) %>% 
  summarize(n = n())
emlaw_cond_min regime n
Emergency response with legal instruments Closed autocracy 9
Emergency response with legal instruments Electoral autocracy 43
Emergency response with legal instruments Electoral democracy 36
Emergency response with legal instruments Liberal democracy 28
Emergency response without legal instruments Closed autocracy 8
Emergency response without legal instruments Electoral autocracy 14
Emergency response without legal instruments Electoral democracy 1
No emergency response Closed autocracy 2
No emergency response Electoral autocracy 1
No emergency response Liberal democracy 2
pandem_single %>% 
  filter(emlaw_cond_min == "Emergency response without legal instruments",
         regime == "Electoral democracy") %>% 
  select(country_name)
country_name
Sri Lanka
pandem_single %>% 
  ggplot(aes(x = regime, y = fct_rev(emlaw_cond_min), color = emlaw_cond_min)) +
  geom_point(position = position_jitter(width = 0.1, height = 0.1)) +
  scale_color_viridis_d(option = "plasma", end = 0.8) +
  scale_x_discrete(labels = function(x) str_wrap(x, width = 15)) +
  scale_y_discrete(labels = function(x) str_wrap(x, width = 15)) +
  guides(color = FALSE) +
  labs(x = "V-Dem Regimes of the World index", y = NULL) +
  theme_pandem() +
  theme(panel.grid.major.y = element_blank())

Formal ICCPR derogations

Many pandemic-level public health measures necessarily entail imposing limitations on personal rights and freedoms. To curtail the spread of the virus, countries imposed lockdowns and enacted restrictions on movement and association. While countries are ostensibly free to make these decisions within their own borders, many countries are also bound to follow international agreements like the ICCPR. Signatories to the ICCPR have the ability to formally derogate their agreements on a temporary basis, but not all countries did this in 2020.

V-Dem doesn’t keep track of actual formal derogations, so we collected this data by hand.

derog_count <- derogations_clean %>% 
  filter(ratified == 1) %>% 
  count(derogate)
derog_count
derogate n
0 150
1 23

Of the 173 countries that have ratified the ICCPR, 23 submitted formal derogations.

Typology of derogation

pandem_derog %>% 
  count(derogate, nonproportional)
derogate nonproportional n
0 FALSE 87
0 TRUE 23
1 FALSE 14
1 TRUE 4
pandem_derog %>% 
  count(type_clean)
type_clean n
Derogated as intended 13
Derogated; measures not temporary, proportional, or necessary 5
Emergency declared; no formal derogation 74
No emergency; no formal derogation 28
Has not ratified ICCPR 8

A: Derogated as intended

Here are the countries that derogated, provided an end date, and used proportional or necessary measures:

pandem_derog %>% 
  filter(type == "A") %>% 
  select(country_name, derogation_start, derogation_end)
country_name derogation_start derogation_end
Azerbaijan 9/27/2020 12/12/2020
Dominican Republic 3/19/2020 3/2/2020
Ecuador 3/16/2020 11/9/2020
Ethiopia 4/8/2020 9/8/2020
Georgia 3/21/2020 7/1/2021
Guatemala 3/5/2020 9/21/2020
Kyrgyzstan 3/25/2020 5/10/2020
Namibia 3/18/2020 8/18/2020
Paraguay 3/16/2020 1/31/2021
Peru 3/15/2020 3/31/2021
Romania 3/16/2020 5/14/2020
Senegal 3/23/2020 6/30/2020
Thailand 3/25/2020 6/30/2020

B: Officially derogated but measures not temporary/proportional/necessary

Here are the countries that derogated and did not provide an end date or use proportional measures:

pandem_derog %>% 
  filter(type == "B") %>% 
  select(country_name, derogation_start, derogation_end, nonproportional)
country_name derogation_start derogation_end nonproportional
Argentina 3/12/2020 3/12/2021 TRUE
Armenia 3/16/2020, 9/27/2020 9/11/2020, N/A FALSE
Chile 3/18/2020 3/13/2021 TRUE
Colombia 3/17/2020, 5/6/2020 4/16/2020, 6/4/2020 TRUE
El Salvador 3/14/2020 5/29/2020 TRUE

C: Emergency declared but no formal derogation

Here are the ICCPR signatory countries that declared an emergency but did not formally derogate:

pandem_derog %>% 
  filter(type == "C") %>% 
  arrange(country_name) %>% 
  pull(country_name) %>% 
  matrix_from_vector(ncol = 4) %>% 
  kbl() %>% 
  kable_styling()
Albania Gabon Mexico Slovenia
Algeria Ghana Mongolia South Africa
Angola Greece Morocco Spain
Australia Guinea Mozambique Sudan
Austria Honduras Nepal Sweden
Belarus Hungary Netherlands Switzerland
Belgium Ireland New Zealand Tajikistan
Bolivia Israel Niger Togo
Botswana Italy Nigeria Tunisia
Brazil Jamaica North Macedonia Turkey
Bulgaria Jordan Norway Uganda
Chad Kazakhstan Panama Ukraine
Costa Rica Kenya Papua New Guinea United States of America
Croatia Lebanon Philippines Uruguay
Czech Republic Lesotho Poland Uzbekistan
Denmark Liberia Portugal Zambia
Egypt Lithuania Serbia Zimbabwe
Finland Madagascar Sierra Leone
France Malawi Slovakia

D: No emergency, no formal derogation

And here are the ICCPR signatory countries that had no formal legal emergency and did not derogate:

pandem_derog %>% 
  filter(type == "D") %>% 
  arrange(country_name) %>% 
  pull(country_name) %>% 
  matrix_from_vector(ncol = 4) %>% 
  kbl() %>% 
  kable_styling()
Afghanistan Cameroon India Nicaragua
Bangladesh Canada Indonesia Pakistan
Benin Central African Republic Iraq Qatar
Bosnia and Herzegovina Democratic Republic of the Congo Japan Rwanda
Burkina Faso Eritrea Kuwait Somalia
Burundi Germany Mali Sri Lanka
Cambodia Haiti Mauritania Turkmenistan

Human rights violations and democratic backsliding

An overarching fear as countries declared emergency pandemic measures is that these measures would serve as an excuse to violate human rights, limit the space for civil society, and lead to democratic backsliding.

The variety of pandemic-justified human rights violations differs by countries’ formal responses. Those that implemented emergency measures without a formal legal process were more likely to violate non-derogable rights and engage in discriminatory measures. Surprisingly, those that used legal instruments were more likely to enforce these measures harshly, potentially because there was a formal process backing up the measures—there are legislative teeth, so to speak.

violation_summary <- pandem_derog %>% 
  group_by(emlaw_cond_min) %>% 
  summarize(across(c(discrim, ndrights, pomviol),
                   ~mean(.)))

plot_violation_ndrights <- violation_summary %>% 
  pivot_longer(-emlaw_cond_min) %>% 
  filter(name == "ndrights") %>% 
  ggplot(aes(x = value, y = fct_rev(emlaw_cond_min), color = emlaw_cond_min)) +
  geom_pointrange(aes(xmin = 0, xmax = value)) +
  guides(color = FALSE) +
  scale_x_continuous(labels = percent_format(accuracy = 1)) +
  scale_y_discrete(labels = function(x) str_wrap(x, width = 15)) +
  scale_color_viridis_d(option = "plasma", end = 0.8) +
  labs(x = "Proportion violating non-derogable rights", y = NULL,
       title = "Violations of nonderogable rights") +
  theme_pandem() +
  theme(panel.grid.major.y = element_blank())

plot_violation_discrim <- violation_summary %>% 
  pivot_longer(-emlaw_cond_min) %>% 
  filter(name == "discrim") %>% 
  ggplot(aes(x = value, y = fct_rev(emlaw_cond_min), color = emlaw_cond_min)) +
  geom_pointrange(aes(xmin = 0, xmax = value)) +
  guides(color = FALSE) +
  scale_y_discrete(labels = function(x) str_wrap(x, width = 15)) +
  scale_color_viridis_d(option = "plasma", end = 0.8) +
  labs(x = "Average discriminatory measures", y = NULL,
       caption = "Original scale ranges from 0–3",
       title = "Discriminatory measures") +
  theme_pandem() +
  theme(panel.grid.major.y = element_blank())

plot_violation_pomviol <- violation_summary %>% 
  pivot_longer(-emlaw_cond_min) %>% 
  filter(name == "pomviol") %>% 
  ggplot(aes(x = value, y = fct_rev(emlaw_cond_min), color = emlaw_cond_min)) +
  geom_pointrange(aes(xmin = 0, xmax = value)) +
  guides(color = FALSE) +
  scale_y_discrete(labels = function(x) str_wrap(x, width = 15)) +
  scale_color_viridis_d(option = "plasma", end = 0.8) +
  labs(x = "Average abusive enforcement", y = NULL,
       caption = "Original scale ranges from 0–3",
       title = "Abusive enforcement") +
  theme_pandem() +
  theme(panel.grid.major.y = element_blank())

plot_violation_discrim / plot_violation_ndrights / plot_violation_pomviol

The level of civil society openness varies substantially across these four types of derogations. Countries that formally derogated have far more open civil society than those that did not derogate. However, civil society openness isn’t necessarily a strong predictor of whether emergency measures are temporary or proportional. The 5 derogating countries that ended up abusing their privileges have relatively unrestricted and freely regulated civil societies.

Countries that did not official derogate have more restricted space for civil society, and countries that did not issue a formal legal emergency and did not formally derogate tend to have an even lower average civil society index. Not surprisingly, countries that have not ratified the ICCPR have highly restricted civil societies.

pandem_derog %>% 
  ggplot(aes(x = v2xcs_ccsi, y = fct_rev(type_clean_letter), color = type_clean_letter)) +
  stat_summary(aes(fill = type_clean_letter), geom = "point", fun = "mean", 
               size = 4, pch = 23, color = "white", alpha = 0.4, 
               position = position_nudge(x = 0, y = -0.2)) +
  geom_quasirandom(groupOnX = FALSE, width = 0.1) +
  guides(color = FALSE, fill = FALSE) +
  scale_y_discrete(labels = function(x) str_wrap(x, width = 15)) +
  scale_color_viridis_d(option = "plasma", end = 0.8) +
  scale_fill_viridis_d(option = "plasma", end = 0.8) +
  coord_cartesian(xlim = c(0, 1)) +
  labs(x = "Average V-Dem core civil society index", y = NULL,
       caption = "Diamonds show mean value; lower values indicate more limited civil society") +
  theme_pandem() +
  theme(panel.grid.major.y = element_blank())

pandem_derog %>% 
  ggplot(aes(x = v2xcs_ccsi, y = pandem)) +
  geom_point(aes(color = type_clean_letter)) +
  geom_smooth(method = "lm") +
  scale_color_viridis_d(option = "plasma", end = 0.95) +
  guides(color = guide_legend(ncol = 2)) +
  coord_cartesian(xlim = c(0, 1)) +
  labs(x = "V-Dem core civil society index", y = "Pandemic violations index", color = NULL) +
  theme_pandem()

pandem_derog %>% 
  ggplot(aes(x = v2xcs_ccsi, y = panback)) +
  geom_point(aes(color = type_clean_letter)) +
  geom_smooth(method = "gam") +
  scale_color_viridis_d(option = "plasma", end = 0.95) +
  guides(color = guide_legend(ncol = 2)) +
  coord_cartesian(xlim = c(0, 1), ylim = c(0, 0.5)) +
  labs(x = "V-Dem core civil society index", y = "Pandemic backsliding index", color = NULL) +
  theme_pandem()

pandem_derog %>% 
  ggplot(aes(x = v2x_libdem, y = pandem)) +
  geom_point(aes(color = type_clean_letter)) +
  geom_smooth(method = "lm") +
  scale_color_viridis_d(option = "plasma", end = 0.8) +
  guides(color = guide_legend(ncol = 2)) +
  labs(x = "V-Dem liberal democracy index", y = "Pandemic violations index", color = NULL) +
  theme_pandem()

pandem_derog %>% 
  ggplot(aes(x = v2x_libdem, y = panback)) +
  geom_point(aes(color = type_clean_letter)) +
  geom_smooth(method = "gam") +
  scale_color_viridis_d(option = "plasma", end = 0.8) +
  guides(color = guide_legend(ncol = 2)) +
  coord_cartesian(ylim = c(0, 0.5)) +
  labs(x = "V-Dem liberal democracy index", y = "Pandemic backsliding index", color = NULL) +
  theme_pandem()

LS0tCnRpdGxlOiAiR2VuZXJhbCBhbmFseXNpcyIKYXV0aG9yOiAiU3VwYXJuYSBDaGF1ZGhyeSBhbmQgQW5kcmV3IEhlaXNzIgpkYXRlOiAiYHIgZm9ybWF0KFN5cy50aW1lKCksICclRicpYCIKb3V0cHV0OiAKICBodG1sX2RvY3VtZW50OgogICAgY29kZV9mb2xkaW5nOiBoaWRlCmVkaXRvcl9vcHRpb25zOiAKICBjaHVua19vdXRwdXRfdHlwZTogY29uc29sZQotLS0KCmBgYHtyIHNldHVwLCBpbmNsdWRlPUZBTFNFfQpsaWJyYXJ5KGtuaXRyKQpsaWJyYXJ5KGthYmxlRXh0cmEpCmtuaXRfcHJpbnQuZGF0YS5mcmFtZSA8LSBmdW5jdGlvbih4LCAuLi4pIHsKICByZXMgPC0gcGFzdGUoYygnJywgJyc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