How To Calculate Test Statistic In R