02/08/2021

Motivation

  • The president of the United States is the head of state of the United States of America.
  • The president is elected in democratic elections that require support from the majority of American citizens.
  • However, once the presidents are elected, their popularity can increase or decrease throughout their term.
  • Hence, it is interesting to see the change in approval rate.

Data

To do this, I have created a simple R Shiny application that makes use of the R’s built-in data set called “presidents”. This data set is based on quarterly data from years 1945-1974.

To load the data set, one can use

data("presidents")
head(presidents, n=28)
     Qtr1 Qtr2 Qtr3 Qtr4
1945   NA   87   82   75
1946   63   50   43   32
1947   35   60   54   55
1948   36   39   NA   NA
1949   69   57   57   51
1950   45   37   46   39
1951   36   24   32   23

App

  • The app I have created lets you select either approval or disapproval rates and visualize them.
  • The application is easy to use as it contains an instruction on how you should use it.
  • For each year, there is a mean computed from the quarterly data mentioned on the previous slide.
  • The disapproval rates are calculated as the opposite of approval rates. It is assumed that people’s believes are binary.
  • The app is deployed on a server and easily accessible.
  • You can find it here.

Example plot

To illustrate, if you select the approval and disapproval rates, you will see the following plot: