Learn R Programming

plsdof (version 0.2-1)

pls.model: Partial Least Squares

Description

This function computes the Partial Least Squares fit.

Usage

pls.model(X,y,m,Xtest=NULL,ytest=NULL,compute.DoF,compute.jacobian,use.kernel)

Arguments

X
matrix of predictor observations.
y
vector of response observations. The length of y is the same as the number of rows of X.
m
maximal number of Partial Least Squares components. Default is m=min(ncol(X),nrow(X)-1).
Xtest
optional matrix of test observations. Default is Xtest=NULL.
ytest
optional vector of test observations. Default is ytest=NULL.
compute.DoF
Logical variable. If compute.DoF=TRUE, the Degrees of Freedom of Partial Least Squares are computed. Default is compute.DoF=FALSE.
compute.jacobian
Should the first derivative of the regression coefficients be computed as well? Default is FALSE
use.kernel
Should the kernel representation be used to compute the solution. Default is FALSE.

Value

  • coefficientsmatrix of regression coefficients
  • interceptvector of intercepts
  • DoFvector of Degrees of Freedom
  • RSSvector of residual sum of error
  • sigmahatvector of estimated model error
  • Yhatmatrix of fitted values
  • yhatvector of squared length of fitted values
  • covarianceif compute.jacobian is TRUE, the function returns the array of covariance matrices for the PLS regression coefficients.
  • prediction{if Xtest is provided, the predicted y-values for Xtest.} mse{if Xtest and ytest are provided, the mean squared error on the test data.}

Details

to do

References

Kraemer, N., Sugiyama M. (2010). "The Degrees of Freedom of Partial Least Squares Regression". preprint, http://arxiv.org/abs/1002.4112 Kraemer, N., Sugiyama, M., Braun, M.L. (2009) "Lanczos Approximations for the Speedup of Partial Least Squares Regression", Proceedings of the 12th International Conference on Artificial Intelligence and Stastistics, 272 - 279

See Also

pls.ic, pls.cv

Examples

Run this code
n<-50 # number of observations
p<-15 # number of variables
X<-matrix(rnorm(n*p),ncol=p)
y<-rnorm(n)

ntest<-200 #
Xtest<-matrix(rnorm(ntest*p),ncol=p) # test data
ytest<-rnorm(ntest) # test data

# compute PLS + degrees of freedom + prediction on Xtest
first.object<-pls.model(X,y,compute.DoF=TRUE,Xtest=Xtest,ytest=NULL)

# compute PLS + test error
second.object=pls.model(X,y,m=10,Xtest=Xtest,ytest=ytest)

Run the code above in your browser using DataLab