PLS covariance analysis with statistical testing and visualisation
Project description
plsdo
Partial Least Squares (PLS) covariance analysis with permutation testing, bootstrap reliability, and publication-ready visualisation — from the command line.
(Pronounced: "please do")
plsdo was built out of necessity for project-specific neuroscience and neuroimaging pipelines, then generalised to handle flexible, diverse datasets beyond its origins. It implements two PLS variants used in neuroimaging and cognitive neuroscience research:
- Correlational PLS — finds latent variables that maximise covariance between two continuous data matrices (e.g. brain measures and behaviour scores).
- Discriminatory PLS — finds latent variables that maximise covariance between a continuous data matrix and a dummy-coded group matrix (i.e. group differences).
Statistical validity is built in: every analysis runs a permutation test on singular values and bootstraps loading stability. Only latent variables that pass both tests appear in the output.
Early alpha. The API and output format may change before the first stable release. Feedback and bug reports are very welcome — please open an issue.
Installation
Requires Python ≥ 3.10.
uv pip install plsdo
For discriminatory PLS with cross-validation (requires scikit-learn):
uv pip install "plsdo[cv]"
For development:
git clone https://github.com/braincentrekcl/plsdo.git
cd plsdo
uv venv .venv && source .venv/bin/activate
uv pip install -e ".[dev]"
Quick start
Correlational PLS
plsdo run --method c \
--x brain_measures.csv \
--y behaviour_scores.csv \
--demographics participants.csv \
--group-col treatment \
--subject-id participant_id \
--output results/
Discriminatory PLS
plsdo run --method d \
--y mri_features.csv \
--demographics participants.csv \
--group-col drug_group \
--subject-id participant_id \
--output results/
Cross-validation (discriminatory only)
Requires plsdo[cv] — see Installation above.
plsdo cross-validate \
--y mri_features.csv \
--demographics participants.csv \
--group-col drug_group \
--subject-id participant_id \
--output cv_results/
Output
Each run writes to the output directory:
results/
figures/ cross-correlation heatmap, permutation test, loading bar plots, score plots
data/ singular values, p-values, loadings, bootstrap ratios, subject scores (CSV)
log.txt parameters and version stamp
Documentation
| Page | Contents |
|---|---|
| Usage guide | Full CLI options, multiple grouping variables, all flags |
| Input format | How to structure X, Y, demographics, and metadata files |
| Interpreting output | What each plot and CSV means |
| Statistical methods | Design matrix encoding, p-value correction, LV filtering, bootstrap alignment |
| Missing data | Why plsdo does not impute, and what to do instead |
Contributing
Issues and pull requests are welcome. Please open an issue before starting significant work.
Contact: eilidh [dot] macnicol [at] kcl [dot] ac [dot] uk
Citation
If you use plsdo in your research, please cite it.
GitHub will show a "Cite this repository" prompt from the
CITATION.cff file, or you can use the BibTeX
entry in docs/references.bib.
Licence
BSD 3-Clause. See LICENSE.
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 plsdo-0.1.0.tar.gz.
File metadata
- Download URL: plsdo-0.1.0.tar.gz
- Upload date:
- Size: 45.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7dd1ae32101405733ce94f703fa36a1fc5efa13b94f857885eb6a50ec52676b
|
|
| MD5 |
5f0e99504d4b94bf67570129d0c8a130
|
|
| BLAKE2b-256 |
eeb7d63987b2ea25b349342981f4872f55270862fa6e66dae2c0518a593e78ff
|
Provenance
The following attestation bundles were made for plsdo-0.1.0.tar.gz:
Publisher:
release.yml on braincentrekcl/plsdo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plsdo-0.1.0.tar.gz -
Subject digest:
f7dd1ae32101405733ce94f703fa36a1fc5efa13b94f857885eb6a50ec52676b - Sigstore transparency entry: 1595150996
- Sigstore integration time:
-
Permalink:
braincentrekcl/plsdo@3c0bf80b6244fcff35ece7f4623aec5521ae6328 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/braincentrekcl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3c0bf80b6244fcff35ece7f4623aec5521ae6328 -
Trigger Event:
push
-
Statement type:
File details
Details for the file plsdo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: plsdo-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1f2f32a7edcb0d1ba65b13668a6401be34042e2f8ba5bd2988f39a50801b178
|
|
| MD5 |
80b8f83c78ad254e3a4694748dc9df44
|
|
| BLAKE2b-256 |
1fca26ce56017f00f451d13640319a8a28d5274394ec4dea5ccb6e1ffadbd89b
|
Provenance
The following attestation bundles were made for plsdo-0.1.0-py3-none-any.whl:
Publisher:
release.yml on braincentrekcl/plsdo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plsdo-0.1.0-py3-none-any.whl -
Subject digest:
c1f2f32a7edcb0d1ba65b13668a6401be34042e2f8ba5bd2988f39a50801b178 - Sigstore transparency entry: 1595151039
- Sigstore integration time:
-
Permalink:
braincentrekcl/plsdo@3c0bf80b6244fcff35ece7f4623aec5521ae6328 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/braincentrekcl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3c0bf80b6244fcff35ece7f4623aec5521ae6328 -
Trigger Event:
push
-
Statement type: