Learn R Programming

ER (version 1.1.0)

pls: Partial Least Squares modelling of ER objects.

Description

Partial Least Squares modelling of ER objects.

Usage

pls(er, ...)

# S3 method for ER pls( er, effect, ncomp, newdata = NULL, er2, validation, jackknife = NULL, shave = NULL, df.used = NULL, ... )

Arguments

er

Object of class ER.

...

Additional arguments for plsr.

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 ER for comparison.

validation

Optional validation parameters for plsr.

jackknife

Optional argument specifying if jackknifing should be applied.

shave

Optional argument indicating if variable shaving should be used. shave should be a list with two elements: the PLS filter method and the proportion to remove. shave = TRUE uses defaults: list("sMC", 0.2).

df.used

Optional argument indicating how many degrees of freedom have been consumed during deflation. Default value from input object.

See Also

ER, elastic and confints.

Examples

Run this code
data(MS, package = "ER")
er <- ER(proteins ~ MS * cluster, data = MS[-1,])

plsMod <- pls(er, 'MS', 6, validation = "CV",
              type = "interleaved", length.seg=25, shave = TRUE)
# Error as a function of remaining variables
plot(plsMod$shave)
# Selected variables for minimum error
with(plsMod$shave, colnames(X)[variables[[min.red+1]]])

# \donttest{
plsMod <- pls(er, 'MS', 5, validation = "LOO",
              type = "interleaved", length.seg=25, jackknife = TRUE)
colSums(plsMod$classes == as.numeric(MS$MS[-1]))
# Jackknifed coefficient P-values (sorted)
plot(sort(plsMod$jack[,1,1]), pch = '.', ylab = 'P-value')
abline(h=c(0.01,0.05),col=2:3)

scoreplot(plsMod)
scoreplot(plsMod, comps=c(1,3))   # Selected components
# Use MS categories for colouring and clusters for plot characters.
scoreplot(plsMod, col = er$symbolicDesign[['MS']],
                  pch = 20+as.numeric(er$symbolicDesign[['cluster']]))
loadingplot(plsMod, scatter=TRUE) # scatter=TRUE for scatter plot
# }

Run the code above in your browser using DataLab