A python implementation of the mosaic permutation testing framework.
Installation
To install mosaicperm, just use pip:
pip install mosaicperm
Documentation
Documentation and tutorials are available at https://mosaicperm.readthedocs.io/.
Quickstart
Below, we give a simple example showing how to use mosaicperm to test whether a set of factor exposures explain the correlations among a matrix of outcomes variables.
import numpy as np
import mosaicperm as mp
# synthetic outcomes and exposures
n_obs, n_subjects, n_factors = 100, 200, 20
outcomes = np.random.randn(n_obs, n_subjects)
exposures = np.random.randn(n_obs, n_subjects, n_factors)
# example of missing data
outcomes[0:10][:, 0:5] = np.nan
exposures[0:10][:, 0:5] = np.nan
# fit mosaic permutation test
mpt = mp.factor.MosaicFactorTest(
outcomes=outcomes,
exposures=exposures,
test_stat=mp.statistics.mean_maxcorr_stat,
)
print(mpt.fit().summary())
# produce a time series plot of this analysis
mpt.fit_tseries(
nrand=100, n_timepoints=20,
).plot_tseries()
See the documentation for more details.
Reference
If you use mosaicperm in an academic publication, please consider citing our paper:
@article{mosaic2024,
author = {Spector, Asher and Barber, Rina Foygel and Hastie, Trevor and Kahn, Ronald N. and Candès, Emmanuel},
title = {The mosaic permutation test: an exact and nonparametric goodness-of-fit test for factor models},
date = {2024},
annotation = {2024f},
eprint = {2404.15017},
eprintclass = {stat.ME},
eprinttype = {arXiv},
url={https://arxiv.org/abs/2404.15017},
}
Metadata
Release files for mosaicperm 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mosaicperm-0.1.5.tar.gz | 28.0 kB | Without provenance | Details for mosaicperm-0.1.5.tar.gz |
Release files / mosaicperm-0.1.5.tar.gz
| Download URL | mosaicperm-0.1.5.tar.gz |
|---|---|
| Size | 28.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86d7c1546f2dce8453388b32019e7b9fa74b6c0728d96f6e905a4525b28590bb
|
|
BLAKE2b-256 checksum How to use checksums |
9356447e414036eb30091b738014135fef994eb9cbd3abd7f3df803118430ef8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.2
|
Security for mosaicperm 0.1.5
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.