When to Use Z-Test vs T-Test vs Chi-Square
Not sure which test to use? Compare the z-test, t-test, and chi-square test side by side. Decision rules, examples, and a quick flowchart.
Choosing the wrong statistical test is one of the most common mistakes in data analysis. This guide compares the three tests students encounter most — z-test, t-test, and chi-square — and gives you clear rules for picking the right one.
Quick Decision Table
| Question | Test | Example |
|---|---|---|
| Is this sample mean different from a known value? (σ known, large n) | Z-test | Is the average height of recruits different from 170 cm? |
| Is this sample mean different from a known value? (σ unknown or small n) | One-sample t-test | Do students at this school score differently from the national mean? |
| Are two group means different? | Two-sample t-test | Do men and women differ in reaction time? |
| Did a treatment change scores? | Paired t-test | Did the training program improve test scores? |
| Is there a relationship between two categorical variables? | Chi-square test | Is there an association between gender and voting preference? |
| Does observed data match expected frequencies? | Chi-square goodness of fit | Does a die roll follow a uniform distribution? |
The Z-Test
What it does
Compares a sample mean to a known population mean when you know the population standard deviation (σ).
Formula
When to use it
- Population σ is known (rare in practice)
- Sample size is large (n ≥ 30)
- Data is approximately normal (or n is large enough for CLT)
Real-world example
A factory produces bolts with a known σ = 0.5 mm. You sample 50 bolts and find = 10.2 mm. Are they different from the target μ = 10 mm?
Look up z = 2.83 in the Z-Table: p = 0.0023 (one-tailed) or 0.0046 (two-tailed). Reject H₀ at α = 0.05.
Tool
Use our Z-Score Calculator to compute z-values and look up probabilities.
The T-Test
What it does
Compares means when the population σ is unknown (the usual case). The t-distribution is wider than the z-distribution, accounting for extra uncertainty.
Three flavors
One-sample t-test:
Independent two-sample t-test:
Paired t-test:
When to use it
- Population σ is unknown (you estimate it from the sample)
- Comparing means (not proportions or frequencies)
- Data is continuous and approximately normal (or n > 30)
Real-world example
You want to know if a new drug lowers blood pressure. You test 20 patients (before and after):
- Mean difference: d̄ = −8.5 mmHg
- SD of differences: s_d = 6.2
- t = −8.5 / (6.2 / √20) = −8.5 / 1.387 = −6.13
- df = 19, critical t = 2.093
Result: |−6.13| > 2.093, so the drug significantly lowers blood pressure.
Tool
Our T-Test Calculator handles all three types with step-by-step output.
See also: How to Perform a Paired T-Test
The Chi-Square Test
What it does
Tests relationships between categorical variables (not means). There are two main types.
Chi-square test of independence
Tests whether two categorical variables are associated.
Where O = observed count, E = expected count.
Chi-square goodness of fit
Tests whether observed frequencies match expected frequencies.
When to use it
- Your data is categorical (counts/frequencies)
- You have a contingency table (rows × columns)
- Expected frequencies are ≥ 5 in each cell (rule of thumb)
Real-world example
Is there an association between smoking status and lung disease?
| Lung disease | No disease | Total | |
|---|---|---|---|
| Smoker | 90 | 60 | 150 |
| Non-smoker | 30 | 120 | 150 |
| Total | 120 | 180 | 300 |
Expected values: E = (row total × column total) / grand total
- E(Smoker, Disease) = 150 × 120 / 300 = 60
With df = (2−1)(2−1) = 1, look up in the Chi-Square Table: critical value at α = 0.05 is 3.841. Since 50 > 3.841, there is a significant association between smoking and lung disease.
Tool
Use the Bartlett’s Test Calculator for variance homogeneity checks or look up critical values in the Chi-Square Table.
Z-Test vs T-Test: What’s the Difference?
| Feature | Z-test | T-test |
|---|---|---|
| Population σ | Known | Unknown |
| Sample size | Usually large (n ≥ 30) | Any size |
| Distribution used | Standard normal (z) | t-distribution (wider tails) |
| Degrees of freedom | Not applicable | n − 1 (or pooled) |
| Use in practice | Rare | Very common |
Rule of thumb: If you don’t know σ, use a t-test. With large n, the t and z distributions converge, so the results will be nearly identical.
Decision Flowchart
-
What type of data do you have?
- Categorical (counts) → Chi-square
- Continuous (measurements) → Go to 2
-
How many groups?
- One group vs. known value → Go to 3
- Two groups → Go to 4
- Three or more groups → ANOVA (not covered here)
-
Do you know the population σ?
- Yes → Z-test
- No → One-sample t-test
-
Are the groups independent or paired?
- Independent → Independent t-test
- Paired/matched → Paired t-test
What About ANOVA?
If you’re comparing three or more group means, none of these tests work — you need ANOVA (Analysis of Variance). Running multiple t-tests inflates your Type I error rate. ANOVA compares all groups simultaneously using the F-distribution.
Summary
| Test | Data type | Compares | Key assumption |
|---|---|---|---|
| Z-test | Continuous | One mean vs. known value | σ known |
| T-test | Continuous | 1 or 2 means | σ unknown |
| Chi-square | Categorical | Frequencies / proportions | Expected counts ≥ 5 |
Related Reading
Free Statistics Cheat Sheet
Get the formulas, decision rules, and table values you actually need — in a single printable PDF. Join 1,000+ students and analysts.
No spam. Unsubscribe anytime.
Related Articles
Hypothesis Testing: A Beginner's Complete Guide
Learn hypothesis testing step by step, from formulating hypotheses to interpreting p-values and making conclusions.
The Normal Distribution Explained Simply
Everything you need to know about the normal distribution, the bell curve, and why it's so important in statistics.
How to Read Statistical Tables (Z, T, F, χ²)
Learn how to read a z-table, t-table, chi-square table, and F-table. Annotated examples show exactly where to look for critical values.