annotated R code for model performance testing