plskit (R)

R package for plskit: Partial Least Squares with modern inference, backed by a Rust engine.

What is plskit?

plskit is a Partial Least Squares (PLS) library built around four ideas:

Install

Requires R 4.2 or newer. Install a release from r-universe:

install.packages("plskit", repos = "https://pawlenartowicz.r-universe.dev")

or from the r-universe branch of the GitHub repository:

devtools::install_github("pawlenartowicz/plskit", ref = "r-universe")

r-universe serves binaries for Windows, macOS and Linux, which need no Rust. A source install (from GitHub, or from r-universe where it has no binary for your R version or platform) needs Rust 1.85 or newer with cargo, from rustup; on Windows it also needs Rtools and the GNU Rust target (rustup target add x86_64-pc-windows-gnu).

A checkout of main builds only in dev mode: a cargo config file outside the package points the engine crates at the checkout.

git clone https://github.com/pawlenartowicz/plskit
cd plskit
printf "[patch.crates-io]\nplskit = { path = '%s/plskit-rs' }\nplskit-bind = { path = '%s/plskit-bind' }\n" "$PWD" "$PWD" > "$HOME/plskit-dev.toml"
PLSKIT_CARGO_CONFIG="$HOME/plskit-dev.toml" R CMD INSTALL plskit-r

See installation for what the dev-mode build does and how to fix a failed build.

Quickstart

library(plskit)

set.seed(1)
X <- matrix(rnorm(60 * 6), 60, 6)
y <- 4 * (X[, 1] + X[, 2]) + 0.5 * rnorm(60)

# Fit and predict
fit  <- pls1_fit(X, y, k = 3, seed = 42)
yhat <- pls1_predict(fit, X[1:5, ])

# Confirmatory test for any signal; k = 1 with split_exact is recommended.
test <- pls1_confirmatory_test(X, y, k = 1, test_method = "split_exact",
                               seed = 42)
test$pvalue

Same names as Python

Function names, argument names and result fields are the Python ones. The number of components is k (and k_max), as in every plskit language, not ncomp as in the R pls package; there is no alias.

R value types

tryCatch(pls1_fit(X, y, k = 2.5), plskit_error = function(e) e$code)
# "invalid_argument"

The full mapping is in Differences from Python.

Documentation

License

GPL-3.0-or-later.

Citation

@inproceedings{lenartowicz2026cheap,
  title     = {Cheap and Powerful Tests for Supervised Subspaces: Per-Component Inference for {PLS}},
  author    = {Lenartowicz, Pawe{\l} and Plisiecki, Hubert},
  booktitle = {The Fortieth Annual Conference on Neural Information Processing Systems},
  year      = {2026},
  url       = {https://openreview.net/forum?id=xb6CB7d9LO}
}

Paweł Lenartowicz — Freestyler Scientist · GitHub · ORCID