new.penalized.pls {ppls} | R Documentation |
Given an object returned by the function penalized.pls
, this function
predicts the response for new data, with different numbers of components (as specified
when running penalized.pls
).
new.penalized.pls(ppls, Xtest, ytest = NULL)
ppls |
An object returned from penalized.pls |
Xtest |
A matrix of new input data with the same number of columns as the matrix X
given as an argument of the function penalized.pls to construct ppls . |
ytest |
The numeric vector of new response data, optional. Its length must equal the number of
rows of Xtest . |
The function penalized.pls
simply returns the intercepts and regression
coefficients for all penalized PLS components up to ncomp
which is
specified as an argument. The function new.penalized.pls
then computes the estimated response
using these regression vectors. If ytest
is given, the mean squared
errors for all number of components are computed as well.
ypred |
The matrix of predicted responses. The number of rows equals the number of rows of Xtest , whereas
the number of columns equals the ncomp argument given to the function penalized.pls while
constructing the object ppls .
|
mse |
vector of mean squared errors, if ytest (giving the true response) is provided. |
Nicole Kraemer
N. Kraemer, A.-L. Boulesteix, G. Tutz (2007) "Penalized Partial Least Squares with Applications to B-Splines Transformations and Functional Data", preprint
available at http://ml.cs.tu-berlin.de/~nkraemer/publications.html
penalized.pls
, penalized.pls.cv
, ppls.splines.cv
# see also the example for penalised.pls X<-matrix(rnorm(50*200),ncol=50) y<-rnorm(200) Xtrain<-X[1:100,] Xtest<-X[101:200,] ytrain<-y[1:100] ytest<-X[101:200] pen.pls<-penalized.pls(Xtrain,ytrain,ncomp=10) test.error<-new.penalized.pls(pen.pls,Xtest,ytest)$mse