T-Test Calculator

This professional t test calculator performs one-sample, two-sample (independent, Welch or pooled), and paired t-tests. It instantly returns the t-statistic, degrees of freedom, p-value (one- or two-tailed), confidence interval, and effect sizes. Ideal for students, researchers, and data professionals who need accurate, reproducible results with accessible UX.

Data Source and Methodology

Authoritative reference: NIST/SEMATECH e-Handbook of Statistical Methods, Section 1.3.5 (t distribution), continuously updated.

Supplementary: W. S. Gosset (“Student”), 1908, “The probable error of a mean,” Biometrika 6(1), 1–25; and standard statistical texts (e.g., J. Zar, Biostatistical Analysis).

Tutti i calcoli si basano rigorosamente sulle formule e sui dati forniti da questa fonte.

The Formula Explained

One-sample t-test:

Inline: \( t = \dfrac{\bar{x} - \mu_0}{s / \sqrt{n}} \), degrees of freedom \( \nu = n - 1 \).

Two-sample pooled (equal variances):

\[ s_p^2 = \frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}, \quad SE = s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}, \quad t = \frac{(\bar{x}_1 - \bar{x}_2) - \Delta_0}{SE}, \quad \nu = n_1 + n_2 - 2. \]

Two-sample Welch (unequal variances):

\[ SE = \sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}, \quad t = \frac{(\bar{x}_1 - \bar{x}_2) - \Delta_0}{SE}, \quad \nu \approx \frac{SE^4}{\dfrac{(s_1^2/n_1)^2}{n_1-1} + \dfrac{(s_2^2/n_2)^2}{n_2-1}}. \]

Paired t-test (on differences \(d_i = x_i - y_i\)):

\[ \bar{d} = \frac{1}{n}\sum d_i,\quad s_d = \sqrt{\frac{1}{n-1}\sum (d_i-\bar{d})^2},\quad t = \frac{\bar{d} - \mu_\Delta}{s_d/\sqrt{n}},\quad \nu = n-1. \]

Two-sided confidence interval for the mean (or mean difference) \(\theta\):

\[ \theta \in \hat{\theta} \pm t_{1-\alpha/2,\,\nu} \times SE. \]

Glossary of Variables

  • n, n1, n2: sample sizes.
  • μ₀, Δ₀, μΔ: null-hypothesized mean or mean difference.
  • x̄, x̄₁, x̄₂: sample means; s, s₁, s₂: sample standard deviations.
  • sp: pooled standard deviation (equal variances assumption).
  • t: t-statistic; ν: degrees of freedom; p-value: tail probability under H₀.
  • SE: standard error of the statistic; CI: confidence interval.
  • Cohen’s d/Hedges’ g: standardized mean difference effect sizes.

How It Works: A Step-by-Step Example

Suppose we compare two independent groups with unequal variances (Welch). Group A: n₁=10, x̄₁=22.1, s₁=1.8. Group B: n₂=12, x̄₂=20.3, s₂=2.1. We test H₀: Δ₀ = 0 at 95% confidence, two-tailed.

  1. Compute SE: \( SE=\sqrt{s_1^2/n_1 + s_2^2/n_2}=\sqrt{1.8^2/10 + 2.1^2/12}\approx 0.86 \).
  2. t-statistic: \( t = (22.1 - 20.3 - 0)/0.86 \approx 2.09 \).
  3. Degrees of freedom via Satterthwaite: \( \nu \approx 19.7 \) (calculator uses full precision).
  4. Two-tailed p-value: p ≈ 0.049.
  5. CI: \( (x̄_1-x̄_2) \pm t_{0.975,\nu}\cdot SE \). With \( t_{0.975,\nu}\approx 2.09 \), CI ≈ [0.01, 3.59].
  6. Effect size (Hedges’ g using pooled SD): g ≈ 0.95 (small/medium/large depends on context).

Frequently Asked Questions (FAQ)

What is the difference between pooled and Welch t-tests?

Pooled assumes equal variances and uses a common pooled SD, giving more power if true. Welch does not assume equal variances and is robust when variances or sample sizes differ. Welch is recommended by default.

Which tail should I choose?

Two-tailed detects differences in either direction. One-tailed tests only in a specified direction; use one-tailed only with a strong, pre-specified directional hypothesis.

How are p-values computed?

We compute the cumulative distribution function of Student’s t with the appropriate degrees of freedom using the regularized incomplete beta function; then we derive one- or two-tailed p-values accordingly.

What if my standard deviation is zero?

If SD is zero, the sample has no variability and the standard error is zero; the t-statistic is undefined. Add more data or verify inputs.

Are the results rounded?

Internal computations use double precision. Displayed results are rounded for readability but copy/export preserves sufficient significant digits.

Do I need normal data?

The test assumes the sampling distribution of the mean is approximately normal. For small samples with non-normal data or heavy outliers, consider nonparametric tests like Wilcoxon signed-rank or Mann–Whitney.

Can I paste data from spreadsheets?

Yes. Paste columns or comma/space/newline separated values into the text areas; the parser ignores blank lines and extra spaces.

Strumento sviluppato da Ugo Candido,. Contenuti verificati da,.
Last reviewed for accuracy on: .