pls {ER} | R Documentation |
Partial Least Squares modelling of ER objects.
Description
The output of ER
is used as input to a PLS classification with the selected
effect as response. It is possible to compare two models using the er2
argument. Variable
selection is available through Jackknifing (from package pls
) and Shaving (from package plsVarSel
).
Usage
pls(er, ...)
## S3 method for class 'ER'
pls(
er,
effect,
ncomp,
newdata = NULL,
er2,
validation,
jackknife = NULL,
shave = NULL,
df.used = NULL,
...
)
Arguments
er |
Object of class |
... |
Additional arguments for |
effect |
The effect to be used as response. |
ncomp |
Number of PLS components. |
newdata |
Optional new data matrix for prediction. |
er2 |
Second object of class |
validation |
Optional validation parameters for |
jackknife |
Optional argument specifying if jackknifing should be applied. |
shave |
Optional argument indicating if variable shaving should be used. |
df.used |
Optional argument indicating how many degrees of freedom have been consumed during deflation. Default value from input object. |
Details
If using the shave
options, the segment type is given as type
instead of segment.type
(see examples).
See Also
Examples
data(MS, package = "ER")
er <- ER(proteins ~ MS * cluster, data = MS[-1,])
# Simple PLS using interleaved cross-validation
plsMod <- pls(er, 'MS', 6, validation = "CV",
segment.type = "interleaved", length.seg = 25)
scoreplot(plsMod, labels = "names")
# PLS with shaving of variables (mind different variable for cross-validation type)
plsModS <- pls(er, 'MS', 6, validation = "CV",
type = "interleaved", length.seg=25, shave = TRUE)
# Error as a function of remaining variables
plot(plsModS$shave)
# Selected variables for minimum error
with(plsModS$shave, colnames(X)[variables[[min.red+1]]])
# Time consuming due to leave-one-out cross-validation
plsModJ <- pls(er, 'MS', 5, validation = "LOO",
jackknife = TRUE)
colSums(plsModJ$classes == as.numeric(MS$MS[-1]))
# Jackknifed coefficient P-values (sorted)
plot(sort(plsModJ$jack[,1,1]), pch = '.', ylab = 'P-value')
abline(h=c(0.01,0.05),col=2:3)
scoreplot(plsModJ)
scoreplot(plsModJ, comps=c(1,3)) # Selected components
# Use MS categories for colouring and clusters for plot characters.
scoreplot(plsModJ, col = er$symbolicDesign[['MS']],
pch = 20+as.numeric(er$symbolicDesign[['cluster']]))
loadingplot(plsModJ, scatter=TRUE) # scatter=TRUE for scatter plot