R code for Test Analytics