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 first, the data needs to be downloaded from S&P’s website, converted into a CSV format, and then imported into R.
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 dynamics of the Vasicek model are describe below.
Read the rest of this entry »
It’s less than a week to go until Ubuntu 10.04 (Lucid Lynx) arrives. This release will be a Long Term Supported version and initial reviews have found it to be the best release yet!
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, and you’ll use a GUI… at least for a while. And dying in your beds, many years from now, would you be willing to trade ALL the GUIs, from this day to that, for one chance, just one chance, to come back here and tell our enemies that they may take our lives, but they’ll never take… OUR COMMAND LINE!
So how can a drunkard walking down the street lead to such a scary sounding thing like ‘Stochastic Calculus‘? Under certain conditions and taking the continuous limit, the Drunkard’s Walk becomes Brownian Motion. I’ll try to show you how this all happens using a little bit of JavaScript. In the Drunkard’s Walk, we assumed that with each step the drunkard takes he moves a distance of 1 foot to either the left or right. Its natural to wonder if something interesting would happen if we scaled this distance and took many more steps. As a matter of fact, something interesting does happen!
Read the rest of this entry »
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 winning area without crashing into a planet.
Read the rest of this entry »
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 variables and subtracting 6. In Excel, the implementation looks like this:
=RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()-6
By doing a simple cut-and-paste, we can stick this formula in an Excel cell and go on with our merry way assuming we have generated values from a standard normal distribution. But what is really going on here, and how good does this generator work?
Read the rest of this entry »
