sNPLS: Fit a sNPLS model

View source: R/sNPLS_fit.R

sNPLSR Documentation

Fit a sNPLS model

Description

Fits a N-PLS regression model imposing sparsity on wj and wk matrices

Usage

sNPLS(
  XN,
  Y,
  ncomp = 2,
  threshold_j = 0.5,
  threshold_k = 0.5,
  keepJ = NULL,
  keepK = NULL,
  scale.X = TRUE,
  center.X = TRUE,
  scale.Y = TRUE,
  center.Y = TRUE,
  conver = 1e-16,
  max.iteration = 10000,
  silent = F,
  method = "sNPLS"
)

Arguments

XN

A three-way array containing the predictors.

Y

A matrix containing the response.

ncomp

Number of components in the projection

threshold_j

Threshold value on Wj. Scaled between [0, 1)

threshold_k

Threshold value on Wk. scaled between [0, 1)

keepJ

Number of variables to keep for each component, ignored if threshold_j is provided

keepK

Number of 'times' to keep for each component, ignored if threshold_k is provided

scale.X

Perform unit variance scaling on X?

center.X

Perform mean centering on X?

scale.Y

Perform unit variance scaling on Y?

center.Y

Perform mean centering on Y?

conver

Convergence criterion

max.iteration

Maximum number of iterations

silent

Show output?

method

Select between L1 penalization (sNPLS), variable selection with Selectivity Ratio (sNPLS-SR) or variable selection with VIP (sNPLS-VIP)

Value

A fitted sNPLS model

References

C. A. Andersson and R. Bro. The N-way Toolbox for MATLAB Chemometrics & Intelligent Laboratory Systems. 52 (1):1-4, 2000.

Hervas, D. Prats-Montalban, J. M., Garcia-CaƱaveras, J. C., Lahoz, A., & Ferrer, A. (2019). Sparse N-way partial least squares by L1-penalization. Chemometrics and Intelligent Laboratory Systems, 185, 85-91.

Examples

X_npls<-array(rpois(7500, 10), dim=c(50, 50, 3))

Y_npls <- matrix(2+0.4*X_npls[,5,1]+0.7*X_npls[,10,1]-0.9*X_npls[,15,1]+
0.6*X_npls[,20,1]- 0.5*X_npls[,25,1]+rnorm(50), ncol=1)
#Discrete thresholding
fit <- sNPLS(X_npls, Y_npls, ncomp=3, keepJ = rep(2,3) , keepK = rep(1,3))
#Continuous thresholding
fit2 <- sNPLS(X_npls, Y_npls, ncomp=3, threshold_j=0.5, threshold_k=0.5)
#USe sNPLS-SR method
fit3 <- sNPLS(X_npls, Y_npls, ncomp=3, threshold_j=0.5, threshold_k=0.5, method="sNPLS-SR")

David-Hervas/sNPLS documentation built on Feb. 1, 2024, 6:30 a.m.