2 min read

Buffett Indicator - Stock Valuations

One of the may indicators for increasing stock valuations beyond their norm is the so-called “Buffett Indicator.” The measure and namesake is derived from none-other than the Omaha Oracle, Warren Buffett. Mr. Buffett has a long history of value investing through his firm Berkshire Hathaway.

In order to evaluate discounts or deals within the market, a generalized measure was created to evaluate how ‘expensive’ the current marketplace is relative to the total aggregate production measure by U.S. Gross Domestic Product (GDP).

options(stringsAsFactors = F)
setwd(paste0(Sys.getenv("HOME"), "/R/2018/Buffet-Indicator"))

pks <- c("reshape2", "tidyverse", "tidyquant", 
         "lubridate", "ggplot2", "scales", "viridis")
invisible(lapply(pks, require, character.only = T))

tickers <- c("WILL5000PRFC", "GDP", "NCBEILQ027S")

d_recessions <- read.table(textConnection(
  "Peak, Trough
  1857-06-01, 1858-12-01
  1860-10-01, 1861-06-01
  1865-04-01, 1867-12-01
  1869-06-01, 1870-12-01
  1873-10-01, 1879-03-01
  1882-03-01, 1885-05-01
  1887-03-01, 1888-04-01
  1890-07-01, 1891-05-01
  1893-01-01, 1894-06-01
  1895-12-01, 1897-06-01
  1899-06-01, 1900-12-01
  1902-09-01, 1904-08-01
  1907-05-01, 1908-06-01
  1910-01-01, 1912-01-01
  1913-01-01, 1914-12-01
  1918-08-01, 1919-03-01
  1920-01-01, 1921-07-01
  1923-05-01, 1924-07-01
  1926-10-01, 1927-11-01
  1929-08-01, 1933-03-01
  1937-05-01, 1938-06-01
  1945-02-01, 1945-10-01
  1948-11-01, 1949-10-01
  1953-07-01, 1954-05-01
  1957-08-01, 1958-04-01
  1960-04-01, 1961-02-01
  1969-12-01, 1970-11-01
  1973-11-01, 1975-03-01
  1980-01-01, 1980-07-01
  1981-07-01, 1982-11-01
  1990-07-01, 1991-03-01
  2001-03-01, 2001-11-01
  2007-12-01, 2009-06-01"), sep=',',
  colClasses=c('Date', 'Date'), header=TRUE)
d_stock <- tq_get(x = tickers[1], get = "economic.data", from="1971-01-01")%>%
  na.omit()%>%
  mutate(report_freq = ifelse(date < 1979-12-01, "monthly", "daily"), 
         qtr_dt = as.yearqtr(date, "%Y-%m-%d"))%>%
  group_by(qtr_dt)%>%
  summarise(qtr_value_willshire = mean(price))%>%
  ungroup()


d_gdp <- tq_get(x = tickers[2], get = "economic.data", from="1971-01-01")%>%
  mutate(qtr_dt = as.yearqtr(date, "%Y-%m-%d"))%>%
  group_by(qtr_dt)%>%
  summarise(qtr_value_gdp = mean(price))%>%
  ungroup()

d_fed_assets <- tq_get(x = tickers[3], get="economic.data", from="1971-01-01")%>%
  mutate(qtr_dt = as.yearqtr(date, "%Y-%m-%d"))%>%
  group_by(qtr_dt)%>%
  summarise(qtr_value_z1 = mean(price)/10^3)%>%
  ungroup()


d_full <- d_gdp%>%
  inner_join(., d_stock, by=c("qtr_dt"="qtr_dt"))%>%
  inner_join(., d_fed_assets, by = c("qtr_dt"="qtr_dt"))%>%
  mutate(willshire_val_ratio = qtr_value_willshire/qtr_value_gdp, 
         z1_val_ratio = qtr_value_z1/qtr_value_gdp)
p1_recession <- subset(d_recessions, Peak >= min(d_full$qtr_dt))
d_p1 <- d_full%>%
  select(qtr_dt, contains("ratio"))%>%
  melt(., id.vars = "qtr_dt")


p1 <- ggplot(d_p1)+
  geom_line(aes(x = qtr_dt, y = value, color = variable), size = 1.25)+
  scale_x_yearqtr()+
  scale_y_continuous(labels=percent)+
  scale_color_viridis_d(labels = c("Wilshire/GDP", "Non-Financial Corp Liabilities/GDP"))+
  geom_line(aes(x = qtr_dt, y = mean(value)), linetype = 2, color = "red")+
  geom_smooth(aes(x = qtr_dt, y = value), method = "auto", formula = y~x)+
  geom_rect(data = p1_recession, aes(xmin = as.yearqtr(Peak), 
                                     xmax = as.yearqtr(Trough), ymin = -Inf, ymax = +Inf),
            fill = 'dodgerblue1', alpha = 0.3)+
  labs(title = "Buffet Indicator Ratio", 
       x = NULL, 
       y = "Ratio of the: Willshire 5000 / GDP", 
       caption = "NBER, Federal Reserve, St. Louis, Tables: WILL5000PRFC, GDP, NCBEILQ027S")+
  theme_minimal()+
  theme(legend.position = "top", 
        legend.title = element_blank())
p1