cpp version of the mean difference statistic that is 27x faster than the R version