Learn R Programming

ppls: Penalized Partial Least Squares for Structured and Functional Data

Introduction

This R package implements a flexible and powerful framework for penalized Partial Least Squares (PPLS), including:

  • B-spline basis transformations of the input data,
  • Construction of penalty matrices,
  • Cross-validation for hyperparameter tuning (lambda, ncomp),
  • Visualization of component effects,
  • Jackknife-based inference (covariance, t-tests),
  • Support for block-wise variable selection and kernel PPLS.

It is particularly suited for high-dimensional, structured, and nonlinear regression problems, such as functional data or spectral data.


Installation

We recommend to install the CRAN version for a stable version of ppls.

install.packages("ppls")

Alternatively, install the development version from GitHub with:

# install.packages("pak") ## If necessary, install "pak" beforehand
pak::pak("vguillemot/ppls")

Example: Fit a Penalized PLS Model with Splines

The following is an example of how use ppls on the cookie dataset included in the package:

library(ppls)

# Load cookie data
data(cookie)
X <- as.matrix(cookie$NIR)
y <- cookie$constituents$fat

# Fit a 2-component kernel PPLS 
fit.kpls <- penalized.pls(
  X = X, y = y,
  kernel = TRUE, 
  ncomp = 2
)

# Predict on train data
yhat <- new.penalized.pls(ppls = fit.kpls, Xtest = X, ytest = y)$ypred

# Plot predicted vs observed
plot(yhat[,1], y, xlab = "Fitted", ylab = "Observed", pch = 16, asp = 1)
abline(0, 1, col = "blue", lty = 2)

References

Kraemer, N., Boulesteix, A.-L., & Tutz, G. (2008).
Penalized Partial Least Squares with Applications to B-Spline Transformations and Functional Data.
Chemometrics and Intelligent Laboratory Systems, 94(1), 60–69.
https://doi.org/10.1016/j.chemolab.2008.06.009

Copy Link

Version

Install

install.packages('ppls')

Monthly Downloads

249

Version

2.0.0

License

GPL (>= 2)

Maintainer

Vincent Guillemot

Last Published

July 22nd, 2025

Functions in ppls (2.0.0)

coef.mypls

Extract Regression Coefficients from a mypls Object
ppls.splines.cv

Cross-Validation for Penalized PLS with Spline-Transformed Predictors
X2s

Nonlinear Transformation via B-Splines
normalize.vector

Normalize a Numeric Vector to Unit Length
sim.data.ppls

Simulate Data for Penalized Partial Least Squares (PPLS)
Penalty.matrix

Penalty Matrix for Higher Order Differences
cookie

Near-Infrared (NIR) Spectroscopy of Biscuit Doughs
graphic.ppls.splines

Plot Penalized PLS Components for Spline-Transformed Data
jack.ppls

Jackknife Estimation for Penalized PLS Coefficients
ttest.ppls

t-Test for Penalized PLS Regression Coefficients
penalized.pls

Predict New Data Using a Penalized PLS Model
vcov.mypls

Variance-Covariance Matrix for Penalized PLS Coefficients