Background

The Federal Reserve’s mandate from Congress is to control inflation and to maintain low unemployment. These seem to be contradictory objectives.

For this story you will need to source the following data for the last 25 years;

The Consumer Price Index (CPI) (Bureau of Labor Statistics)

The FED Funds Rate (FRED) (Federal Reserve Board)

Unemployment Rate (Bureau of Labor Statistics) Your Data Visualizations should be designed to answer the question “Has the FED been able to fulfill the mandate given to it by Congress?”

Using the Fredr Restfulapi to collect data from the last 25 years

all_options <- fredr_series_search_text(
  search_text = "unemployment",
  limit = 100L
)
# getting Unemployment Rate data
unrate_data <- fredr(
  series_id = "UNRATE",
  observation_start = as.Date("1999-01-01"),
  observation_end = as.Date("2024-01-01"))

# getting the Inflation Rate
inflation_data <- fredr(
  series_id = "FPCPITOTLZGUSA",
  observation_start = as.Date("1999-01-01"),
  observation_end = as.Date("2024-01-01"))

# getting the Consumer Price Index (CPI) data
cpi_data <- fredr(
  series_id = "CPIAUCNS",
  observation_start = as.Date("1999-01-01"),
  observation_end = as.Date("2024-01-01"))

# getting the Federal Funds Rate data
fed_funds_data <- fredr(
  series_id = "FEDFUNDS",
  observation_start = as.Date("1999-01-01"),
  observation_end = as.Date("2024-01-01")
)

Find the overall range of values across all every dataframe

overall_range <- range(unrate_data$value, inflation_data$value, fed_funds_data$value)

# Plotting trends of Economic Indicators 
plot(unrate_data$date, unrate_data$value, type = "l", col = "blue", xlab = "Date", ylab = "Value", main = "Trends of Economic Indicators", ylim = overall_range)
lines(inflation_data$date, inflation_data$value, col = "orange")
lines(fed_funds_data$date, fed_funds_data$value, col = "green")
lines(cpi_data$date, cpi_data$value, col = "red")

legend("topright", legend = c("Unemployment Rate", "Inflation Rate", "Federal Funds Rate"), 
       col = c("blue", "orange", "green"), lty = 1, cex = 0.8)

# Adding grid for better indication of where points cross
grid()

## separate plot for cpi
plot(cpi_data$date, cpi_data$value, type = "l", col = "red", xlab = "Date", ylab = "Value", main = "Trends of CPI")

# Adding grid
grid()

Upon examining the line chart depicting the trends of economic indicators, a notable observation emerges: as the Unemployment Rate fluctuates, there appears to be an inverse relationship with the Inflation Rate; when one increases, the other tends to decrease, and vice versa. This observation prompts further investigation into the intricate dynamics between unemployment and inflation and their potential impact on each other. Additionally, the separate plot illustrating the trends of the Consumer Price Index (CPI) reveals a consistent upward trajectory over the past 25 years, suggesting a positive linear relationship with time. This finding implies a gradual increase in the overall price level, highlighting the need for a deeper exploration of economic factors influencing inflation over time.

# Create a new graphics window
par(mfrow = c(1, 2))  # Set up a 1x2 layout for plots

# Scatter plot of Unemployment Rate vs. Inflation Rate
plot(unrate_data$date, unrate_data$value, type = "l", col = "blue", xlab = "Date", ylab = "Unemployment Rate", main = "Unemployment vs. Inflation Rate")
points(inflation_data$date, inflation_data$value, col = "orange")

# Scatter plot of Federal Funds Rate vs. Inflation Rate
plot(fed_funds_data$date, fed_funds_data$value, type = "l", col = "green", xlab = "Date", ylab = "Federal Funds Rate", main = "Federal Funds vs. Inflation Rate")
points(inflation_data$date, inflation_data$value, col = "orange")

# Reset the graphics window layout
par(mfrow = c(1, 1))

Interpretation

The scatter plot of Unemployment Rate vs. Inflation Rate highlights notable fluctuations in both indicators(2008 being the housing market recession). Around 2020(COVID), a spike in unemployment coincided with a temporary increase in inflation, suggesting a potential relationship between economic downturns and inflationary pressures. Similarly, the rapid decrease in unemployment post-2020 was followed by a temporary rise in inflation. This shows how changes in unemployment can affect inflation, highlighting the connection between these economic indicators.

Similarly, we observe a relationship between the Federal Funds Rate and the Inflation Rate. As the Federal Funds Rate increased, there was a corresponding increase in the Inflation Rate. The scatter plot illustrates this trend, with points clustering higher on the y-axis as the Federal Funds Rate rises. This suggests that changes in the Federal Funds Rate may influence inflationary pressures in the economy.Note that at around 2020 the inflation and Federal fund rate increased(COVID)

Regression analysis

# Merge the data frames based on date
merged_data <- merge(inflation_data, fed_funds_data, by = "date")

