kernelpls.fit2: Kernel PLS Regression

View source: R/kernelpls.fit2.R

kernelpls.fit2R Documentation

Kernel PLS Regression

Description

Fits a PLS regression model with the kernel algorithm (Dayal & Macgregor, 1997).

Usage

kernelpls.fit2(X, Y, ncomp)

## S3 method for class 'kernelpls.fit2'
predict(object,X, ...)

Arguments

X

Matrix of regressors

Y

Vector of a univariate outcome

ncomp

Number of components to be extracted

object

Object of class kernelpls.fit2

...

Further arguments to be passed

Value

The same list as in {pls::kernelpls.fit} is produced.

In addition, R^2 measures are contained in R2.

Author(s)

This code is a Rcpp translation of the original pls::kernelpls.fit function from the pls package (see Mevik & Wehrens, 2007).

References

Dayal, B., & Macgregor, J. F. (1997). Improved PLS algorithms. Journal of Chemometrics, 11(1), 73-85.

Mevik, B. H., & Wehrens, R. (2007). The pls package: Principal component and partial least squares regression in R. Journal of Statistical Software, 18, 1-24. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v018.i02")}

See Also

See the pls package for further estimation algorithms.

Examples

## Not run: 
#############################################################################
# SIMULATED EXAMPLE 1: 300 cases on 100 variables
#############################################################################
set.seed(789)
library(mvtnorm)

N <- 300        # number of cases
p <- 100        # number of predictors
rho1 <- .6      # correlations between predictors

# simulate data
Sigma <- base::diag(1-rho1,p) + rho1
X <- mvtnorm::rmvnorm( N, sigma=Sigma )
beta <- base::seq( 0, 1, len=p )
y <- ( X %*% beta )[,1] + stats::rnorm( N, sd=.6 )
Y <- base::matrix(y,nrow=N, ncol=1 )

# PLS regression
res <- miceadds::kernelpls.fit2( X=X, Y=Y, ncomp=20 )

# predict new scores
Xpred <- predict( res, X=X[1:10,] )

#############################################################################
# EXAMPLE 2: Dataset yarn from pls package
#############################################################################

# use kernelpls.fit from pls package
library(pls)
data(yarn,package="pls")
mod1 <- pls::kernelpls.fit( X=yarn$NIR, Y=yarn$density, ncomp=10 )
# use kernelpls.fit2 from miceadds package
Y <- base::matrix( yarn$density, ncol=1 )
mod2 <- miceadds::kernelpls.fit2( X=yarn$NIR, Y=Y, ncomp=10 )

## End(Not run)

miceadds documentation built on May 29, 2024, 11:05 a.m.