Understand the idea
This is the simplest member of the t-test family: you have one group of measurements and one specific number you want to compare it against: a target, a known industry benchmark, a value from a previous study. The test asks whether your sample's average is plausibly consistent with that reference value, or whether it differs enough that chance alone is an unlikely explanation.
Cohen's d turns the raw difference into a standardized number (how many standard deviations away from the reference the sample mean sits), using the same negligible/small/medium/large benchmarks (.2/.5/.8) as the two-sample version of this test. The confidence interval is arguably the more useful number to actually quote: it tells you the RANGE of true population means still consistent with your data, which is a much richer statement than 'significant' or 'not significant'.
Choosing the direction of the test (does the sample mean differ from the target in EITHER direction, or specifically ABOVE it, or specifically BELOW it) has to happen BEFORE looking at the data. Picking whichever direction happens to match what you already see in your sample after the fact effectively doubles your true false-positive rate, even though the reported p-value would not reflect that.
The one-sample t-test, also called a single sample t-test, is a t-test against a target: it compares one group's mean with a fixed value you name in advance.
Practitioner explanation
KernelStats computes t = (x-bar - mu0)/(s/sqrt(n)) via scipy.stats.ttest_1samp, with Cohen's d = (x-bar - mu0)/s. A genuinely careful edge case: when sd is exactly 0 but the mean happens to equal mu0 exactly, d=0 is reported as the mathematically correct value; but when sd is 0 and the mean differs from mu0, d is reported as UNDEFINED (None) rather than a misleadingly 'negligible' zero, a deliberate, documented distinction between two genuinely different degenerate cases rather than collapsing them into the same (wrong) answer.
The reported confidence interval is ALWAYS the conventional TWO-SIDED interval, labeled as such, regardless of which alternative hypothesis direction was chosen; a one-tailed test still reports the one-tailed p-value alongside the two-sided CI. The product states this explicitly as a convention difference from R: R's t.test(x, alternative='greater') instead prints a one-SIDED bound of the form [L, infinity), so the two tools' output will not numerically match on a one-tailed run, and this difference is stated directly as a convention choice, not a computational disagreement about the underlying data.
Beyond the ordinary assumption checks (Shapiro-Wilk for 3<=n<=5000, with Anderson-Darling becoming the primary verdict above n=5000 where Shapiro is skipped), the card reports a minimum detectable effect (MDE) at 80% power, the smallest standardized effect size this particular sample size COULD have reliably detected, computed purely from n/alpha/sidedness and explicitly NEVER from the observed effect (the product's own module documentation states directly why no 'observed/post-hoc power' figure is reported: it would be a one-to-one, uninformative function of the p-value already obtained, exactly the post-hoc power fallacy).
When to use it
Consider it when
You have one continuous variable and a specific hypothesized reference value (a known population mean, an industry benchmark, a target), and want to know whether your sample's mean is plausibly consistent with that reference.
Use caution when
The data are severely non-normal at a small sample size (use the Wilcoxon signed-rank test against mu0 instead), you have two related measurements to compare rather than one measurement against a fixed reference (use the paired t-test), or you intend to choose the test direction (greater/less/two-sided) AFTER looking at which direction the sample happens to favor.
Formulas and symbols
One-sample t statistic
mu0 the hypothesized population mean; s the sample standard deviation; df = n-1.
Cohen's d (one-sample)
Standardized distance from the reference value. Undefined (not zero) when s=0 and the mean differs from mu0.
Minimum detectable effect at 80% power
Depends only on sample size, alpha, and one- vs. two-sidedness, never on the observed effect, deliberately avoiding the post-hoc power fallacy.
Assumptions and checks
- Independence of observations. Correlated observations (repeated measurements on the same unit, or a time-ordered series) make the standard error too small, so the p-value is too small and the confidence interval too narrow, regardless of what the normality check shows.
In KernelStats: Not checkable from the data alone: it is a property of how the data were collected.
- Normality (of residuals, not of the raw data). At small n, strong skew or outliers distort both the p-value and the confidence interval; at moderate to large n the Central Limit Theorem makes the test fairly robust.
In KernelStats: Shapiro-Wilk for 3 <= n <= 5000, and Anderson-Darling for n >= 8 (becoming the primary verdict above n = 5000, where Shapiro-Wilk is skipped), both reported directly on the card.
Alternatives
- Wilcoxon Signed-Rank Test. Normality is clearly violated at a small sample size, or the response is ordinal rather than a continuous interval measurement.
- Paired t-Test. You have two related measurements on the same units (before/after) rather than one measurement compared against a fixed external reference value.
- Power & Sample Size. You are planning a future one-sample t-test and want to determine the sample size needed to detect a specific effect, rather than analyzing already-collected data.
Worked example
Scenario
Testing whether the average resting heart rate of 60 patients differs from a clinical benchmark of 72 bpm.
Result
t(59) = 2.84, p = .006, mean = 75.1 bpm, 95% CI [72.9, 77.3], Cohen's d = 0.37 (small-to-medium).
Interpretation
The sample mean is significantly above the 72 bpm benchmark, and the confidence interval places the true average somewhere between about 72.9 and 77.3 bpm, a modest but real elevation above the benchmark, with the small-to-medium effect size cautioning against over-interpreting the clinical significance of a roughly 3 bpm difference.
Common misconceptions
Misconception
A p-value of .03 means there is a 3% chance the true mean equals the hypothesized value mu0.
Correction
A p-value is the probability of observing a sample mean at least this far from mu0 IF the true population mean really were mu0; it is never the probability that the null hypothesis itself is true. Read the confidence interval to see which values of the true mean remain consistent with the data.
Read more: Misconception: the p-value is the probability the null hypothesis is true
Misconception
A large, non-significant p-value proves the true mean equals the hypothesized value exactly.
Correction
A large p-value only means the data did not provide strong evidence AGAINST the hypothesized mean: absence of evidence is not evidence of absence. A small or underpowered study can easily miss a real departure from mu0 entirely; the confidence interval, not the p-value alone, shows which values remain plausible.
Read more: Misconception: a non-significant result proves there is no effect
References
- NIST/SEMATECH e-Handbook of Statistical Methods, §7.3.1 One-sample t-test, NIST/SEMATECH (2012), §7.3.1.
- Statistical Power Analysis for the Behavioral Sciences, Cohen, J. (1988).
