Small formatting changes to adTestStatistic
Changed apply to getApplyFunction and lapply to getLApplyFunction throughout for speed.