A hypothesis test asks whether sample evidence is strong enough to reject a claimed parameter value. The test statistic measures how far the sample sits from the claim in standard-error units, and the p-value converts that distance into a probability.
One-Sample Z Test:z = (xbar - mu_0) / (sigma / sqrt(n)) - Tests a sample mean against a null mean when population sigma is known.
Standard Error of xbar:SE_xbar = sigma / sqrt(n) - Standard deviation of the sampling distribution of the sample mean.
A factory claims its parts weigh 50 g on average, with a known population standard deviation of 5 g. A sample of 30 parts has a mean weight of 52 g. Test the claim at the 5% significance level with a two-tailed test.
Inputs. Sample mean 52, claimed mean 50, sigma = 5, n = 30, two-tailed.
The sample mean sits 2.19 standard errors above the claimed mean, and a gap that large would appear in fewer than 3% of samples if the claim were true, so the claim is rejected at the 5% level.
Frequently asked questions
When do I use a z-test instead of a t-test?
Use a z-test when the population standard deviation sigma is known, as in the worked example above. When sigma is unknown and estimated from the sample, use a t-test with n - 1 degrees of freedom, which has heavier tails to account for the extra uncertainty.
What does the p-value mean?
It is the probability of seeing a test statistic at least as extreme as the one observed if the null hypothesis were true. In the example, p = 0.0285 is below the significance level of 0.05, so the null hypothesis is rejected.
What are Type I and Type II errors?
A Type I error rejects a null hypothesis that is actually true (a false positive); its probability is the significance level alpha. A Type II error fails to reject a null hypothesis that is actually false (a miss); its probability is beta, and 1 - beta is the power of the test.