Lattice Explore Bonds

December 16, 2011
By

(This article was first published on Timely Portfolio, and kindly contributed to R-bloggers)

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 http://timelyportfolio.blogspot.com/search/label/bonds for all my posts on bonds.

R code from GIST:

To leave a comment for the author, please follow the link and comment on his blog: Timely Portfolio.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



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.