What is the difference between a t-test and a z-test?

The main difference between a z-test and a t-test comes down to what you know about the population you are studying. You use a z-test when you know the population's standard deviation or when you have a very large sample size (typically 30 or more). You use a t-test when the population standard deviation is unknown and you are working with a small sample size (fewer than 30). <br><br> Think of it like packing for a trip. If you know exactly what the weather will be like (a known population standard deviation), you can pack the perfect sized suitcase (a z-test). But if you are only guessing based on a quick look at the forecast (an unknown standard deviation estimated from a small sample), you need to pack a few extra layers just in case. The t-test provides that mathematical "extra layer" of buffer for uncertainty.

What is a z-test?

A z-test is a statistical test used to determine whether two population means are different when the variances are known and the sample size is large. The test statistic follows a standard normal distribution (a bell curve). In practice, you use a z-test if your sample size n30n \ge 30, or if by some rare chance you actually know the true standard deviation (σ\sigma) of the entire population.

What is a t-test?

A t-test is used when the population standard deviation is unknown and you must estimate it using your sample's standard deviation (ss). Because estimating from a small sample introduces more uncertainty, the t-test relies on the Student's t-distribution. This distribution looks like a bell curve but has "fatter tails," meaning it requires stronger evidence to declare a significant difference. You use a t-test when your sample size n<30n < 30 and σ\sigma is unknown.

Why does the sample size matter?

Sample size is the dividing line because of the Law of Large Numbers. As your sample size gets larger (specifically past 30), your sample standard deviation (ss) becomes a highly accurate estimate of the population standard deviation (σ\sigma). As nn increases, the t-distribution mathematically morphs until it is virtually identical to the z-distribution. For small samples, though, that estimation is shaky, and the t-test corrects for that shakiness.

Where students slip

The most common mistake is looking at a word problem, seeing the words "standard deviation," and immediately assuming it's the population standard deviation (σ\sigma). Read carefully! If the problem says "a sample of 15 students had a mean of 80 and a standard deviation of 5," that 5 is the sample standard deviation (ss). Because n=15n=15 (which is less than 30) and you only have ss, you must use a t-test.

Worked through

A teacher wants to know if her class of 25 students scored significantly differently on a standardized test compared to the historical average score of 75. The historical population standard deviation is unknown. Her current class has a sample average of 78 with a sample standard deviation of 6. Which test should she use, and what is the test statistic?

First, we identify our variables. The population mean μ=75\mu = 75. The sample size n=25n = 25. The sample mean xˉ=78\bar{x} = 78. The sample standard deviation s=6s = 6. Because the population standard deviation is unknown and the sample size is small (n<30n < 30), she must use a t-test. The formula for the test statistic is t=(xˉμ)/(s/n)t = (\bar{x} - \mu) / (s / \sqrt{n}). Plugging in our numbers: t=(7875)/(6/25)t = (78 - 75) / (6 / \sqrt{25}). This simplifies to t=3/(6/5)t = 3 / (6 / 5), which is t=3/1.2t = 3 / 1.2. The final test statistic is t=2.5t = 2.5.

Questions students ask

Ask about this topic

Where this comes from: OpenStax Introductory Statistics · Khan Academy: Significance tests (hypothesis testing)

See also