studentTTestOneSample
Applies the one-sample Student's t-test to determine whether the mean of a sample differs from a known population mean.
Normality is assumed. The null hypothesis is that the sample mean equals the population mean.
Syntax
The optional confidence_level
enables confidence interval calculation.
Arguments
sample_data
— Sample data. Integer, Float or Decimal.population_mean
— Known population mean to test against. Integer, Float or Decimal (usually a constant).
Parameters
confidence_level
— Confidence level for confidence intervals. Float in (0, 1).
Notes:
- At least 2 observations are required; otherwise the result is
(nan, nan)
(and intervals if requested arenan
). - Constant or near-constant input will also return
nan
due to zero (or effectively zero) standard error.
Returned values
Tuple with two or four elements (if confidence_level
is specified):
- calculated t-statistic. Float64.
- calculated p-value (two-tailed). Float64.
- calculated confidence-interval-low. Float64. (optional)
- calculated confidence-interval-high. Float64. (optional)
Confidence intervals are for the sample mean at the given confidence level.
Examples
Input table:
Without confidence interval:
With confidence interval (95%):
See Also