Skip to content

Instantly share code, notes, and snippets.

@AricLux
Created October 24, 2020 19:54
Quarterly CAPE and 1 Year Earnings Growth
## QUARTERLY CAPE RATIO AND 1-YEAR EARNINGS GROWTH ----
data_3 <- na.omit(cbind(data.1yr$CAPE, data.1yr$`1 Earnings Growth`))
data_3 <- to.quarterly(data_3, OHLC = FALSE)
dates <- as.yearqtr(as.character(index(data_3)))
df_3 <- data.frame(cbind(coredata(data_3), dates))
colnames(df_3) <- c("CAPE", "Annualized", "Dates")
ggplot(df_3, aes(x = CAPE, y = Annualized)) +
geom_point(size = 2, color = "grey30") +
stat_smooth(method = lm, se = FALSE, color = "navy", size = 1) +
ggtitle("CAPE v. 1 Year Earnings Growth") +
xlab("CAPE Ratio") +
ylab("1 Year Earnings Growth")
model.3 <- lm(data_3$X1.Earnings.Growth ~ data_3$CAPE)
summary(model.3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment