Learn R Programming

multiblock (version 0.8.8.2)

lpls_results: Result functions for L-PLS objects (lpls)

Description

Correlation loading plot, prediction and cross-validation for L-PLS models with class lpls.

Usage

# S3 method for lpls
plot(
  x,
  comps = c(1, 2),
  doplot = c(TRUE, TRUE, TRUE),
  level = c(2, 2, 2),
  arrow = c(1, 0, 1),
  xlim = c(-1, 1),
  ylim = c(-1, 1),
  samplecol = 4,
  pathcol = 2,
  varcol = "grey70",
  varsize = 1,
  sampleindex = 1:dim(x$corloadings$R22)[1],
  pathindex = 1:dim(x$corloadings$R3)[1],
  varindex = 1:dim(x$corloadings$R21)[1],
  ...
)

# S3 method for lpls predict( object, X1new = NULL, X2new = NULL, X3new = NULL, exo.direction = c("X2", "X3"), ... )

lplsCV(object, segments1 = NULL, segments2 = NULL, trace = TRUE)

Value

Nothing is return for plotting (plot.lpls), predicted values are returned for predictions (predict.lpls) and cross-validation metrics are returned for for cross-validation (lplsCV).

Arguments

x

lpls object

comps

integer vector of components.

doplot

logical indicating if plotting should be performed.

level

integer vector of length 3 for selecting plot symbol. 1=dots. 2=dimnames.

arrow

integer vector of length 3 indicating arrows (1) or not (0).

xlim

numeric x limits.

ylim

numeric y limits.

samplecol

character for sample colours.

pathcol

character for third colour.

varcol

character for variable colours.

varsize

numeric size of symbols for variables.

sampleindex

integer for selecting samples.

pathindex

integer for selecting in third direction.

varindex

integer for selecting variables.

...

Not implemented.

object

lpls object.

X1new

matrix of new X1 samples.

X2new

matrix of new X2 samples.

X3new

matrix of new X3 samples.

exo.direction

character selecting "X2" or "X3" prediction.

segments1

list of sample segments.

segments2

list of variable segments.

trace

logical indicating if verbose mode should be selected.

See Also

Overviews of available methods, multiblock, and methods organised by main structure: basic, unsupervised, asca, supervised and complex.

Examples

Run this code
# Simulate data set
sim <- lplsData(I = 30, N = 20, J = 5, K = 6, ncomp = 2)
X1  <- sim$X1; X2 <- sim$X2; X3 <- sim$X3

# exo-L-PLS:
lp.exo  <- lpls(X1,X2,X3, ncomp = 2)
# Predict X1
pred.exo.X2 <- predict(lp.exo, X1new = X1, exo.direction = "X2")
# Predict X3
pred.exo.X2 <- predict(lp.exo, X1new = X1, exo.direction = "X3")

# endo-L-PLS:
lp.endo <- lpls(X1,X2,X3, ncomp = 2, type = "endo")
# Predict X1 from X2 and X3 (in this case fitted values):
pred.endo.X1 <- predict(lp.endo, X2new = X2, X3new = X3)

# LOO cross-validation horizontally
lp.cv1 <- lplsCV(lp.exo, segments1 = as.list(1:dim(X1)[1]))

# LOO cross-validation vertically
lp.cv2 <- lplsCV(lp.exo, segments2 = as.list(1:dim(X1)[2]))

# Three-fold CV, horizontal
lp.cv3 <- lplsCV(lp.exo, segments1 = as.list(1:10, 11:20, 21:30))

Run the code above in your browser using DataLab