# Monthly Archives: March 2013

## Create an R package from a single R file with roxyPackage

March 5, 2013
By

Documenting code can be a bit of a pain. Yet, the older (and wiser?) I get, the more I realise how important it is. When I was younger I said 'documentation is for people without talent'. Well, I am clearly loosing my talent, as I sometimes struggle to understand what I programmed years ago. Thus, anything that soothes the...

## Visualizing neural networks from the nnet package

March 4, 2013
By

Neural networks have received a lot of attention for their abilities to ‘learn’ relationships among variables. They represent an innovative technique for model fitting that doesn’t rely on conventional assumptions necessary for standard models and they can also quite effectively handle multivariate response data. A neural network model is very similar to a non-linear regression

## Cluster Risk Parity back-test

March 4, 2013
By

In the Cluster Portfolio Allocation post, I have outlined the 3 steps to construct Cluster Risk Parity portfolio. At each rebalancing period: Create Clusters Allocate funds within each Cluster using Risk Parity Allocate funds across all Clusters using Risk Parity I created a helper function distribute.weights() function in strategy.r at github to automate these steps.

## 2013 World Universities Ranking

March 4, 2013
By

The Times Higher Education (http://www.timeshighereducation.co.uk) released its World Reputation Ranking. The ranking employs survey consultation among invited-only academics to measure reputation among several universities. It is assumed to be the world’s largest opinion survey of this sort across the globe. Every year, a list of the top 100 most powerful university brands is released. Despite

## Tapping the FourSquare Trending Venues API with R

March 4, 2013
By

I came up with the following function to tap into the FourSquare trending venues API: library("RCurl", "RJSONIO")   foursquare<-function(x,y,z){ w<-paste("https://api.foursquare.com/v2/venues/trending?ll=",x,"&radius=2000&oauth_token=",y,"&v=",z,sep="") u<-getURL(w) test<-fromJSON(u) locationname="" lat="" long="" zip="" herenowcount="" likes="" for(n in 1:length(test$response$venues)) { locationname = test$response$venues]$name lat = test$response$venues]$location$lat long = test$response$venues]$location$lng zip = test$response$venues]$location$postalCode herenowcount<-test$response$venues]$hereNow$count likes<-test$response$venues]$likes$count xb<-as.data.frame(cbind(locationname, lat, long, zip, herenowcount, likes)) } xb$pulled=date() return(xb)

## Track the bookies’ favourites for the next Pope

March 4, 2013
By

Tired of manually running a python script to scrape the latest bookmaker odds on the next Pope, R user AJ (an analytical research manager at a large healthcare company) instead created an R script to track the odds on the Papal successor, and automated it with the Shiny package for R. The screenshot below shows the odds of each...

## Revolution Analytics News Roundup

March 4, 2013
By

Between the Strata conference and various announcements, last week was certainly a busy one for the crew here at Revolution Analytics. So I thought I'd take the opportunity to catch you up on some of the recent media articles you might have missed: The Wall Street Journal interviewed our new VP of Services Neera Talbert on the trend towards...

## Great Infographic

March 4, 2013
By

This is a really great exposition on an infographic. Note that the design elements and "chart junk" serve to better connect and communicate the data to the viewer. The choice not to go with pie charts for the first set of plots is a good one. The drawbacks of polar representations of proportions is very

## Pricing of a financial product : A pricer of a call option.

March 4, 2013
By

The financial market is not only made of stock options. Other financial products enable market actors to target specific aims. For example, an oil buyer like a flight company may want to cover the risk of increase in the price of oil. In this case it i...