Presidential Economic Performance

Harold Nelson

9/23/2019

Load Required Packages

library(tidyverse)
## ── Attaching packages ────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.2.1       ✔ purrr   0.2.5  
## ✔ tibble  2.0.1       ✔ dplyr   0.8.0.1
## ✔ tidyr   0.8.1       ✔ stringr 1.4.0  
## ✔ readr   1.1.1       ✔ forcats 0.3.0
## ── Conflicts ───────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(readr)

Some Economic Data

This data came from the Federal Reserve Economic Data system (FRED). It is all quarterly beginning with the first quarter of 1990. The first step is to import the data.

indicators <- read_csv("~/Dropbox/Documents/SMU/CSC 463/indicators.csv",col_types = cols(Date = col_date(format = "%m/%d/%y")))

Examine the data.

str(indicators)
## Classes 'tbl_df', 'tbl' and 'data.frame':    148 obs. of  7 variables:
##  $ Date     : Date, format: "1980-01-01" "1980-04-01" ...
##  $ President: chr  "Reagan" "Reagan" "Reagan" "Reagan" ...
##  $ realgdp  : num  1.3 -7.9 -0.6 7.6 8.5 -2.9 4.7 -4.6 -6.5 2.2 ...
##  $ lfpr25_54: num  78.7 78.6 78.6 78.7 79.1 79.4 79.1 79.5 79.5 79.8 ...
##  $ unrate   : num  6.3 7.3 7.7 7.4 7.4 7.4 7.4 8.2 8.8 9.4 ...
##  $ infcpi   : num  16.7 14.2 7.7 11.7 11.5 8.6 11.6 6.7 3.6 5.9 ...
##  $ newjobs  : int  316 -437 -408 679 390 238 194 -401 -628 -479 ...
##  - attr(*, "spec")=List of 2
##   ..$ cols   :List of 7
##   .. ..$ Date     :List of 1
##   .. .. ..$ format: chr "%m/%d/%y"
##   .. .. ..- attr(*, "class")= chr  "collector_date" "collector"
##   .. ..$ President: list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ realgdp  : list()
##   .. .. ..- attr(*, "class")= chr  "collector_double" "collector"
##   .. ..$ lfpr25_54: list()
##   .. .. ..- attr(*, "class")= chr  "collector_double" "collector"
##   .. ..$ unrate   : list()
##   .. .. ..- attr(*, "class")= chr  "collector_double" "collector"
##   .. ..$ infcpi   : list()
##   .. .. ..- attr(*, "class")= chr  "collector_double" "collector"
##   .. ..$ newjobs  : list()
##   .. .. ..- attr(*, "class")= chr  "collector_integer" "collector"
##   ..$ default: list()
##   .. ..- attr(*, "class")= chr  "collector_guess" "collector"
##   ..- attr(*, "class")= chr "col_spec"
glimpse(indicators)
## Observations: 148
## Variables: 7
## $ Date      <date> 1980-01-01, 1980-04-01, 1980-07-01, 1980-10-01, 1981-…
## $ President <chr> "Reagan", "Reagan", "Reagan", "Reagan", "Reagan", "Rea…
## $ realgdp   <dbl> 1.3, -7.9, -0.6, 7.6, 8.5, -2.9, 4.7, -4.6, -6.5, 2.2,…
## $ lfpr25_54 <dbl> 78.7, 78.6, 78.6, 78.7, 79.1, 79.4, 79.1, 79.5, 79.5, …
## $ unrate    <dbl> 6.3, 7.3, 7.7, 7.4, 7.4, 7.4, 7.4, 8.2, 8.8, 9.4, 9.9,…
## $ infcpi    <dbl> 16.7, 14.2, 7.7, 11.7, 11.5, 8.6, 11.6, 6.7, 3.6, 5.9,…
## $ newjobs   <int> 316, -437, -408, 679, 390, 238, 194, -401, -628, -479,…

One Indicator for One President.

indicators %>% filter(President == "Reagan") %>% 
  ggplot(aes(x=Date,y=realgdp)) +
  geom_point() +
  geom_smooth() +
  ggtitle("Reagan - Real GDP Growth Rate")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Compare the Presidents on Economic Performance

Produce a time series plot of the data for each variable. Map the presidents’ names to color.

indicators %>% ggplot(aes(x=Date,y=realgdp,col=President)) +
  geom_point() +
  geom_smooth(se=FALSE) + ggtitle("Growth Rate of Real GDP") 
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

indicators %>% ggplot(aes(x=Date,y=lfpr25_54,col=President)) +
  geom_point() +
  geom_smooth(se=FALSE) + ggtitle("Labor Force Participation Rate 25 to 54") 
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

indicators %>% ggplot(aes(x=Date,y=unrate,col=President)) +
  geom_point() +
  geom_smooth(se=FALSE) + ggtitle("Unemployment Rate")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

indicators %>% ggplot(aes(x=Date,y=infcpi,col=President)) +
  geom_point() +
  geom_smooth(se=FALSE) + ggtitle("Inflation (CPI)") 
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

indicators %>% ggplot(aes(x=Date,y=newjobs,col=President)) +
  geom_point() +
  geom_smooth(se=FALSE) + ggtitle("New Jobs") 
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'