studentTTestOneSample
studentTTestOneSample
Introduced in: v25.10
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.
The optional confidence_level enables confidence interval calculation.
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
nandue to zero (or effectively zero) standard error.
See Also
Syntax
Parameters
confidence_level— Optional. Confidence level for confidence intervals. Float in (0, 1).Float*
Arguments
sample_data— Sample data.IntegerorFloatorDecimalpopulation_mean— Known population mean to test against (usually a constant).(U)Int*orFloat*orDecimal
Returned value
Returns a tuple with two or four elements (if confidence_level is specified): calculated t-statistic, calculated p-value (two-tailed), [calculated confidence-interval-low], [calculated confidence-interval-high]. Confidence intervals are for the sample mean at the given confidence level. Tuple(Float64, Float64) or Tuple(Float64, Float64, Float64, Float64)
Examples
Without confidence interval
With confidence interval (95%)
See Also