R code for AMO ROIC computations