library(ggplot2)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.3 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ lubridate 1.9.3 ✔ tibble 3.2.1
## ✔ purrr 1.0.2 ✔ tidyr 1.3.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
df_cpi <- read.csv("CPI index data.csv")
df_fed_rate <- read.csv("FEDFUNDS.csv")
df_unemployment <- read.csv("Unemployment.csv")
df_pop16above<- read.csv("Population16above.csv")
head(df_cpi)
## Year Jan Feb Mar Apr May Jun Jul Aug Sep
## 1 2023 299.170 300.840 301.836 303.363 304.127 305.109 305.691 307.026 307.789
## 2 2022 281.148 283.716 287.504 289.109 292.296 296.311 296.276 296.171 296.808
## 3 2021 261.582 263.014 264.877 267.054 269.195 271.696 273.003 273.567 274.310
## 4 2020 257.971 258.678 258.115 256.389 256.394 257.797 259.101 259.918 260.280
## 5 2019 251.712 252.776 254.202 255.548 256.092 256.143 256.571 256.558 256.759
## 6 2018 247.867 248.991 249.554 250.546 251.588 251.989 252.006 252.146 252.439
## Oct Nov Dec Annual
## 1 307.671 307.051 306.746 304.702
## 2 298.012 297.711 296.797 292.655
## 3 276.589 277.948 278.802 270.970
## 4 260.388 260.229 260.474 258.811
## 5 257.346 257.208 256.974 255.657
## 6 252.885 252.038 251.233 251.107
We will use Annual CPI index to make our visual story
head(df_fed_rate)
## DATE FEDFUNDS
## 1 1954-07-01 0.80
## 2 1954-08-01 1.22
## 3 1954-09-01 1.07
## 4 1954-10-01 0.85
## 5 1954-11-01 0.83
## 6 1954-12-01 1.28
head(df_pop16above)
## Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct
## 1 1997 202285 202389 202513 202674 202832 203000 203166 203364 203570 203767
## 2 1998 204238 204400 204547 204731 204899 205085 205270 205479 205699 205919
## 3 1999 206719 206873 207036 207236 207427 207632 207828 208038 208265 208483
## 4 2000 211410 211576 211772 212018 212242 212466 212677 212916 213163 213405
## 5 2001 213888 214110 214305 214525 214732 214950 215180 215420 215665 215903
## 6 2002 216506 216663 216823 217006 217198 217407 217630 217866 218107 218340
## Nov Dec
## 1 203941 204098
## 2 206104 206270
## 3 208666 208832
## 4 213540 213736
## 5 216117 216315
## 6 218548 218741
Here population is given in thousands and population in January might be considered as the population at the start of each year. And any change for one year can be calculated from Jan to jan for one year. To get the unemployment rate, we need to divide the total unemployment by the population.
df_cpi1 <- df_cpi|>
filter(Year >= 1997)|>
select(Year, Annual)
head(df_cpi1)
## Year Annual
## 1 2023 304.702
## 2 2022 292.655
## 3 2021 270.970
## 4 2020 258.811
## 5 2019 255.657
## 6 2018 251.107
Plot of Annual CPI index
ggplot(data = df_cpi1, aes(x=Year, y= Annual))+
geom_line()+
labs(
title = "Plot of Annual CPI index for the period 1997-2023",
x="Year", y="Annual CPI"
)
It can be seen that from 2020 onwards the Annual CPI index curve is steeper which indicates the infaltion rate has become higher and unbearable in the recent past. Poor have difficulty to survive and everybody is facing inflation as tough to tackle.
Fed Funds Rate (FRED)
df_fed_rate$DATE = as.Date(df_fed_rate$DATE)
df_fed<-df_fed_rate|> filter(DATE >= as.Date('1997-01-01'))
head(df_fed)
## DATE FEDFUNDS
## 1 1997-01-01 5.25
## 2 1997-02-01 5.19
## 3 1997-03-01 5.39
## 4 1997-04-01 5.51
## 5 1997-05-01 5.50
## 6 1997-06-01 5.56
ggplot(df_fed, aes(x=DATE, y=FEDFUNDS))+
geom_line()+
labs(
title = "Plot showing the FED FUND RATE from 1997 to 2023",
x='DATE',
y="FRED"
)
The plot shows some cycle and tells us whenever the inflation is higher, the Fed Fund rate is raised to curb the inflation. There is appears some seasonality like in 10 - 15 years this phenomenon is repeated.
df_pop <- df_pop16above|> select(Year, Jan)
df_unemp<- df_unemployment|>select(Year, Jan)
df_comb <- merge(df_pop, df_unemp, by="Year")
colnames(df_comb)<-c("Year", "Population", "Unemployment")
df_comb
## Year Population Unemployment
## 1 1997 202285 7933
## 2 1998 204238 7069
## 3 1999 206719 6604
## 4 2000 211410 6316
## 5 2001 213888 6647
## 6 2002 216506 9051
## 7 2003 219897 9395
## 8 2004 222161 9144
## 9 2005 224837 8444
## 10 2006 227553 7608
## 11 2007 230650 7649
## 12 2008 232616 8221
## 13 2009 234739 13009
## 14 2010 236832 16147
## 15 2011 238704 14937
## 16 2012 242269 13541
## 17 2013 244663 13181
## 18 2014 246915 10855
## 19 2015 249723 9498
## 20 2016 252397 8309
## 21 2017 254082 8149
## 22 2018 256780 7189
## 23 2019 258239 7140
## 24 2020 259502 6504
## 25 2021 260851 10851
## 26 2022 263202 7207
## 27 2023 265962 6378
Now we can easily find the unemployment rate
df_unemp_rate <- df_comb|> mutate( Unemp_rate = Unemployment/Population)
ggplot(df_unemp_rate, aes(x=Year, y=Unemp_rate))+
geom_line()+
labs(
title = "Plot of Unemployment rate for the period 1997-2023",
x="Year",
y="Unemployment Rate"
)
It can be seen that the unemployment rate is being curbed. Thus, it can be concluded that BIden Administration is working to put the inflation down and intends to provide emplyment.