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-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,ecdf, trading) and more...








Zero Inflated Models and Generalized Linear Mixed Models with R.
Zuur, Saveliev, Ieno (2012).