[R] PLS in R

Bjørn-Helge Mevik b.h.mevik at usit.uio.no
Thu Dec 7 08:02:30 CET 2017


Margarida Soares <margaridapmsoares at gmail.com> writes:

> library(pls)
> plsrcue<- plsr(cue~fb+cn+n+ph+fung+bact+resp, data = cue, ncomp=7,
> na.action = NULL, method = "kernelpls", scale=FALSE, validation = "LOO",
> model = TRUE, x = FALSE, y = FALSE)
> summary(plsrcue)
>
> and I got this output, where I think I can choose the number of components
> based on RMSEP, but how do I choose it?

There are no "hard" rules for how to choose the number of components,
but one rule of thumb is to stop when the RMSEP starts to flatten out,
or to increase.  In your case, I would say 4 components.  An easier way
to look at the RMSEP values is with plot(RMSEP(plsrcue)).

(There are some algorithms that can suggest the number of components for
you.  Two of those are implemented in the development of the plsr
package (hopefully released during Christmas).  You can check it out
here if you wish: https://github.com/bhmevik/pls .  Disclaimer: I am the
maintainer of the package. :) )

> - and also, how to proceed from here?

That depends on what you want to do/learn about the system you
aremodelling.  Many researchers in fields like spectroscopy or
chemometrics (where PLSR originated) plot loadings and scores and infer
things graphically.)

> - and how to make a correlation plot?

corrplot(plsrcue) - at least if you mean a correlation loadings plot.
See ?corrplot for details

> - what to do with the values, coefficients that I get in the Environment
> (pls values)

Again, that depends on what you want with your model.

-- 
Regards,
Bjørn-Helge Mevik
-------------- neste del --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: ikke tilgjengelig
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20171207/bd29fd10/attachment.sig>


More information about the R-help mailing list