MANOCCA: Multivariate ANalysis of Conditional CovAriance
Project description
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
- Compute all k(k−1)/2 pairwise products of (optionally QT-transformed) outcomes.
- Reduce dimensionality with PCA; apply a second QT to the components.
- Residualize the components against covariates C.
- 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file manocca-2.0.1.tar.gz.
File metadata
- Download URL: manocca-2.0.1.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed37cca41f4cdd25e5a82cdb2d3c95f5d2319c834396b9e40329cf0d366728b2
|
|
| MD5 |
d6f2e9975661c1a1e4834f099eae88aa
|
|
| BLAKE2b-256 |
7752d20bb768674ad2437984f2d004dfbb6843df8ceb3b2787dbba12faba41ae
|
File details
Details for the file manocca-2.0.1-py3-none-any.whl.
File metadata
- Download URL: manocca-2.0.1-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b63cc1f2ba66e70d90f3103b8a1daffc8337eced5ba198ee4b02f216a39a251c
|
|
| MD5 |
4beabd7fcc2e1f885dc0839029fde551
|
|
| BLAKE2b-256 |
b45c8b51bc15671ca2d69d7f565e65ab2fbfd2862494a4fcf57f6295146c6c03
|