[R] Calculate SPE in PLS package

Stella Sim Stella.Sim at fonterra.com
Mon Oct 20 04:32:07 CEST 2008


Dear list,

I want to calculate SPE (squared prediction error) in x-space, can
someone help?

Here are my codes:

fit.pls<-
plsr(Y~X,data=DAT,ncomp=3,scale=T,method='oscorespls',validation="CV",x=
T) 
actual<-fit.pls$model$X
pred<-fit.pls$scores %*% t(fit.pls$loadings)
SPE.x<-rowSums((actual-pred)^2)

Am I missing something here? 

Thanks in advance. 

Stella Sim



DISCLAIMER:\ This email contains confidential informatio...{{dropped:11}}



More information about the R-help mailing list