Direct comparison
Z-Test vs T-Test: Which One to Actually Use
The z-test needs a known population SD, which real research never has. The t-test is right at every n, and "n over 30 means use z" is folklore, not a rule.
Ask about Z-Test vs T-Test: Which One to Actually Use
Answers are drawn from this comparison and the rest of the CASRAI corpus, with a link to every source.
Answers are AI-generated from CASRAI’s own published pages and can be wrong, so check the linked sources before relying on one; your question is logged without personal data — never sold, never used to train a third-party model — to show us what CASRAI is missing, so please do not type personal or confidential details. How we use this
How do Z-test (for a mean), t-test (for a mean), Z-test for proportions compare side by side?
The table below compares Z-test (for a mean), t-test (for a mean), Z-test for proportions across 17 procurement-relevant dimensions, from bottom line through where each one came from.
Side-by-side comparison
| Dimension | Z-test (for a mean) | t-test (for a mean) | Z-test for proportions |
|---|---|---|---|
| Bottom line | A teaching device and a large-sample approximation. It is correct only when you already know the population standard deviation as a fixed constant — which, in applied research, you essentially never do. | The default for comparing means, and the correct choice at every sample size, because it is built for exactly the situation you are always in: the standard deviation is estimated from your data. | Genuinely standard practice, and not a weaker version of the t-test. For a proportion the null hypothesis itself fixes the variance, so nothing is estimated in the denominator and the normal distribution really is the right reference. |
| What you must know before you start | The population standard deviation, sigma, as a known constant supplied from outside the data — not calculated from the sample you are testing. | Nothing beyond the data. The sample standard deviation, s, is computed from the same sample that produced the mean. | Only the null proportion p0. The variance p0(1 - p0)/n follows from it automatically, because a Bernoulli variable has a variance that is a fixed function of its mean. |
| Test statistic | (sample mean - mu0) divided by sigma/sqrt(n). | (sample mean - mu0) divided by s/sqrt(n). Two-sample forms replace the denominator with a pooled standard error, or a Welch standard error when the group variances differ. | (p-hat - p0) divided by the square root of p0(1 - p0)/n. The two-sample form pools the two samples into a single proportion under the null before computing the standard error. |
| Reference distribution | Standard normal. There are no degrees of freedom because there is no estimated nuisance parameter to pay for. | Student's t with n - 1 degrees of freedom, or the Welch-Satterthwaite degrees of freedom for unequal variances. The extra weight in the tails is precisely the price of having estimated s. | Standard normal, as a large-sample approximation to a binomial distribution. It is exact only in the limit, which is why the expected-count check below exists. |
| Degrees of freedom to report | None. A z statistic carries no df. | Always. Report t(29) = 2.00, never a bare t = 2.00 — without the degrees of freedom the statistic cannot be converted to a p-value and the result is unreproducible. | None. Report the raw counts and both proportions instead, since those are what a reader needs to recompute the test. |
| Two-sided 5% critical value | 1.9600 at every sample size, forever. | 2.5706 at df = 5; 2.2281 at df = 10; 2.0452 at df = 29; 2.0003 at df = 60; 1.9840 at df = 100; 1.9623 at df = 1000. It approaches 1.9600 from above but never reaches it at any finite sample size. | 1.9600, provided the expected-count condition holds. |
| Small-sample behaviour | It understates uncertainty. If the data are normal and you use plus or minus 1.96 against a standard deviation you actually estimated, the true two-sided error rate is 10.7% at n = 6, 8.2% at n = 10 and 6.0% at n = 30 — all against a nominal 5%. | Exact for normally distributed data at any n, including n = 3. The widened critical value is exactly the correction those inflated error rates are missing. | It degrades when expected counts are small, but for an unrelated reason: the binomial is discrete and skewed near 0 or 1. Nothing is being estimated, so this is an approximation problem, not a nuisance-parameter problem. |
| The "n greater than 30" rule of thumb | This is where the folk rule comes from, and it is a rule of thumb, not a rule. At exactly n = 30 the z critical value still delivers a real error rate of 5.97% — roughly 19% more false positives than the 5% you asked for. | Correct at n = 30, correct at n = 3, correct at n = 30,000. There is no sample size at which switching to z makes the answer more accurate; the switch only ever makes it less accurate by a shrinking amount. | Has its own thresholds, and they are about counts rather than n. Check that n times p0 and n times (1 - p0) are both at least 10 — a sample of 500 with p0 = 0.005 fails despite n being enormous. |
| When the difference stops mattering | The t critical value is within 5% of 1.96 by about df = 25, within 2% by df = 60, and within 1% by df = 120. The practical gap closes well before anyone would call the sample large. | The same fact seen from the interval side: at df = 120 a t-based confidence interval is 1.0% wider than a z-based one, and at df = 300 it is 0.4% wider. Since software computes the exact t value at no cost, taking the approximation buys nothing. | Not the same question. A proportions z-test is not converging toward some better test — it is already the standard method, and its refinement is a better interval, not a different distribution. |
| Effect on the confidence interval | Interval is the mean plus or minus 1.96 times sigma/sqrt(n). Too narrow by construction whenever sigma was in fact estimated, which understates uncertainty in exactly the direction that flatters your result. | Interval is the mean plus or minus t* times s/sqrt(n). At n = 30 that is 4.3% wider than the z interval; at n = 6 it is 31% wider. That extra width is not conservatism, it is the correct coverage. | The textbook Wald interval for a proportion is known to under-cover, sometimes badly near 0 or 1. Wilson or Agresti-Coull intervals are preferred and are what most current software reports by default. |
| Assumptions that still apply | The sampling distribution of the mean must still be normal — either because the population is normal or because n is large enough for the central limit theorem. Knowing sigma does not exempt you from this. | Approximate normality of the population (or an n large enough for the central limit theorem), independent observations, and — for the pooled two-sample form only — equal group variances. Welch drops that last one and costs almost nothing. | Independent observations, a sample size fixed in advance, and adequate expected counts. Clustered, paired or repeated observations break it outright and need McNemar or a mixed model instead. |
| What to use when the assumptions fail | There is no repair, because the premise is the problem. Estimate the standard deviation from the data and use t. | Wilcoxon signed-rank or Mann-Whitney for small non-normal samples, a bootstrap interval when the shape is awkward, or a trimmed-mean or robust test for heavy tails. | The exact binomial test for one sample, Fisher exact test for a 2x2 table, or a chi-square test with a continuity correction. Note that the pooled two-sample z statistic squared equals the uncorrected Pearson chi-square for the same table. |
| What the software actually ships | Base R's stats package provides t.test(), prop.test(), binom.test() and chisq.test() — and no z.test() for a mean at all; you need a contributed package to get one. SciPy has ttest_1samp and ttest_ind but no one-sample z-test for a mean. SPSS offers a One-Sample T Test and no z equivalent in its menus. That absence is the discipline's verdict, not an oversight. | t.test() in R; scipy.stats.ttest_1samp, ttest_ind and ttest_rel in Python; Analyze then Compare Means in SPSS. It is the default everywhere because it is the case that occurs. | prop.test() and binom.test() in R; statsmodels.stats.proportion.proportions_ztest and binomtest in Python; the crosstabs and nonparametric menus in SPSS. |
| Where a z statistic really does appear in published work | Wald z values in logistic regression and other generalised linear model output, the normal approximation to the Wilcoxon and Mann-Whitney tests, log-rank and Mantel-Haenszel tests, and the pooled estimates in meta-analysis. In all of these the normal reference is a large-sample asymptotic result — not a claim that anyone knows sigma. | Almost every reported comparison of two means in the applied literature, and every regression coefficient in ordinary least squares output. | Any comparison of rates or percentages: response rates, adverse event rates, survey proportions, pass and fail counts, conversion between two arms. |
| A single worked contrast | A statistic of 2.00 read against the standard normal gives p = .046. Significant at the .05 level. | The same statistic of 2.00 from a sample of 30, read against t with 29 degrees of freedom, gives p = .055. Not significant. One number, two verdicts, at exactly the sample size the folk rule says the distinction has stopped mattering. | Not applicable — a proportions test has no competing t version to disagree with. |
| How to report it | z = 2.00, p = .046, alongside the estimate and its interval. No degrees of freedom. | t(29) = 2.00, p = .055, with the mean difference, its 95% confidence interval, and an effect size such as Cohen d. Report the exact p, not just a threshold verdict. | Both counts and both proportions, the difference between them with a Wilson interval, and the exact p-value. Percentages without denominators are not reportable. |
| Where each one came from | The older and simpler construction. It is introduced first because the normal distribution needs no degrees of freedom, which makes the logic of a test statistic visible before the extra machinery arrives. It is scaffolding, and it is worth keeping in mind that scaffolding is not the building. | Derived by William Sealy Gosset, publishing as “Student” in 1908, precisely because the small samples he worked with as a brewer made the known-sigma assumption useless. The t-test exists because the z-test did not fit real data. | A separate lineage entirely, arising from the normal approximation to the binomial rather than from any attempt to patch the z-test for a mean. |
Common questions
Common questions about Z-test (for a mean) vs t-test (for a mean) vs Z-test for proportions
Is "use a z-test when n is greater than 30" actually a rule?
+
No. It is a rule of thumb from the era of printed statistical tables, and it answers a question nobody has any more. When the population standard deviation is unknown — which is the situation in essentially all real research — the t-test is correct at every sample size, including n = 500 and n = 5,000. The rule of thumb only ever meant that above about 30 the two answers are close enough that reading the wrong table will rarely change your conclusion. Even that is generous: at exactly n = 30 the z critical value produces a real error rate of 5.97% against a nominal 5%, about 19% more false positives than advertised. Modern software computes the exact t value for free, so the approximation has no remaining advantage to trade against.
If the t-test is always correct, why is the z-test still taught?
+
Two reasons, both legitimate. First, it isolates the logic of hypothesis testing. With sigma known there is one source of uncertainty rather than two, so a student can see how an estimate, a standard error and a reference distribution fit together without also absorbing degrees of freedom. Second, the z-test is the limiting case that explains why the t distribution exists at all: the gap between them is exactly the cost of estimating the standard deviation, and watching that gap shrink as df grows makes the whole idea concrete. Neither reason implies you should run one on real data.
When is a z-test genuinely the standard method?
+
For proportions, and for large-sample tests where the normal distribution arises asymptotically rather than by assumption. The proportions case is the clean one: because a Bernoulli variable has variance p(1 - p), a null hypothesis about the proportion also fixes the variance, so nothing has to be estimated in the denominator and there is no nuisance parameter to pay for with degrees of freedom. That is a real structural difference from the mean case, not a convention. Beyond proportions, z statistics appear routinely as Wald tests in logistic regression and other generalised linear models, in the normal approximations to rank-based tests, and in log-rank, Mantel-Haenszel and meta-analytic pooling.
Does the choice ever actually change a conclusion?
+
Yes, and most often right around the boundary where people assume it has stopped mattering. A statistic of 2.00 from a sample of 30 gives p = .046 against the standard normal and p = .055 against t with 29 degrees of freedom — significant one way, not significant the other, at exactly the n = 30 the folk rule points to. At smaller n the divergence is much larger: a statistic of 2.00 from a sample of 10 gives p = .077 under t, against .046 under z. The direction of the error is always the same, which is what makes it worth caring about: using z when you estimated the standard deviation makes results look more significant and intervals look more precise than the data support.
Is there a t-test for proportions?
+
No, and the reason is worth understanding rather than memorising. The t distribution exists to account for the extra uncertainty introduced when you estimate a standard deviation separately from the mean. For a proportion there is no separate standard deviation to estimate — the variance is determined by the proportion itself. There is therefore nothing for a t correction to correct. When a proportions test is unreliable it is because the normal approximation to a discrete, skewed binomial has broken down at small expected counts, and the fix for that is an exact method: the binomial test for one sample, or the Fisher exact test for a 2x2 table.
Why does logistic regression output report z values when linear regression reports t?
+
Because the two models pay for their variance estimates differently. In ordinary least squares the residual variance is a genuine free parameter estimated from the data, so the coefficient tests carry degrees of freedom and are referred to a t distribution. In logistic regression the variance of a binary outcome is a function of its mean, so there is no separate dispersion parameter to estimate, and the coefficient tests are large-sample Wald tests referred to a standard normal. It is the same structural distinction that makes the proportions z-test correct — visible in the software output if you know to look for it.
Do I need a large sample for a t-test to be valid?
+
No. The t-test is exact for normally distributed data at any sample size — that is the entire point of what Gosset derived. What a large sample buys you is robustness to non-normality, via the central limit theorem, which is a different guarantee about a different assumption. So the two questions are separate: sample size governs how much the normality assumption matters, while the known-versus-estimated standard deviation governs whether you use t or z at all. Confusing the two is what produces the "n greater than 30" folklore in the first place.
What if I genuinely do know the population standard deviation?
+
Then a z-test is correct, and the situation is rare enough to be worth stating what it looks like: a measurement instrument with a manufacturer-certified, independently established precision; a process under long-run statistical control with a well-characterised historical sigma; or a simulation study where you set the parameter yourself. The test to apply is whether the value came from outside the sample you are analysing. A standard deviation calculated from a large pilot study is still an estimate, and treating it as known reintroduces the same understated uncertainty in a less visible form.
Going deeper








