In: Statistics and Probability
There is no generic equation or formula to compute the test statistic. The test statistic depends on the hypothesis being tested and is calculated on the assumption that the null hypothesis is true. For example- If we are testing the null hypothesis about the mean of the population.
Then we either use the z-test or t-test depending on whether the population standard deviation is known or unknown respectively. For the z-test, the sample size must be large if there is no information about the distribution of the population.
So, since we are testing about the population mean the test statistic will be the standardized sample mean
The test statistic for z-test = (sample mean - population mean) / (standard deviation of population/ √sample size)
The test statistic for t-test = (sample mean - population mean) (standard deviation of sample / √sample size)
P-value defers under the following scenarios.
Right tailed test: P-value is the probability of obtaining a value as large or larger than the test statistic. If the p-value is larger than the significance level, then it indicates that null hypothesis is true.
Left tailed test: P-value is the probability of obtaining a value as small or smaller than the test statistic. If the p-value is larger than the significance level, then it indicates that the null hypothesis is true.
Two-tailed test: P-value is the probability of obtaining a value as extreme as the test statistic or the negative counterpart of the test statistic. If the p-value is larger than the significance level, then it indicates that the null hypothesis is true.