One-Sample T-Test Calculator - p-Value, CI and Power

    Test a sample mean against a target, a label or a norm. Paste the data or type mean, SD and n to get t, p, the confidence interval, Cohen's d, Hedges' g and the n needed for 80% power.

    Parameters

    Enter data for calculations

    Only the boxes for your choice appear

    The mean you test against

    Decide it before you see the data

    Also sets the confidence level

    Form progress0 / 4 fields

    💡 Fill in all required fields to unlock the calculate button

    One-sample t-test against a label, a target or a norm

    Ten boxes of cereal labeled 12 oz average 11.916 oz on a kitchen scale. That is 0.084 oz short, less than one percent, and the question is whether it is a real underfill or the luck of ten boxes. The calculator answers with t = -5.273 and a one-sided p = 0.0003, then adds the confidence interval, Cohen's d, Hedges' g and the sample size a test of this effect would need for 80% power. It takes either the raw measurements or a mean, a standard deviation and a sample size from a report.

    Problem: a small gap and a small sample

    A shortfall of 0.084 oz means nothing by itself. If box weights normally swing by half an ounce, ten boxes will often land that far below 12 by chance. If they swing by a twentieth of an ounce, as these do (sample standard deviation 0.0504 oz), the same gap is far outside what chance produces. Comparing the gap with the spread by eye does not work, because what matters is the spread of the average, which shrinks with every box you add.

    Solution: measure the gap in standard errors

    The standard error puts the gap on a scale. For the cereal it is 0.0504 / √10 = 0.0159 oz, and the average sits 5.27 of those below 12. Student's t distribution with 9 degrees of freedom turns that distance into the p-value.
    The interval says how short. The two-sided 95% interval for the true mean runs from 11.88 to 11.952 oz, so the fill is plausibly between 0.048 and 0.12 oz under the label.
    Nothing is assumed for you. The form refuses to run until you pick the alternative hypothesis and the significance level, because a default two-sided 0.05 quietly changes p for anyone who needed something else.

    Six choices, in the order the form asks

    1. How you enter the sample - raw measurements when you have every value, or the mean, standard deviation and sample size from a report or a spreadsheet summary.
    2. Measurements - numbers separated by spaces, commas or new lines, with a dot for decimals and no thousands separators. At least 2, up to 5,000.
    3. Mean, standard deviation, sample size - for the second option. The standard deviation must be the sample one, divided by n - 1, which is what STDEV.S in Excel and sd() in R return.
    4. Reference value - the number you test against: a label weight, a specification, a published norm, last year's average. Fix it before looking at the data.
    5. Alternative hypothesis - two-sided when any difference matters, one-sided (greater or less) only when the direction was decided in advance, as with an underfill check.
    6. Significance level - 0.05 as the usual threshold, 0.01 when a false alarm is expensive, 0.10 for a first screening. Read t, p and the interval in the result.

    Four outcomes, from p and d together

    A p-value answers whether the gap could be chance. Cohen's d, the gap divided by the standard deviation, answers whether it is large. The result shows both, and the four combinations call for different conclusions.

    What the result shows Reading Next step
    p below alpha, |d| of 0.5 or moreA real and sizeable differenceReport the interval, not just the p-value
    p below alpha, |d| under 0.2Real, but small enough to be irrelevantJudge the gap in your own units
    p above alpha, |d| of 0.5 or moreInconclusive: the sample is too smallCollect the n shown for 80% power
    p above alpha, |d| under 0.2No sign of a difference worth findingStop, or check the interval width

    Five samples tested against a fixed number

    A 100 microliter pipette. Twelve dispenses average 99.62 with a standard deviation of 0.41. Two-sided: t = -3.211, p = 0.0083, 95% interval 99.3595 to 99.8805. The pipette delivers a little less than its setting, and the whole interval sits below 100.
    Support tickets against a 4-hour target. Thirty tickets average 4.35 hours, SD 1.2, tested one-sided for "greater than 4": t = 1.598, p = 0.0605. Not significant at 0.05, d = 0.29, and the result says about 75 tickets would give an 80% chance of confirming a gap this size.
    A class average against a benchmark of 70. Twenty-five students average 73.1, SD 9.8: t = 1.582, p = 0.1268, interval 69.0548 to 77.1452. The benchmark is inside the interval, so the class cannot be called above it yet.
    Before and after, as differences. Eight people improve by 2.1, -0.4, 1.8, 3.0, 0.9, 1.5, -0.2 and 2.4 points. Testing these differences against 0 is the paired t-test: mean 1.3875, t = 3.240, p = 0.0142, interval 0.3749 to 2.4001.
    A huge survey. Twenty thousand scores average 100.3 against a norm of 100, SD 15: t = 2.828, p = 0.0047, yet d = 0.02. Significant, and a note in the result warns that three tenths of a point is unlikely to matter.

    How many measurements a given effect needs

    The last tile of the result is the sample size that gives an 80% chance of a significant result if the true effect equals the d you observed. It comes from the noncentral t distribution, the same calculation power software runs, not from a rule of thumb.

    Effect size d Two-sided, alpha 0.05 One-sided, alpha 0.05 Two-sided, alpha 0.01
    0.2 (small)199156296
    0.39071134
    0.5 (medium)342751
    0.8 (large)151222
    1.010816

    Critical t, for checking a result by hand

    A two-sided test is significant when |t| exceeds the value in the row for n - 1 degrees of freedom. The cereal's t of -5.273 clears 2.262 easily; a one-sided test at 0.05 uses the 0.10 column.

    Degrees of freedom alpha 0.10 alpha 0.05 alpha 0.01
    16.31412.70663.657
    52.0152.5714.032
    91.8332.2623.250
    151.7532.1312.947
    241.7112.0642.797
    301.6972.0422.750
    601.6712.0002.660
    1201.6581.9802.617

    What readers ask about the one-sample t-test

    When should I use a z-test instead?
    Only when the population standard deviation is known in advance rather than estimated from your sample, which is rare outside textbooks and quality control with a long history. With an estimated SD the t distribution is the right one, and above about 120 degrees of freedom the two give practically the same critical value (1.980 against 1.960).
    Is a paired t-test the same as a one-sample t-test?
    Yes, once you subtract. Compute each person's after minus before and test those differences against 0. The before-and-after example above is exactly that, with t = 3.240 on 7 degrees of freedom.
    Why is my one-sided p close to 1?
    Because the sample mean landed on the other side of the reference value. A test for "greater than 4" with a mean of 3.8 cannot be significant however strong the evidence for "less", and the result prints a note saying so instead of halving the two-sided p.
    What is the difference between Cohen's d and Hedges' g?
    Both divide the gap by the standard deviation. With few measurements d overstates the effect a little, and g multiplies it by a correction factor that is about 0.91 for 10 measurements and close to 1 above 50. In the cereal example d = -1.67 and g = -1.52.
    What if my data are skewed?
    With 30 or more measurements the test tolerates moderate skew. With fewer, one extreme value can drive the result, and the calculator flags a skewness of 1 or more in a short list. The Wilcoxon signed-rank test on the same values, against the same reference, is the usual check.

    Related tools

    Two-Sample T-Test Calculator

    Compare two groups, or before and after on the same people, with Welch, Student or the paired test - See calculator

    P-Value Calculator

    Turn a t printed in a paper or a printout into a p-value, or look up the critical t for any alpha - See calculator

    Wilcoxon Test Calculator

    The rank-based alternative when a short list is skewed or has an outlier - See calculator

    Z-Score Calculator

    Place one value against a mean and SD, or flag outliers in the list before testing it - See calculator

    Coefficient of Variation Calculator

    Relative spread in percent, useful when comparing precision across scales - See calculator

    Interquartile Range Calculator

    Quartiles and outlier fences for the same measurements - See calculator

    Standard Deviation Calculator

    Sample and population SD, the number the t statistic divides by - See calculator

    Average Calculator

    Mean, median and weighted average of a list - See calculator

    Similar calculators from this section