R scripts for the http://arxiv.org/abs/1404.5544 paper