Blog Archives

Integrating PHP and R

August 18, 2010
By
Integrating PHP and R

“How can I integrate PHP and R?” I know I’m not the only one who’s asked this question. After all, with great content management systems like Drupal, it would very cool to be able to drop an R module into some PHP code and instantly have a web app popping out some snazzy looking ggplot

Read more »

Introducing visualVaR.com

August 13, 2010
By
Introducing visualVaR.com

After a month of on-again, off-again coding, I’ve finally completed a web site geared towards calculating the Value at Risk of the average investor’s portfolio. The site is visualvar.com. The big idea was to combine the statistical and visualization tools of R (especially ggplot2) with the web interface of Drupal. While I’m

Read more »

Save R plot as a BLOB

July 30, 2010
By

I recently posed a question on stackoverflow on whether anyone knew an efficient way to save an R plot to a MySQL database as a BLOB. My plan was to use my personal desktop to perform R routines and save them to a web server, where they could then be accessed and displayed on

Read more »

The only thing smiling today is Volatility

May 21, 2010
By
The only thing smiling today is Volatility

With the stock market freaking out and all, I figured I should take a look at how volatility was being priced in the option market. The CBOE generously provides snapshots of market data for anyone interested to download. By using this data, we can calculate the markets ‘implied volatility’, or level of ‘freaking

Read more »

Basket Option Pricing: Step by Step

May 8, 2010
By
Basket Option Pricing: Step by Step

I find options fascinating because they deal with the abstract ideas of volatility and correlation, both of which are unobservable and can often seem like wild animal spirits (take the current stock market as an example). Understanding these subtle concepts is never easy, but it is essential in pricing some of the more exotic

Read more »

5 Minute Analysis in R: Case-Shiller Indices

April 29, 2010
By
5 Minute Analysis in R: Case-Shiller Indices

The Case-Shiller Home Price Indices measure residential home values for 20 cities in the US, with some indices going all the way back to the 80s. With housing prices all the rage these days, we should perform a quick-and-dirty analysis using R to see what we can glean from this rich dataset. First things

Read more »

Fun with the Vasicek Interest Rate Model

April 22, 2010
By
Fun with the Vasicek Interest Rate Model

A common model used in the financial industry for modelling the short rate (think overnight rate, but actually an infinitesimally short amount of time) is the Vasicek model. Although it is unlikely to perfectly fit the yield curve, it has some nice properties that make it a good model to work with. The

Read more »

R Command Line

April 16, 2010
By
R Command Line

I am an R user! And I see a whole army of R users, here in defiance of tyranny. You’ve come to use R as free men… and free men you are. What will you do with that freedom? Will you use R? Use R and you may use the command line. Use SAS,

Read more »

Gravity Game in R

April 8, 2010
By
Gravity Game in R

So why should R only be used for ’serious’ stuff? No longer! I’ve written the following code in R which executes a little gravitational physics game. The goal of the game is simple. You supply a velocity and direction to a spaceship with the goal of getting the ship to the

Read more »

CLT Standard Normal Generator

April 2, 2010
By
CLT Standard Normal Generator

I’ve found this standard normal random number generator in a number of places, one of which being from one of Paul Wilmott’s books. The idea is that we can use the Central Limit Theorem (CLT) to easily generate values distributed according to a standard normal distribution by using the sum of 12 uniform random

Read more »