Learn R Programming

multiblock (version 0.8.8.2)

sopls_results: Result functions for SO-PLS models

Description

Standard result functions for SO-PLS (sopls).

Usage

# S3 method for sopls
predict(
  object,
  newdata,
  ncomp = object$ncomp,
  type = c("response", "scores"),
  na.action = na.pass,
  ...
)

# S3 method for sopls coef(object, ncomp = object$ncomp, intercept = FALSE, ...)

# S3 method for sopls print(x, ...)

# S3 method for sopls summary( object, what = c("all", "validation", "training"), digits = 4, print.gap = 2, ... )

classify(object, ...)

# S3 method for sopls classify(object, classes, newdata, ncomp, LQ = "LDA", ...)

# S3 method for sopls R2(object, estimate, newdata, ncomp = "all", individual = FALSE, ...)

# S3 method for sopls RMSEP(object, estimate, newdata, ncomp = "all", individual = FALSE, ...)

pcp(object, ...)

# S3 method for sopls pcp(object, ncomp, ...)

# S3 method for default pcp(object, X, ...)

cvanova(pred, ...)

# S3 method for default cvanova(pred, true, absRes = TRUE, ...)

# S3 method for sopls cvanova(pred, comps, absRes = TRUE, ...)

# S3 method for cvanova print(x, ...)

# S3 method for cvanova summary(object, ...)

# S3 method for cvanova plot(x, ...)

# S3 method for sopls residuals(object, ...)

Value

Returns depend on method used, e.g. predict.sopls returns predicted responses or scores depending on inputs, coef.sopls return regression coefficients, while print and summary methods return the object invisibly.

Arguments

object

A sopls object.

newdata

Optional new data with the same types of predictor blocks as the ones used for fitting the object.

ncomp

An integer vector giving the exact components to apply.

type

A character for predict indicating if responses or scores should be predicted (default = "response", or "scores"), for summary indicating which type of explained variance to compute (default = "train", alternative = "CV").

na.action

Function determining what to do with missing values in newdata.

...

Additional arguments. Currently not implemented.

intercept

A logical indicating if coefficients for the intercept should be included (default = FALSE).

x

A sopls object.

what

A character indicating if summary should include all, validation or training.

digits

The number of digits used for printing.

print.gap

Gap between columns when printing.

classes

A character vector of class labels.

LQ

A character indicating if 'max' (maximum score value), 'lda' or 'qda' should be used when classifying.

estimate

A character indicating if 'train', 'CV' or 'test' results should be displayed.

individual

A logical indicating if results for individual responses should be displayed.

X

A list of data blocks.

pred

An object holding the CV-predicted values (sopls, matrix or list of vectors)

true

A numeric of true response values for CVANOVA.

absRes

A logical indicating if absolute (TRUE) or squared (FALSE) residuals should be computed.

comps

An integer vector giving the exact components to apply.

Details

The parameter ncomp controls which components to apply/extract, resulting in the sequence of components leading up to the specific choice, i.e. ncomp = c(2,2,1) results in the sequence 1,0,0; 2,0,0; 2,1,0; 2,2,0; 2,2,1. Usage of the functions are shown using generics in the examples below. Prediction, regression coefficients, object printing and summary are available through: predict.sopls, coef.sopls, print.sopls and summary.sopls. Explained variances and RMSEP are available through R2.sopls and RMSEP.sopls. Principal components of predictions are available through pcp.sopls. Finally, there is work in progress on classifcation support through classify.sopls.

References

Jørgensen K, Mevik BH, Næs T. Combining designed experiments with several blocks of spectroscopic data. Chemometr Intell Lab Syst. 2007;88(2): 154–166.

See Also

Overviews of available methods, multiblock, and methods organised by main structure: basic, unsupervised, asca, supervised and complex. Common functions for plotting are found in sopls_plots.

Examples

Run this code
data(potato)
mod <- sopls(Sensory[,1] ~ ., data = potato[c(1:3,9)], ncomp = 5, subset = 1:20)
testset <- potato[-(1:20),]; testset$Sensory <- testset$Sensory[,1,drop=FALSE]
predict(mod, testset, ncomp=c(2,1,2))
dim(coef(mod, ncomp=c(3,0,1))) # 
R2(mod, ncomp = c(4,1,2))
print(mod)
summary(mod)

# PCP from sopls object
modMulti <- sopls(Sensory ~ ., data = potato[c(1:3,9)], ncomp = 5, validation = "CV", segment = 5)
(PCP <- pcp(modMulti, c(2,1,2)))
scoreplot(PCP)

# PCP from matrices
preds <- modMulti$validation$Ypred[,,"2,1,2"]
PCP_default <- pcp(preds, potato[1:3])

# CVANOVA
modCV <- sopls(Sensory[,1] ~ ., data = potato[c(1:3,9)], ncomp = 5, validation = "CV", segment = 5)
summary(cva <- cvanova(modCV, "2,1,2"))
plot(cva)

Run the code above in your browser using DataLab