The table below shows almost no correlation between stock returns and real GDP growth in the United States, and while the correlation grows as we look at GDP is subsequent quarters, it is still modest even four quarters ahead.
fred.get.series.f <- function(id, name){
require(httr)
require(jsonlite)
url <- "https://api.stlouisfed.org/fred/series/observations?"
r <- url %>%
GET(query = list(series_id=id, api_key=key, file_type="json")) %>%
content(as='text') %>%
fromJSON()
df <- r$observations %>% select(date,value)
df$value <- as.numeric(df$value)
df$date <- as.Date(df$date)
df <- df %>% filter(!is.na(value))
colnames(df)[2] <- name
df
}
real_gdp_stocks_corr=left_join(
fred.get.series.f("SPASTT01USM661N", "stocks") %>%
# https://fred.stlouisfed.org/series/SPASTT01USM661N
mutate(
date=tsibble::yearquarter(date),
stocks=round(100*(stocks/dplyr::lag(stocks,3)-1),5)/100
) %>%
group_by(date) %>% slice(n()) %>% ungroup,
fred.get.series.f("GDPC1", "real_gdp0") %>%
# https://fred.stlouisfed.org/series/GDPC1#0
mutate(
date=tsibble::yearquarter(date),
real_gdp0=round(100*(real_gdp0/dplyr::lag(real_gdp0,4)-1),1)/100
),
by = "date"
) %>% drop_na()
real_gdp_stocks_corr=real_gdp_stocks_corr %>% mutate(
real_gdp1=dplyr::lead(real_gdp0,1),
real_gdp2=dplyr::lead(real_gdp0,2),
real_gdp3=dplyr::lead(real_gdp0,3),
real_gdp4=dplyr::lead(real_gdp0,4)
) %>% drop_na
real_gdp_stocks_corr=real_gdp_stocks_corr %>%
select(-date) %>%
correlation
real_gdp_stocks_corr=real_gdp_stocks_corr %>%
filter(Parameter1=="stocks") %>%
select(real_gdp=Parameter2, corr=r)
# Correlation of Stock Return with % Change in GDP
real_gdp_stocks_corr %>%
mutate(corr=corr*100) %>%
mutate(
real_gdp=str_extract(real_gdp, "[[:digit:]]"),
real_gdp=case_when(
real_gdp == 0 ~ "Real GDP in quarter",
TRUE ~ paste0("Real GDP - ", real_gdp, " Qtr Lead")
)
) %>%
rename(
` `=real_gdp, # `Real GDP in quarter`
`Correlation`=corr
) %>% knitr::kable()
Correlation | |
---|---|
Real GDP in quarter | -4 |
Real GDP - 1 Qtr Lead | 8 |
Real GDP - 2 Qtr Lead | 23 |
Real GDP - 3 Qtr Lead | 29 |
Real GDP - 4 Qtr Lead | 28 |
In short, there is almost nothing of use to investors from poring over current macroeconomic data, which is one reason why markets have started ignoring them1. That may change, as the economy opens up again, and markets start looking at the data for cues on how quickly it is coming back to life.