Calculation of Test Statistic