Z Test Calculator

T test calculator

=—
—
—
T-test calculator visualizationt distribution compared with the normal curve, with rejection regions and the t statistic

    The working, step by step

      In plain words

      Assumption check

        What Is a T-Test?

        A t-test is a hypothesis test that compares means when the population standard deviation is unknown and is estimated from the sample standard deviation (s), using Student's t-distribution.

        William Sealy Gosset developed the t-test in 1908 while checking the quality of stout at the Guinness Brewery in Dublin. Guinness did not allow staff to publish under their own names, so Gosset signed the paper "Student". The t-distribution looks like the normal curve with heavier tails, and the tails thin out as the sample grows.

        Types of T-Tests

        There are 3 types of t-tests.

        One-Sample T-Test

        A one-sample t-test compares one sample mean with a hypothesized value μ₀. Example: do 18 lab measurements with a mean of 52.1 differ from the target of 50?

        Independent Two-Sample T-Test (Student's and Welch's)

        An independent two-sample t-test compares the means of 2 separate groups. Student's version pools the two variances and assumes they are equal. Welch's version, proposed by Bernard Lewis Welch in 1947, drops that assumption and adjusts the degrees of freedom. This calculator runs Welch's test, the safer default.

        Paired T-Test

        A paired t-test compares 2 measurements on the same subjects by testing the mean of the differences. Example: blood pressure before and after a treatment in the same 16 patients.

        T-Test Formulas and Degrees of Freedom

        Each t-test divides a difference by its estimated standard error:

        Testt statisticDegrees of freedom
        One-sample(x̄ − μ₀) / (s / √n)n − 1
        Welch two-sample(x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂)Welch–Satterthwaite formula
        Student two-sample(x̄₁ − x̄₂) / (sp √(1/n₁ + 1/n₂))n₁ + n₂ − 2
        Pairedd̄ / (sd / √n)n − 1 (pairs)
        df_Welch = (s₁²/n₁ + s₂²/n₂)² / [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)]

        Assumptions of the T-Test

        The t-test needs 4 assumptions:

        1. Independent observations within each sample (and between groups for the two-sample test).
        2. Approximate normality of the data (or of the differences for a paired test), which matters most for n < 30.
        3. Continuous data measured on an interval or ratio scale.
        4. Equal variances for Student's pooled test only; Welch's test does not need equal variances.

        How to Use the T Test Calculator

        The t test calculator accepts 2 kinds of input.

        Using Raw Data

        To use raw data, choose the test type, select "Raw data" and paste the values. The calculator computes the mean, the SD and n for each sample and shows them under the input box. For a paired test, paste the before and after values in the same order.

        Using Summary Statistics (Mean, SD, n)

        To use summary statistics, select "Summary statistics" and type the mean, SD and sample size of each group (or d̄, sd and the number of pairs). Then enter the hypothesized value, choose the tail and set α.

        The graph draws the t curve over the normal curve with the rejection regions and the p-value area, so the heavier tails of small samples are visible.

        Interpreting T-Test Results

        Read a t-test result in 4 parts: the t statistic, the degrees of freedom, the p-value and the confidence interval. The t statistic shows the difference in standard-error units. The degrees of freedom set the shape of the t curve. The p-value shows how likely a difference this large is when H₀ is true. The confidence interval shows the plausible range of the true difference, and Cohen's d shows its size in SD units.

        T-Test Examples

        There are 3 worked examples below.

        Example 1: One-Sample

        18 measurements have x̄ = 52.1 and s = 6.4. Does the mean differ from 50?

        1. Standard error
          SE = 6.4 / √18 = 1.5085
        2. T statistic
          t = (52.1 − 50) / 1.5085 = 1.392, df = 17
        3. P-value
          two-tailed p = 0.1818
        4. Decision
          Fail to reject H₀: the data do not show a difference from 50.

        Example 2: Independent Samples With Unequal Variances

        Group 1: x̄₁ = 24.6, s₁ = 4.2, n₁ = 15. Group 2: x̄₂ = 21.3, s₂ = 5.1, n₂ = 14.

        1. Standard error
          SE = √(4.2²/15 + 5.1²/14) = 1.7418
        2. Welch df
          25.27
        3. T statistic
          t = 3.3 / 1.7418 = 1.895
        4. P-value
          two-tailed p = 0.0696
        5. Decision
          Fail to reject H₀ at α = 0.05.

        Example 3: Paired Before/After

        16 patients: mean change d̄ = 1.8 with sd = 3.1. Did scores rise?

        1. Standard error
          SE = 3.1 / √16 = 0.775
        2. T statistic
          t = 1.8 / 0.775 = 2.323, df = 15
        3. P-value
          right-tailed p = 0.0173 (two-tailed 0.0347)
        4. Decision
          Reject H₀: scores rose.

        T-Test vs. Z-Test

        Use a t-test when σ is estimated from the sample, and a z-test when σ is known. With large samples the two give nearly the same answer, since t* approaches z* = 1.96. Run z-tests for means and proportions with the Z Test Calculator.

        FAQs

        Should I always use Welch's t-test?

        Yes, Welch's t-test is the safer default for two independent groups. Welch's test performs almost as well as Student's test when variances are equal, and much better when they are not. Many statisticians recommend skipping a preliminary equal-variance check and using Welch's test directly.

        What if my data aren't normal?

        Non-normal data cause little trouble for t-tests with 30 or more observations per group, thanks to the Central Limit Theorem. For small, skewed samples, use a non-parametric test: the Wilcoxon signed-rank test (one-sample or paired) or the Mann–Whitney U test (two independent groups). Check whether two variances differ with the F test calculator.

        Can I run a t-test with fewer than 10 observations?

        Yes, a t-test works with very small samples when the data are close to normal. Gosset designed the test for samples as small as 4. Small samples detect only large effects, and the critical value is large: t* = 2.776 with 4 df. Look up t* for any df with the critical value calculator.

        How do I compare three or more groups?

        Use a one-way ANOVA to compare 3 or more group means. Running separate t-tests for every pair inflates the false-positive rate. Run the overall test with the ANOVA calculator.

        How do I report a t-test in APA format?

        Report a t-test as t(df) = value, p = value, with the means, SDs and an effect size. Example: "Scores rose after treatment (Md = 1.8, SD = 3.1), t(15) = 2.32, p = .035, d = 0.58." Calculate d with the effect size calculator.