Integrating Rickshaw, D3, and Middleman

01/13/13 23:33:00    

By Michael Mealling

Economics has always fascinated me enough to dabble in it. During my MBA one of my finance professors claimed that the GDP and DOW were correlated to the point that you could trade on it. Not a component of GDP, but the final GDP number itself. As things progressed in the class there was an additional claim that government spending was a good thing and that if you wanted to increase the DOW you should just increase government spending.

So, I decided to do the multiple regression analysis myself. And the things I found were surprising even to myself. I'm going to share some of that later once I finish the post. And that brings me to this article. Instead of just posting an article with a screenshot of an Excel graph I decided to turn it all into an interactive Javascript based project.

After poking into D3 a bit I decided to go with Rickshaw which is a layer above D3 that provides a lot of extra tools I need. Since D3 and Rickshaw require significant additional Javascript and CSS beyond what I'm using for Middleman's standard article I decided to break out of the blog metaphor and create a new page and layout. After that I had to get the data. The idea is to look at GDP component data, not just the final number. So I'm picking up the component data from the Bureau of Economic Analysis and the DOW data is coming from I clean them up and convert them to JSON as a Middleman task. The idea is to detect updated data and automatically update the data, regressions, and graphs.

Here's the result so far. Its just a basic Rickshaw demo but its loading the right stuff and loading my JSON file with the data. Next weekend I'll hookup each data series and adding in the recalculations. My eventual goal is using R to automatically recalculate the regression whenever new data comes out.

comments powered by Disqus