Homework 2

Author

Your Name

Published

September 30, 2024

Overview

For this assignment, you are going to evaluate modernization theory as laid out in Seymour Martin Lipset’s classic article entitled “Some Social Requisites of Democracy: Economic Development and Political Legitimacy.” How classic is this article? According to Google Scholar, this piece has been cited more than 11.5 thousand times!

We are going to use data from V-Dem and modern data viz tools to explore Lipset’s hypothesis that economic modernization is highly correlated with democracy. We have already done this to some extent by looking at the relationship between wealth and the polyarchy score. But we are going to broaden things out by looking at other measures of democracy contained in the V-Dem dataset. Specifically, you can choose among the following four measures:

  • liberal democracy (v2x_libdem)
  • participatory democracy (v2x_partipdem)
  • deliberative democracy (v2x_delibdem)
  • egalitarian democracy (v2x_egaldem)

Or you can use some other democracy indicator from the V-Dem database. For measuring modernization we will use GDP per capita (e_gdppc). Use the vdemlite package to retrieve your indicators.

For an extra challenge, you could try merging V-Dem democracy indicators with GDP per capita taken from the World Bank using the wbstats package but this is not required.

Start by running this code chunk to import all of the packages you will need for this exercise. Then start working through the code and questions below. Feel free to grab relevant code chunks from the slides or the classwork QMD files that we have used in class so far.

library(tidyverse)
library(tidyr)
library(colorBlindness)
library(vdemlite)
library(plotly)
library(gganimate)

Step 2: Make a column chart comparing country levels (20 pts)

a) Now use a group_by(), summarize() sequence to take country averages for the data that you retrieved for your line chart in Step 1 and store it as an object called column_chrt_dta.

b) Use ggplot() and geom_col() to visualize one of the democracy measures with a column chart (you can use the same measure as in Step 1 or a different one). Use fct_reorder() to arrange the columns in order of the y-axis values. Make sure to add appropriate axis labels, a title and a caption. Change the fill color and add a theme to spruce it up a bit. Remember that these are averages over the same number of years as the line chart you made in Step 1

c) Interpret your column chart. Does the evidence in the column chart roughly match what you saw in the line chart above?

Step 3: Make a scatter plot (20 pts)

a) Use fetchdem() to grab democracy indicators along with GDP per capita and region codes (e_regionpol_6C) for all countries for one year of your choosing (hint: set start_year and end_year to the same year). Be sure to rename variables where you need to and use mutate() and case_match() to assign region names

b) Use the data from part A build a scatter plot with ggplot2 using these data. Put GDP on the x-axis and one of the measures of democracy on the y-axis and color the points by region. Stretch the x-axis on a log scale and use the scales package to add a prefix and suffix to the x-axis numbers to indicate that they are dollar figures. Add appropriate labels and a viridis color map and add your favorite theme. If you get some warnings about a few missing data points, try setting warning: false at the top of the code chunk with the hash pipe (#|) operator.

c) Next add a trend line with geom_smooth() preferably with a linear model (method = “lm”). Note that you will get some warnings about missing data points and a message about the linear model. Try setting warning: false at the top of the code chunk with the hash pipe (#|) operator.

Step 4: Additional Tasks (20 pts)

a) Facet wrap your scatter plot by region.

b) Remove the facet_wrap() call and display the relationship for one region and use geom_text() to label your points.

c) Remove the text labels and make your scatter plot interactive using ggplotly(). Make sure that your tooltip includes the information that you want to display to the user.

Step 5: Interpretation (10 pts)

Interpret your results from your visualizations, including the scatter plot, line chart and column chart. Is there an obvious relationship between development and democracy? Do the data generally support Lipset’s theory?

Step 6: Rendering (10 pts)

Use a Quato theme to improve the look of the HTML output. Press the render button to create your HTML document. If there are lots of messages or warnings come out of your code chunks, consider supressing them with the appropriate chunk options. If you get any errors go back and fix them and try again until the document renders.

Extra Credit (3 pts)

a) Use fetchdem() to download time series data and gganimate to make an animated version of your scatter plot.

b) Interpret the plot. Does it tell an interesting story that the static plot did not?

Submission

After rendering your document, export your project folder and submit it on Blackboard. You will find the link to the Coding Assignment one submission portal under the Assignments link. There is a screen capture video in the Discord server that will help you understand how to do this.