Thursday, February 28, 2013

Shading and Points with xtsExtra plot.xts

For some reason, I feel like have much better control with plot.xts function from the xtsExtra package described here over some of the other more refined R graphical packages. Maybe, it is just my simple mind, but recently I wanted to shade holding periods with points for buy and sale dates. With plot.xts from xtsExtra I was able to quickly and easily generate the following plot. I did have to slightly amend the original plot.xts function as seen here, but it seemed more natural and like much less of a struggle.

plot of chunk unnamed-chunk-1

I also enjoyed writing this post almost entirely in R markdown.

R code from Github:

Thursday, February 21, 2013

Additional Plots on French Breakpoints as Valuation

I feel like there might be some merit in Slightly Different Measure of Valuation using Ken French’s Market(ME) to Book(BE) Breakpoints by percentile to offer an additional valuation metric for US stocks.  I thought some additional plots might help me flesh out the concept.  This plot struck me as particularly helpful.

From TimelyPortfolio

In the next iteration, I hope to add a look at prospective drawdown or returns.  However, I struggle since the last 30 years all have basically exhibited historical overvaluation.  Since 1926, no period of overvaluation has lasted longer than 14 years except the last 30.

Thanks to the post from http://timotheepoisot.fr/2013/02/17/stacked-barcharts/ which helped me use much more appealing colors than the default lattice set.


R code from GIST:

Wednesday, February 20, 2013

Another Way to Look at Vanguard and Pimco

I like the results of the analysis shown in my post Applying Tradeblotter’s Nice Work Across Manager Rather than Time, but I was not satisfied that the plot allowed a quick summary comparison of the two massive fund complexes.  I am much more pleased with this Ecdf plot from the HMisc package.

From TimelyPortfolio

R code at GIST:

Tuesday, February 19, 2013

Onepager Now with knitR

Since at some point I had trouble with a conflict between knitr and the latex package textpos, I used the lesser Sweave in Another Experiment with R and Sweave.  I ran the Sweave2knitr command and discovered that textpos and knitr play well together now.  Here is the result using knitr (go to https://www.box.com/s/4nftk6qpa0cugapmncsn if the embed does not show below):

.rnw source file from Gist

Tuesday, February 12, 2013

Another Experiment with R and Sweave

The R package PApages is a great start towards addressing the very common problem of internal and external reporting in the money management industry.  Advent's APX, Axys, and Black Diamond and the up and coming extremely well-connected and well-funded Addepar provide basic and acceptable reporting but generally don’t provide the full set of risk and return metrics that I would expect.  Since the very successful GSOC projects with PerformanceAnalytics …Now With More Bacon (2008)! and New Attribution Functions for PortfolioAnalytics, we have a comprehensive and robust set of risk, return, and attribution measures in R.  Combined with the near limitless graphical abilities of R with xtsExtra, ggplot, lattice, and base graphics, R seems to offer one of the best platforms for reporting, so I’ve committed myself to continue my series http://timelyportfolio.blogspot.com/search/label/reporting exploring various reporting options in R.

This is a fairly crude sketch of something we can accomplish easily with R, Sweave, and PerformanceAnalytics.  I hope to itergreat to something a little more compelling.  If the embedded pdf does not work below, please see at https://www.box.com/s/xpfn3rjwwmv8aftmkbyi.

R Sweave file from GIST:

Sunday, February 3, 2013

Japanese Government Bonds (JGB) Total Return Series

In a follow up to Yen and JGBs Short-Term vs Long Term and a series of posts on Japan, I thought the Bloomberg article "Japan Pension Fund’s Bonds Too Many If Abe Succeeds, Mitani Says" was particularly interesting.  It is difficult to find a total return series for the JGBS, so here is an example of how we might construct it in R with the JGB 9 year. Using the 9 year gets us about a decade more data than the 10 year.  The calculation is not perfect but it gets us very close.

The Japanese Pension Fund (GPIF) has been spoiled by a very pleasant ride with their JGBs.

From TimelyPortfolio

R code from GIST:

Friday, February 1, 2013

Yen and JGBs Short-Term vs Long Term

I have read some articles arguing that the recent move in the Japanese Yen is overdone.  However, considering the short-term without regard to the long-term context is naïve and potentially dangerous.  Although I do not have significant proof, I believe long-term mean reversion can completely dominate short-term mean reversion hopes.  Just to provide some longer-term context, I thought I would offer some graphical aids.

From TimelyPortfolio

In my mind, the Yen selloff is only in its infancy.  For the move to truly engage, I think we need Japanese Government Bond (JGB) yields to move higher also, and if it does we are in a different paradigm than the last 20 years.  But, what do I know?

R code from GIST: