Homework 1

Author

Your Name

Published

October 15, 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 will get to choose between the following four measures:

  • liberal democracy (libdem)
  • participatory democracy (partipdem)
  • deliberative democracy (delibdem)
  • egalitarian democracy (egaldem).

For measuring modernization we are going to stick with GDP per capita (gdp_pc).

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(plotly)

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

a) Read in the data from column_chart.csv using read_csv() in an object called column_chart_dta. You should see average democracy scores for the countries that you made a line chart for in Step 1.

b) View the data frame. Describe briefly what you see, e.g. number of rows, columns and how the countries rank in terms of one of the democracy scores.

c) 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

d) 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) Load the scatter plot data with read_csv()from scatter_plot.csv, storing the data in an object called scatter_plot_dta. Then glimpse or view the data and describe briefly what you see. Note that the values you see are country averages for the variables over the period 2010 - 2019.

b) Now 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. Note that you will get some warnings about a few missing data points, so 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)

Press the render button to create your HTML document. If you get any errors go back and fix them and try again until the document renders.

Extra Credit (3 pts)

(a) Use a Quato theme to improve the look of the HTML output.

(b) Use the paletteer package to a different theme to your scatter plot from Step 4.

(c) Add annotation to your scatter plot from Step 4 using hline() or vline() to highlight a significant point in your data, like the mean or some other significant value. (Note: you will have to do some research to complete this step–we did not do it in class).

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 are instructions along with screenshots there to assist you with the process of exporting your project as a ZIP file from Posit Cloud.