[1] Tests for Univariate Mean#

The univariate mean API contains one-sample and two-sample t tests together with classical one-way analysis of variance. The functions live in pysht.mean; this page groups them by the scientific category used in SHT.

Question

Function

Is one population mean equal to a reference value?

ttest_1samp

Are two independent or paired means equal?

ttest_2samp

Are two or more independent-group means equal?

anova_oneway

See the classical-mean validation ledger for formula and oracle details.

Functions#

pysht.mean.ttest_1samp(x, *, popmean=0.0, alternative='two-sided', confidence_level=0.95)[source]#

Perform a one-sample Student t test.

The observations are assumed independent and normally distributed with an unknown, positive variance. alternative describes the population mean relative to popmean.

Parameters:
  • x (ArrayLike)

  • popmean (float)

  • alternative (str)

  • confidence_level (float)

Return type:

HypothesisTestResult

pysht.mean.ttest_2samp(x, y, *, alternative='two-sided', paired=False, equal_var=False, confidence_level=0.95)[source]#

Perform an independent or paired two-sample t test.

Welch’s unequal-variance test is the default for independent samples. Set equal_var=True for the pooled-variance Student test, or paired=True for a test of paired differences.

Parameters:
  • x (ArrayLike)

  • y (ArrayLike)

  • alternative (str)

  • paired (bool)

  • equal_var (bool)

  • confidence_level (float)

Return type:

HypothesisTestResult

pysht.mean.anova_oneway(*samples)[source]#

Perform the classical fixed-effects one-way analysis of variance.

The test assumes independent normal observations and a common positive population variance across groups.

Parameters:

samples (ArrayLike)

Return type:

HypothesisTestResult