Coding Assignment 2

Author

Your Name

Overview

For this assignment, you are going to download some variables using the wbstats and vdemlite packages. Then you are going to wrangle these data and merge the two data sets into one and analyze how they relate to women’s representation in national parliaments. Do your work for each step in the code chunks provided.

Here is a setup code chunk. You can load all of your packages here or as you go along in the code chunks below using the library() function. However, note that you really only need to load a library once per document.

Warning

Please refrain from installing any packages in your code chunks because this will also install them every time the code chunk is run or your document is rendered. This may not be desirable for you or whoever is looking at or running your code (e.g. me).

Step 1: Download data from V-Dem (10pts)

Use the V-Dem codebook or the searchdem() function in vdemlite to identify at least two measures of women’s empowerment (make at least one something that we did not use in class). Also retrieve the six-fold regional classification that we used in class and a general measure of democracy (like the polyarchy or libdem score). Now use fetchdem() to download the most recent 25 years or so of data for your analysis for all countries in the dataset. Make sure to load the packages that you need and glimpse() the data or View() it to make sure that it downloaded properly.

Step 2: Download data from the World Bank (10 pts)

Next, using the WDI package, download the variable on women’s representation in parliament (“SG.GEN.PARL.ZS”), at least one additional measure related to women’s empowerment and a measure of wealth (GDP per capita). Go to the WDI site the WDIsearch() function to identify relevant variables. Download data for the same time period as you did for the V-Dem data for all countries. Ensure that at least one of the variables you select is different from the ones we explored in class.

Important

Try to make sure you download indicators with enough data to conduct your analysis. You won’t get great results if there are too many NAs.

Step 3: Clean the data (20 pts)

Now clean the data. Drop any columns that you will not need for the analysis. Filter out any years that do not match between the two data frames. Transform the region codes into actual region names. Etc.

# clean v-dem data
# clean wb data

Step 4: Merge the data (20 pts)

Now add country codes using the countrycode package and merge the data using left_join().

Step 5: Summarize your combined data set (20 pts)

Use group_by(), summarize() and arrange() to glean preliminary insights about your data. For example, how do regions compare on mean values of women’s representation and how do these values relate to the values of other variables in your data set? Which countries stand out in terms of women’s representation?

# Regional summary
# Country summary
Warning

Don’t write your paragraphs or any interpretation or analysis in a code chunk. Use markdown text. Quarto is designed to be a literate programming tool, so you can write your analysis in markdown text and include code chunks when necessary to support your argument.

Step 6: Visualize and interpret your data (20 pts)

Using the data from step 5, create an appropriate visualization that either shows differences in levels of women’s empowerment across countries or regions or demonstrates the relationship between women’s empowerment and a potential explanatory variable like welath or democracy. Then write a few lines about the patterns that your visualization uncovers.

Note

You may relate your analysis to the assigned Norris reading that explores reasons for variations in women’s empowerment but this is not strictly required.

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.