SP500vBAABond is a project mainly written in R, it's free.
Earnings yield on S&P500 vs the BAA Bond yield