[6] Simultaneous Mean and Covariance#

The functions in pysht.mean_covariance test a mean vector and a covariance matrix in one decision. Observations are rows and variables are columns.

Design

Function

Calibration regime

One sample against a known mean and covariance

llzs_1samp

Proportional high-dimensional normal limit

One sample against a known mean and covariance

lrt_1samp

Fixed-dimensional Wilks limit

Two independent samples

hn_2samp

High-dimensional normal limit

For a one-sample test, popmean=None and popcov=None mean the zero vector and identity matrix. A supplied covariance matrix must be finite, symmetric, and positive definite. pySHT whitens by a Cholesky solve; it does not form a matrix inverse.

from pysht.mean_covariance import llzs_1samp

result = llzs_1samp(x, popmean=null_mean, popcov=null_covariance)
print(result)

The alternative for every function is the complement of the joint null: a mean departure, a covariance departure, or both can be significant. llzs_1samp reports its aspect ratio and estimated marginal excess kurtosis as immutable calibration diagnostics. hn_2samp reports its two unbiased squared-distance estimates in the original measurement units when those values are representable as finite float64 numbers.

These methods serve different asymptotic regimes. llzs_1samp is for dimension and sample size growing proportionally. hn_2samp requires both group sizes and dimension to grow under the paper’s moment-factorization and trace conditions. lrt_1samp assumes multivariate normality with fixed dimension, more observations than variables, and full centered column rank. None is advertised as a generic small-sample calibration.

The validation ledger gives the exact formula oracles, the LLZS correction relative to SHT 0.1.9, and the 20,000-dataset null-size gates for the advertised regimes.

Functions#

pysht.mean_covariance.llzs_1samp(x, *, popmean=None, popcov=None)[source]#

Perform the Liu–Liu–Zheng–Shi one-sample joint test.

The procedure targets high-dimensional observations with dimension and sample size increasing proportionally. It requires independent rows, coordinate-wise fourth moments, and the spectral regularity assumptions stated by Liu, Liu, Zheng, and Shi (2017).

Parameters:
  • x (ArrayLike)

  • popmean (ArrayLike | None)

  • popcov (ArrayLike | None)

Return type:

HypothesisTestResult

pysht.mean_covariance.lrt_1samp(x, *, popmean=None, popcov=None)[source]#

Perform the classical joint multivariate likelihood-ratio test.

The test uses Wilks’ fixed-dimension chi-square limit for a multivariate normal sample. A positive-definite maximum-likelihood covariance requires more observations than features and full centered column rank.

Parameters:
  • x (ArrayLike)

  • popmean (ArrayLike | None)

  • popcov (ArrayLike | None)

Return type:

HypothesisTestResult

pysht.mean_covariance.hn_2samp(x, y)[source]#

Perform the Hyodo–Nishiyama two-sample joint test.

The test combines unbiased squared-distance estimators for the means and covariance matrices. Its standard-normal upper-tail calibration is asymptotic in dimension and both sample sizes and requires the moment and trace conditions of Hyodo and Nishiyama (2018).

Parameters:
  • x (ArrayLike)

  • y (ArrayLike)

Return type:

HypothesisTestResult