Joining GDP and Market Returns

Introduction

In the preceding chapters, we wrangled change in GDP data from FRED and created a dataframe object to hold that data. Here is the object for a quick refresher.

change_gdp.head()
             title       date  percent_change
193  Change in GDP 2024-04-01           0.030
192  Change in GDP 2024-01-01           0.014
191  Change in GDP 2023-10-01           0.034
190  Change in GDP 2023-07-01           0.049
189  Change in GDP 2023-04-01           0.021

We also created data objects to hold our monthly and quarterly market returns.

sp_500_monthly.head()
        Date  prior_close  last_close       ret
0 1980-01-01     4.508338    4.876174  0.081590
1 1980-02-01     4.876174    4.895036  0.003868
2 1980-03-01     4.895036    4.415787 -0.097905
3 1980-04-01     4.415787    4.606669  0.043227
4 1980-05-01     4.606669    4.861180  0.055248

Now let’s put them together and explore how they might relate to one another.

Bucketed GDP and Market Returns

Imagine we were asked to hypothesize on the relationship between GDP growth in a quarter and market returns in that quarter? It makes sense that a growing economy leads to or is correlated with a growing stock market and we might expect a positive relationship between these two variables.

Here’s a quick look at whether market returns have been positive or negative during various buckets of GDP growth. No code yet, but we will learn how to build this chart.

Surprise GDP and Market Returns

Conclusion