--- title: "Assignment 4: Extractive Institutions" author: "" date: "" output: tufte::tufte_handout: highlight: tango df_print: kable link-citations: yes editor_options: chunk_output_type: console --- ```{r setup, include=FALSE} library(tufte) # invalidate cache when the tufte version changes knitr::opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tufte')) options(htmltools.dir.version = FALSE) ``` \noindent Created: `r Sys.Date()` \noindent Due Date: # Instructions Prepare a presentation on the slave trade’s contemporary impacts on your chosen country. - Slide 1: Use a scatter plot of Sub-Saharan countries to illustrate the general relationship between the total number of slaves shipped in Africa’s slave trades (plotted on a log scale) and the percent change in per-capita GDP from 1960 to 1992, highlighting your country. - Slide 2: Interpret your findings: is your country on, above or below the regression line for Sub-Saharan Africa? Does the theory about the effect of this extractive institution help explain your country’s political and economic trajectory since independence? Why? *** # 1. Preparation If you've completed the previous coding assignment, the `tidyverse` package should already be installed on your computer. If not, run this code chunk. ```{r eval = FALSE} install.packages("tidyverse") ``` Similarly, if you haven't installed the `gghighlight` package, do so by running this code chunk. ```{r eval = FALSE} install.packages("gghighlight") ``` Now, load both packages: ```{r message=FALSE, warning=FALSE} library(tidyverse) library(gghighlight) ``` Finally, load the data set from the URL provided. ```{r message = FALSE} africa_df <- read_csv('https://african-states-book.info/img/portfolio/problem-sets/data/04-data.csv') ``` To start, you'll need to assign the name of your country to the variable `my_country`. You'll also need to assign the three-character ISO country code to the variable `my_iso_code`. By assigning the country name and country code to variables, you'll only have to type them once. ```{r} my_country <- "Kenya" my_iso_code <- "KEN" ssa_countries <- africa_df %>% select(country, iso3c) %>% unique() ``` The variable `my_country` will be used to label graphs, so it can be formatted however you prefer. For instance, if you're researching the Democratic Republic of the Congo, you may assign "Democratic Republic of the Congo", "Congo, Democratic Republic", "DRC", or any other appropriate name to the `my_country` variable. On the other hand, the code you assign to the `my_iso_code` variable must precisely match your country's three-character ISO code. You can look up your country's ISO code online, or you can run `view(ssa_countries)` in the RStudio console. *** # 2. Extractive Institutions and Percent Change in Per-Capita GDP (1960 to 1992) Now that we have the country name and country code stored as variables, we can make a scatter plot with the natural log of total slave exports on the x-axis and annual percentage change in per-capita GDP on the y-axis. To do this, we'll use the `ggplot2` package. ```{r} ggplot(africa_df, aes(x = ln_export_pop, y = avg_gdp_grwth92, label = iso3c)) + geom_text(size = 3) + geom_smooth(method = "lm", se = FALSE) + gghighlight(iso3c == my_iso_code) + theme_classic(7) + labs( x = "Total Export Population\n(Persons, Log Scale)", y = "Percent Change in Per-Capita GDP\n1960-1992", title = "The Slave Trades and Economic Outcomes in Africa" ) ``` As in the previous problem set, you can save this plot as an image or PDF using the `ggsave` function. ```{r, eval=FALSE} ggsave('figure-04-1.png') ``` In R Studio, you can also save the plot by clicking the "Export" button at the top of the plots window. What does this plot tell you about the general trend of extractive colonial institutions and percent change in per-capita GDP? Is your country above or below the trend line? What other factors might explain average growth in per-capita GDP for your country?