Quality of government and governance outcomes

Readings and class materials for Thursday, September 12, 2024

Readings

Plan for the day

R code example: Posit.cloud example (V-Dem doesn’t work though)

---
title: "Examples of working with governance-related data"
---

```{r setup, warning=FALSE, message=FALSE}
library(tidyverse)

# remotes::install_github("ropengov/rqog")
library(rqog)

# remotes::install_github("vdeminstitute/vdemdata")
library(vdemdata)

library(WDI)
```

# Quality of Government (QoG) project

```{r}
qog_basic <- read_qog(which_data = "basic", data_type = "time-series")
```

```{r}
afg_alb <- qog_basic |> 
  filter(cname %in% c("Afghanistan", "Albania")) |> 
  filter(year >= 2007, year <= 2020)

ggplot(data = afg_alb,
       mapping = aes(x = year, y = wbgi_gee, color = cname)) +
  geom_line()
```


# Varieties of Democracy (V-Dem) project

```{r}
vdem_small <- vdem |>
  select(country_name, country_text_id, year, region = e_regionpol_6C,
         public_sector_corruption = v2x_pubcorr, impartial_pa = v2clrspct) |>
  filter(country_name %in% c("Afghanistan", "Albania")) |>
  filter(year >= 2007, year <= 2020)

ggplot(data = vdem_small,
       mapping = aes(x = year, y = impartial_pa, color = country_name)) +
  geom_line()
```


# World Bank data

```{r}
wdi_raw <- WDI(
  country = "all",
  # indicator = c("NY.GDP.PCAP.KD", "BI.PWK.PUBS.FE.ZS"),
  indicator = c("NY.GDP.PCAP.KD"),
  start = 2007,
  end = 2020,
  extra = TRUE
)

wdi_small <- wdi_raw |> 
  filter(country %in% c("Afghanistan", "Albania"))

ggplot(data = wdi_small,
       mapping = aes(x = year, y = NY.GDP.PCAP.KD, color = country)) +
  geom_line()
```