Thursday, December 20, 2012

Shiny/R Conversion of Another One of My Favorite Mike Bostock d3 Examples

Mike Bostock has revolutionized visualization with his d3 and his seemingly infinite examples.  In another adaptation of his amazing work, I will adapt one of my favorite examples to supplement the interactive scatterplot with data supplied by R through Shiny.  Often in finance, we will use a scatterplot to explore the relationship between different asset classes or risk exposures.  This exploration becomes much more deep and meaningful when we can interact in real-time with the plot.

I thought using the technique to look at the monthly returns of Vanguard funds representing different exposures would be helpful.  A clear linear relationship immediately shows up between the equity funds (VFINX-Vanguard S&P 500, VDMIX-Vanguard Developed Markets, and VEIEX-Vanguard Emerging Markets).  Also, we can see the very beneficial effect of VBMFX-Vanguard Total US Bond throughout what we know was a tumultuous period.

Live example hosted at Glimmer (IE does not correctly render IFRAME below)

Code at Github

1 comment:

  1. Respected Sir,

    Let me first congrats & thank you for your
    wonderful post .sir my name is amit,from india, i am a
    R&D.professional,i also wanna to learn analytics for trading,please
    guide me how& where to start from scratch as i am novice in this field
    .your little guidance will change the life of many layman like me.

    sir i can offer free on/offline assistance to any assignment.

    Warm Regards