# Perform linear regression with the merged data
regression_model <- lm(value.x ~ value.y, data = merged_data)

summary(regression_model)
## 
## Call:
## lm(formula = value.x ~ value.y, data = merged_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.6206 -0.7600 -0.1934  0.4189  5.7469 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2.2454     0.4550   4.935 6.17e-05 ***
## value.y       0.1308     0.1710   0.765    0.452    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.644 on 22 degrees of freedom
## Multiple R-squared:  0.0259, Adjusted R-squared:  -0.01838 
## F-statistic: 0.585 on 1 and 22 DF,  p-value: 0.4525
# Plot the regression line
plot(value.x ~ value.y, data = merged_data,
     xlab = "Federal Funds Rate", ylab = "Inflation Rate", main = "Regression Analysis: Federal Funds Rate vs. Inflation Rate")
abline(regression_model, col = "red")

text(x = 0.03, y = 0.07, labels = paste("Inflation =", round(regression_model$coefficients[1], 2), "+", 
                                       round(regression_model$coefficients[2], 2), " * Federal Funds Rate"),
     adj = c(-0.1,1), col = "red")

Regression Analysis: Federal Funds Rate vs. Inflation Rate

The linear regression analysis was conducted to examine the relationship between the Federal Funds Rate and the Inflation Rate.

  • Interpretation: The intercept coefficient of 2.2454 represents the estimated Inflation Rate when the Federal Funds Rate is zero.
  • Federal Funds Rate Coefficient: The coefficient for the Federal Funds Rate is 0.1308, but it is not statistically significant (p = 0.452), suggesting a lack of significant linear relationship with the Inflation Rate.
  • Model Fit: The model explains only a small proportion of the variability in the Inflation Rate, with an R-squared value of 0.0259.
  • Conclusion: Based on the available data, the Federal Funds Rate has a small, positive rate with Inflation Rate.

Federal Funds Rate vs. Inflation Rate

merged_data <- merge(unrate_data, inflation_data, by = "date")

regression_model <- lm(value.x ~ value.y, data = merged_data)

summary(regression_model)
## 
## Call:
## lm(formula = value.x ~ value.y, data = merged_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.4382 -1.2647 -0.2525  0.8307  3.8816 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   6.4016     0.6523   9.814  1.7e-09 ***
## value.y      -0.2946     0.2212  -1.332    0.197    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.728 on 22 degrees of freedom
## Multiple R-squared:  0.07461,    Adjusted R-squared:  0.03254 
## F-statistic: 1.774 on 1 and 22 DF,  p-value: 0.1966
plot(value.x ~ value.y, data = merged_data,
     xlab = "Unemployment Rate", ylab = "Inflation Rate", main = "Regression Analysis: Unemployment Rate vs. Inflation Rate")
abline(regression_model, col = "red")

text(x = 3, y = 8, labels = paste("Inflation =", round(regression_model$coefficients[1], 2), "+", 
                                       round(regression_model$coefficients[2], 2), " * Unemployment Rate"),
     adj = c(-0.1,1), col = "red")

Regression Analysis: Unemployment Rate vs. Inflation Rate

The linear regression analysis was conducted to examine the relationship between the Unemployment Rate and the Inflation Rate.

  • Interpretation: The intercept coefficient of 6.4016 represents the estimated Inflation Rate when the Unemployment Rate is zero.
  • Unemployment Rate Coefficient: The coefficient for the Unemployment Rate is -0.2946, indicating that for every one unit increase in the Unemployment Rate, the Inflation Rate decreases by 0.2946 units.
  • Model Fit: The model explains only a small proportion of the variability in the Inflation Rate, with an R-squared value of 0.07461.
  • Conclusion: The negative coefficient for the Unemployment Rate suggests that there is a negative linear relationship with the Inflation Rate, although it is not statistically significant (p = 0.197). Thus, based on the available data, the Unemployment Rate alone may not be a strong predictor of changes in the Inflation Rate. However, it’s worth noting that despite the lack of statistical significance, the observed negative trend in the graph implies a potential correlation between the Unemployment Rate and the Inflation Rate. This visual observation hints at the possibility of an underlying relationship between these economic indicators, which may warrant further exploration and analysis

This analysis indicates that while there appears to be a negative relationship between the Unemployment Rate and the Inflation Rate, further investigation or consideration of additional variables may be necessary to better understand the factors influencing changes in the Inflation Rate.

Conclusion

Based on the negative coefficient observed in the linear regression model between the Unemployment Rate and the Inflation Rate, it appears that the Federal Reserve has not been entirely successful in fulfilling the mandate given to it by Congress. This is primarily due to the contradictory nature of the tasks assigned, where efforts to control inflation and maintain low unemployment can have adverse effects on each other. Therefore, the Federal Reserve faces challenges in effectively balancing the dual mandate of controlling inflation and maintaining low unemployment.