[R] Compute R2 and Q2 in PLS with pls.pcr package

Bjørn-Helge Mevik bhs2 at mevik.net
Wed Oct 24 14:18:35 CEST 2007


Ana Conesa wrote:

> I am using the mvr function of the package pls.pcr to compute PLS 
> resgression

You should consider switching to the package 'pls'.  It supersedes
'pls.pcr', which is no longer maintained (the last version came in 2005).

In pls, you would do the following to get R^2 and cross-validated R^2
(A.K.A. Q^2):

mypls <- plsr(Ytrain ~ Xtrain, ncomp = 1, validation="LOO")
## R^2:
R2(mypls, estimate = "train")
## cross-validated R^2:
R2(mypls)
## Both:
R2(mypls, estimate = "all")

-- 
Bjørn-Helge Mevik



More information about the R-help mailing list