Lattice Explore Bonds

December 16, 2011

[This article was first published on Timely Portfolio, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Since my fifth most popular post has been Bond Market as a Casino Game Part 1, I thought I would use Vanguard Total US Bond Market mutual fund (VBMFX) monthly returns to build our skills in the lattice R package and help visualize the unbelievable run of U.S. bonds (Calmar Ratio 1.37 over the past 20 years).

Although I have primarily graphed with R base graphics, PerformanceAnalytics charts, and ggplot, the lattice package provides an extremely powerful set of charting tools.

We can start with a basic qqplot of the entire set of monthly returns.

From TimelyPortfolio

Then, we can group by year.

From TimelyPortfolio

Or, we can also very easily split each year into its own panel.

From TimelyPortfolio

Here is a little different look with a density plot.

From TimelyPortfolio

Now let’s build boxplots and dotplots.

From TimelyPortfolio

Add an annual dotplot to a boxplot for the entire period.

From TimelyPortfolio

Or we can add a boxplot for each year.

From TimelyPortfolio

See for all my posts on bonds.

R code from GIST:

To leave a comment for the author, please follow the link and comment on their blog: Timely Portfolio. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , ,

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)