Formula for test statistic for hypothesis tests