Skip to main content

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.

git clone https://github.com/braincentrekcl/plsdo.git
cd plsdo
uv venv .venv && source .venv/bin/activate
uv pip install -e .

For discriminatory PLS with cross-validation (requires scikit-learn):

uv pip install -e ".[cv]"

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
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


Licence

BSD 3-Clause. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plsdo-0.0.1.tar.gz (35.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plsdo-0.0.1-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file plsdo-0.0.1.tar.gz.

File metadata

  • Download URL: plsdo-0.0.1.tar.gz
  • Upload date:
  • Size: 35.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for plsdo-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4ccbc51fd3ea7500df56675157160d3083848ffd6f8ad30fd3d9f3d790c25287
MD5 281c680ee1d292c107299f982023dd21
BLAKE2b-256 2c951f9874c6cc31fe177b67dab71d9a7b7ea2e804adc7bfde3e3e63c22afba9

See more details on using hashes here.

File details

Details for the file plsdo-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: plsdo-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for plsdo-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 be5318e972374190e48120501ed580445f44270fbcdfe08b2bf700c65cd4da87
MD5 bec4b99cb539e8a95a377fa022f34e16
BLAKE2b-256 6ba3356f88c05a8c4ace698ec57381c1763020c0c95c4322d3e3cc937c29a99f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page