MTH_245_HW_3.pdf MTH-245 Homework 3 Due: Thursday, January 27 by the beginning of class. Instructions: The purpose of this assignment is to introduce you to creating (tidyverse package) and arranging...

I need help with getting this code on RStudio (RSweave).


MTH_245_HW_3.pdf MTH-245 Homework 3 Due: Thursday, January 27 by the beginning of class. Instructions: The purpose of this assignment is to introduce you to creating (tidyverse package) and arranging (patchwork package) ggplot graphics. Your task is to recreate the “Homework 3 Figures” doc- ument located in the course Box; grades will be assigned based on how closely your work resemebles this document. Pay special attention to formatting, labeling, captions, titles, axes, etc. Upon completion of this assignment (prior to the due date), upload your .pdf and .Rnw files to the “Homework Assignments” folder within your individual MTH-245 Box. I should be able to replicate your .pdf file by running your .Rnw file without issues. To get started, save a .Rnw file in your homework folder on your computer; call it “Last Name MTH 245 HW 3.” Please come see me if you have any questions! Enjoy. Data Background: For this assignment, you will be working with the “econ.csv” file located in the course Box. These data range from 1980-2016 and contain variables on 32 di↵erent countries that were chosen based on a variety of factors. This dataset was used by Jason Jones (Depeartment of Economics, Furman University), Florence Bouvet (School of Business and Economics, Sonoma State University), and myself to help assess the 1994 International Monetary Fund (IMF) CFA franc devaluation on gross domestic product (gdp) per capita. Our results are summarized in the paper “Currency devaluation as a source of growth in Africa: a synthetic control approach”, which was recently published in the Eastern Economic Journal. All of the figures you are tasked with recreating in this assignment were considered for or included in this paper and created using ggplot graphics in R! The variables you will work with are • country – the country name • landlock – 1 if the country is landlocked and 0 if not • pop – population • rgdpe – real gdp • gdpcap - gdp per capita. Important Comments: 1. Before you begin recreating the figures from the “Homework 3 Figures” document, you need to create the gdp per capita variable by taking total gdp (“rgdpe”) and dividing by population (“pop”). Call this new variable “gdpcap.” Naturally, this will be done in R. 2. Your figures don’t have to perfectly match those from the “Homework 3 Figures” document in size, but they should be similar. 3. To get a sense of what is being graphed, pay special attention to the captions. This gets at an important point; namely, captions should be informative, but not overly “wordy.” 1 Homework_3_Figures.pdf Homework 3 Figures 1 Violin Plot - GDP Per Capita 0 10000 20000 30000 40000 50000 GDP Per Capita Frequencies of GDP Per Capita Figure 1: A violin boxplot of the frequencies of n = 1184 gdp per capita values for all years (1980-2016) for 32 countries. 2 Histogram - GDP Per Capita 0.00000 0.00005 0.00010 0.00015 0.00020 0 10000 20000 30000 40000 GDP Per Capita D en si ty Frequencies of GDP Per Capita Figure 2: A histogram of the frequencies of n = 1184 gdp per capita values for all years (1980-2016) for 32 countries with a density curve added. 1 3 Side-by-Side Boxplots of GDP Per Capita by Year 1980 1985 1990 1995 2000 2005 2010 2016 0 10000 20000 30000 40000 GDP Per Capita Ye ar Frequencies of GDP Per Capita by Year Figure 3: Side-by-side boxplots of the frequencies of n = 256 gdp per capita values for years 1980, 1985, 1990, 1995, 2000, 2005, 2010, and 2016 for 32 countries. 4 Bar Plot of the Frequency of Landlocked Countries 0 5 10 15 20 No Yes Landlocked Fr eq ue nc y Landlocked Countries Figure 4: A bar plot of the frequencies of landlocked countries. 2 5 Line Plots of GDP Per Capita Over Time for 12 Countries Niger Republic of the Congo Senegal Togo Chad Côte d'Ivoire Gabon Mali Benin Burkina Faso Cameroon CAR 19 80 19 90 20 00 20 10 19 80 19 90 20 00 20 10 19 80 19 90 20 00 20 10 19 80 19 90 20 00 20 10 0 5000 10000 15000 0 5000 10000 15000 0 5000 10000 15000 Year G D P Pe r C ap ita Figure 5: Side-by-side line plots of gdp per capita over time for 12 countries. 3 6 Arranging Plots 0 10000 20000 30000 40000 50000 GDP Per Capita Frequencies of GDP Per Capita 0.00000 0.00005 0.00010 0.00015 0.00020 0 10000 20000 30000 40000 GDP Per Capita D en si ty Frequencies of GDP Per Capita 1980 1985 1990 1995 2000 2005 2010 2016 0 10000 20000 30000 40000 GDP Per Capita Ye ar Frequencies of GDP Per Capita by Year 0 5 10 15 20 No Yes Landlocked Fr eq ue nc y Landlocked Countries Figure 6: Top left: A violin boxplot of the frequencies of n = 1184 gdp per capita values for all years (1980-2016) for 32 countries. Top right: A histogram of the the frequencies of n = 1184 gdp per capita values for all years (1980-2016) for 32 countries with a density curve added. Bottom left: Side-by-side boxplots of the frequencies of n = 256 gdp per capita values for years 1980, 1985, 1990, 1995, 2000, 2005, 2010, and 2016 for 32 countries. Bottom right: A bar plot of the frequencies of landlocked countries. 4 0 10000 20000 30000 40000 50000 GDP Per Capita Frequencies of GDP Per Capita 0.00000 0.00005 0.00010 0.00015 0.00020 0 10000 20000 30000 40000 GDP Per Capita D en si ty Frequencies of GDP Per Capita 0 10000 20000 30000 40000 1980 1985 1990 1995 2000 2005 2010 2016 Year G D P Pe r C ap ita Frequencies of GDP Per Capita by Year Figure 7: Top left: A violin boxplot of the frequencies of n = 1184 gdp per capita values for all years (1980-2016) for 32 countries. Bottom left: A histogram of the the frequencies of n = 1184 gdp per capita values for all years (1980-2016) for 32 countries with a density curve added. Right: Side-by-side boxplots of the frequencies of n = 256 gdp per capita values for years 1980, 1985, 1990, 1995, 2000, 2005, 2010, and 2016 for 32 countries. 5
Jan 26, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here