code for O'Neill et al. 2013