Skip to content

Instantly share code, notes, and snippets.

@mbusigin
Last active December 12, 2015 02:39
Show Gist options
  • Save mbusigin/4700714 to your computer and use it in GitHub Desktop.
Save mbusigin/4700714 to your computer and use it in GitHub Desktop.
CP/GDP vs future CP growth
dlag = function(p, k = 1)
{
return( lag(Delt(p, k=k), k=-k) )
}
getSymbols( c("CP", "GDP"), src="FRED" )
layout(1:2)
a = na.omit(merge(CP/GDP*100, dlag(CP, k=4*5)*100))
names(a) = c("Corp Profits as % of NGDP", "Next 5y Corp Profit Growth")
scatter.smooth(a)
abline(v= 8.324985, lty=2)
abline(h= 46.22570, lty=2)
title("Yes, Profits/GDP suggest reduction in Profit Growth...")
a = na.omit(merge(Delt(CP, k=4*5)*100, dlag(GSPC[,6], k=260)*100))
names(a) = c("5y Corp Profit Growth", "Next 1y SPX Performance")
scatter.smooth(a)
title("...but that's actually positively correlated with stock performance!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment