R and latex code for a paper in progress with Iñaki Permanyer