Developing Data Products Final Assignment: Calculating Inflation Over Chosen Periods

Mossy Moose (Coursera Student)
November 7, 2021

Summary

The final assignment for the Developing Data Products course was to create and publish a Shiny app, share the source code, and prepare a presentation.

For this assignment, I revisted GDF Deflator data I had used for the final project in the Reproducible Research course and created an app to allow a user to select a date range and see the GDP Deflator values plotted, along with a summary of the data range (since data are released quarterly), starting and ending values, and annualized inflation.

Shiny App: https://mossymoose.shinyapps.io/ddpweek4/

Code on GitHub: https://github.com/MossyMoose/DDPWeek4/tree/master/DDPWeek4

About the Data

The data are available from the St. Louis Federal Reserve Bank. I grabbed the data and converted the first column to a Date format with this code:

gdpDeflator <- read.csv(file="https://fred.stlouisfed.org/graph/fredgraph.csv?bgcolor=%23e1e9f0&chart_type=line&drp=0&fo=open%20sans&graph_bgcolor=%23ffffff&height=450&mode=fred&recession_bars=on&txtcolor=%23444444&ts=12&tts=12&width=1168&nt=0&thu=0&trc=0&show_legend=yes&show_axis_titles=yes&show_tooltip=yes&id=GDPDEF&scale=left&cosd=1947-01-01&coed=2021-07-01&line_color=%234572a7&link_values=false&line_style=solid&mark_type=none&mw=3&lw=2&ost=-99999&oet=99999&mma=0&fml=a&fq=Quarterly&fam=avg&fgst=lin&fgsnd=2020-02-01&line_index=1&transformation=lin&vintage_date=2021-11-07&revision_date=2021-11-07&nd=1947-01-01")
gdpDeflator$DATE <- as.Date(gdpDeflator$DATE, format="%Y-%m-%d")

You can download the code yourself (and get the URL for the CSV) at: https://fred.stlouisfed.org/series/GDPDEF

Plotting the Data (Full Data Set)

plot of chunk unnamed-chunk-2

Calculating Annualized Inflation

Annualized inflation can be calculated as the ending deflator divided by the starting deflator, and then raising that to the power of 1 over the number of periods. Here is the calculation of the inflation for the full data set.

gdpRows <- nrow(gdpDeflator)

((gdpDeflator[gdpRows,2]/gdpDeflator[1,2])^
           (1/(gdpDeflator[gdpRows,2]-gdpDeflator[1,2]))) - 1
[1] 0.02169487

We cleaned this up in the app and provided more information, but as you can see, annualized inflation over the full period was 2.17 percent.