Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
ECON 216 Problem Set 5
Instructions In this problem set you will investigate the change in annual average air temperatures over time at both the global and country level using a time-series line plot and a choropleth. There are 40 total points in the assignment. You will need the files GlobalTemp.RData and WorldShape.RData and the packages tidyverse, sf, and ggthemes. The data in GlobalTemp.RData come from Berkeley Earth. There are two datasets in the file, glbl_av_temp and cntry_av_temp. The first contains monthly average temperatures over the Earth’s surface since the 18th century while the second breaks this average down by country. The shapefile for the project is contained in the file WorldShape.RData and is called world_shp. When you turn in your problem set, please submit both an Rmd file and an html file labelled as before using your CWRU ID: abc123_PS5.Rmd and abc123_PS5.html. Part 1. (16 points) Global average temperatures began to rise following the massive increase in fossil fuel consumption sparked by industrialization. In this part you will try to estimate the year in which global average temperature began to rise. You will use the dataset global_avg_temp to guess an inflection year for global average temperatures between 1750 and 2015. We will call that inflection year INFLECT. INFLECT is the latest year where you judge there has been no overall upward trend temperature in the preceding years. Before INFLECT, temperatures will have trended neither up nor down, though there are significant annual fluctuations. A. Create a properly labeled time series line graph for annual average temperatures between 1750 and 2015. (Remember a time series graph has time on the x-axis.) Note that the data is at the monthly level so you will need to summarize first. Note that the data is spiky before the late 19th century because the underlying measurements are sparse. B. Guess the year for INFLECT using the following iterative method. First, make an initial guess of a year, like 1880. Then add two smoothing lines to the plot from part A by using geom_smooth, setting method=“lm”andse=FALSE. The first line will be limited to years before your guess and the second line to the years after. Remember you can change the data a geom uses like this:geom_any(filter(data, year<=1900))‘ For the first smoothed line, filter the data within the geom to include only the years between 1750 and your guess of INFLECT. (See the final example in section 3.6 for a hint.) For the first 1 If the first smoothed line is flat and the second inclined up, your guess is pretty good. If both lines are inclined up, you are probably too late in your guess. Adjust the year until the first smoothed line is flat and the second inclined up. That year will be your guess of INFLECT. Include a version of this plot with your final guess. C. Redraw the plot from part A and place a red vertical line using geom_vline at your guess for INFLECT. Part 2. (12 points) A. Create a country-level dataframe called cntry_av_temp_diff that has the following four variables: country, the name of the country. mean_temp_baseline, mean temperature between 1850 and your inflec- tion point INFLECT, mean_temp_recent, mean temperature between 2000 and 2015. temp_change, the difference between recent temperature and the baseline. This new dataframe can be created in several ways. One way is via a pipeline starting with cntry_av_temp and doing some mutating, grouping, summarizing, and pivoting, in that order. B. Write a short paragraph that describes in words the steps that you took in part A to get from the raw data to the finished data frame. Part 3. (8 points) Create a world choropleth showing the change for each country in annual average temperature between the baseline and recent periods. Exclude Antarctica from the choropleth. A. Remove Antarctica from world_shp. Join cntry_av_temp_diff to world_shp. B. Using the augmented world_shp, create a world choropleth of the change in temperatures between the baseline and recent period. Use scale_fill_distiller using the palette Oranges for the fill colors. Part 4. (4 points) Write a short paragraph that describes the patterns that you see on the finished choropleth.