kernelpls.fit2: Kernel PLS Regression

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/kernelpls.fit2.R

Description

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

Usage

1
2
3
4
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)

Alexander Robitzsch

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, 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.

See Also

See the pls package for further estimation algorithms.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#############################################################################
# SIMULATED EXAMPLE 1: 300 cases on 100 variables
#############################################################################
set.seed(789)

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,] )

## Not run: 
#############################################################################
# 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 June 20, 2017, 9:10 a.m.

Search within the miceadds package
Search all R packages, documentation and source code