graphic.ppls.splines {ppls}R Documentation

Plot Penalized PLS Components for Spline-Transformed Data

Description

This function applies a nonlinear regression model using penalized Partial Least Squares (PLS) on B-spline transformed variables, then visualizes each additive component.

Usage

graphic.ppls.splines(
  X,
  y,
  lambda = NULL,
  add.data = FALSE,
  select = FALSE,
  ncomp = 1,
  deg = 3,
  order = 2,
  nknot = NULL,
  reduce.knots = FALSE,
  kernel = TRUE,
  window.size = c(3, 3)
)

Arguments

X

A numeric matrix of input data.

y

A numeric response vector.

lambda

A numeric value for the penalization parameter. Default is NULL.

add.data

Logical. If TRUE, the original data points X and y are added to the plots. Default is FALSE.

select

Logical. If TRUE, the function fits only one block (variable) per iteration (block-wise selection). Default is FALSE.

ncomp

Integer. Number of PLS components to use. Default is 1.

deg

Integer. Degree of the B-spline basis. Default is 3.

order

Integer. Order of the differences to penalize. Default is 2.

nknot

A numeric vector specifying the number of knots for each variable. Default is NULL, which uses rep(20, ncol(X)).

reduce.knots

Logical. If TRUE, automatically reduces the number of knots for variables leading to constant basis functions. Default is FALSE.

kernel

Logical. If TRUE, uses the kernelized version of PPLS. Default is TRUE.

window.size

A numeric vector of length 2 indicating the number of plots per row and column. Default is c(3, 3) (3 rows and 3 columns).

Details

This function first transforms the input data X and a test grid Xtest using B-spline basis functions, then fits a penalized PLS model using these transformed variables. Each additive component (i.e., variable effect) is then plotted individually.

If add.data = TRUE, the actual observations are plotted on top of the corresponding fitted component functions. While this can help visualize the fit, note that only the sum of all fitted components approximates y, and not each component individually.

The function is intended for exploratory visualization and should be used after appropriate model selection using, e.g., ppls.splines.cv.

Value

A numeric vector of regression coefficients for the final penalized PLS model.

References

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

See Also

ppls.splines.cv, X2s, penalized.pls, Penalty.matrix

Examples

# Load Boston housing data
library(MASS)
data(Boston)
y <- Boston[, 14]
X <- Boston[, -14]
X <- X[, -4]  # remove categorical variable
X <- as.matrix(X)

# Plot with variable selection and original data
graphic.ppls.splines(
  X, y, lambda = 100, ncomp = 5,
  add.data = TRUE, select = TRUE, window.size = c(3, 4)
)

# Plot without variable selection and without data
graphic.ppls.splines(
  X, y, lambda = 100, ncomp = 5,
  add.data = FALSE, select = FALSE, window.size = c(3, 4)
)


[Package ppls version 2.0.0 Index]