Skip to main content

MANOCCA

Multivariate ANalysis of Conditional CovAriance

MANOCCA tests whether a predictor X is associated with the covariance structure of multivariate outcomes Y, adjusting for covariates C:

Cov(Y) ~ X + C

Unlike MANOVA (which tests mean effects) or univariate approaches, MANOCCA isolates changes in correlations/covariances between outcomes. The test is orthogonal to mean and variance effects.

Reference: Boetto C. & Aschard H. (2024). Briefings in Bioinformatics, 25(4).
https://academic.oup.com/bib/article/25/4/bbae272/7690346


Installation

pip install manocca

Or with conda (once the feedstock is available on conda-forge):

conda install -c conda-forge manocca

Quick start

import numpy as np
from manocca import MANOCCA, MANOVA, UNIVARIATE, Explainer

rng = np.random.default_rng(42)
N, K = 1000, 10

X = rng.binomial(1, 0.4, (N, 1)).astype(float)   # binary predictor
C = rng.standard_normal((N, 3))                   # covariates
Y = rng.standard_normal((N, K))                   # outcomes

# Inject a covariance effect: Y0 and Y1 become correlated when X=1
mask = X.flatten() == 1
Y[mask, 0] += 1.5 * Y[mask, 1]

# Test Cov(Y) ~ X + C
model = MANOCCA(predictors=X, outputs=Y, covariates=C, n_comp=20)
model.test()
print(f"MANOCCA p-value: {model.p[0, 0]:.4e}")   # should be significant

Classes

Class Tests Description
MANOCCA Cov(Y) ~ X + C Core covariance test
MANOVA Mean(Y) ~ X + C Classical multivariate mean test
UNIVARIATE Y_j ~ X + C Univariate baseline (per outcome)
Explainer — Interprets a fitted MANOCCA model

MANOCCA

model = MANOCCA(
    predictors,          # ndarray or DataFrame (N, n_p)
    outputs,             # ndarray or DataFrame (N, k), k >= 2
    covariates=None,     # ndarray or DataFrame (N, n_c), optional
    n_comp=None,         # number of PCA components (default: k)
    apply_qt=True,       # quantile-transform products before PCA
    use_pca=True,        # reduce with PCA (recommended for large k)
    corr_bias=False,     # subtract additive mean-effect bias
    n_jobs=1,            # parallel workers (-1 = all cores)
)
model.test()
model.p                  # ndarray (n_p, 1) — p-values per predictor

Explainer

exp = Explainer(model)

# P-value vs. number of PCA components
p_curve, grid = exp.power_pc_kept("predictor_name", grid=range(1, 21))

# Which pairwise covariances drive the signal?
importances = exp.feature_importances("predictor_name", n_comp=10)

# Per-outcome contribution
contrib = exp.split_contribution(importances)

Algorithm

  1. Compute all k(k−1)/2 pairwise products of (optionally QT-transformed) outcomes.
  2. Reduce dimensionality with PCA; apply a second QT to the components.
  3. Residualize the components against covariates C.
  4. Run a Wilks' Lambda MANOVA of the residuals against each predictor in X.

See the paper for details on the bias-correction mode (corr_bias=True), which makes the test orthogonal to additive mean effects without QT or PCA.


Citation

@article{boetto2024manocca,
  author  = {Boetto, Christophe and Aschard, Hugues},
  title   = {{MANOCCA}: Multivariate ANalysis of Conditional CovAriance},
  journal = {Briefings in Bioinformatics},
  volume  = {25},
  number  = {4},
  year    = {2024},
  doi     = {10.1093/bib/bbae272},
}

License

MIT © Christophe Boetto, Hugues Aschard

Metadata

Release files for manocca 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for manocca 2.0.1
File Size Uploaded Provenance Actions
manocca-2.0.1.tar.gz 16.2 kB Without provenance Details for manocca-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for manocca 2.0.1
File Interpreter ABI Platform Actions
manocca-2.0.1-py3-none-any.whl Python 3 none any Details for manocca-2.0.1-py3-none-any.whl

Total release size: 34.3 kB

Release files / manocca-2.0.1.tar.gz

Download URL manocca-2.0.1.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ed37cca41f4cdd25e5a82cdb2d3c95f5d2319c834396b9e40329cf0d366728b2
BLAKE2b-256 checksum
How to use checksums
7752d20bb768674ad2437984f2d004dfbb6843df8ceb3b2787dbba12faba41ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.16

Release files / manocca-2.0.1-py3-none-any.whl

Download URL manocca-2.0.1-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b63cc1f2ba66e70d90f3103b8a1daffc8337eced5ba198ee4b02f216a39a251c
BLAKE2b-256 checksum
How to use checksums
b45c8b51bc15671ca2d69d7f565e65ab2fbfd2862494a4fcf57f6295146c6c03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.16

Security for manocca 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page