Last data update: 2014.03.03

R: Finding the most dissimilar variables in a data matrix: the...
opaR Documentation

Finding the most dissimilar variables in a data matrix: the Orthogonal Projection Approach

Description

This function finds the set of most dissimilar rows in a data matrix. If no initial selection is presented, the first object is selected by comparison with the vector of column means. As a distance function the determinant of the crossproduct matrix is used.

Usage

opa(x, ncomp, initXref = NULL)

Arguments

x

Data matrix (numerical). May not contain missing values.

ncomp

Number of rows to be selected.

initXref

Optional matrix to be expanded - should be a subset of the rows to select.

Value

The function returns a submatrix of X, where the columns contain the (unit-length scaled) spectra from the input data that are most dissimilar.

Author(s)

Ron Wehrens

References

F. Questa Sanchez et al.: Algorithm for the assessment of peak purity in liquid chromatography with photodiode-array detection. Analytica Chimica Acta 285:181-192 (1994)

R. Wehrens: Chemometrics with R. Springer Verlag, Heidelberg (2011)

Examples

data(tea)

tea <- lapply(tea.raw, preprocess, maxI = 100)

ncomp <- 7
spectra <- opa(tea, ncomp)

myPalette <- colorRampPalette(c("black", "red", "blue", "green"))
mycols <- myPalette(ncomp)
matplot(as.numeric(rownames(spectra)), spectra, type = "l", lty = 1,
        xlab = expression(lambda), ylab = "", col = mycols)
legend("topright", legend = paste("Comp.", 1:ncomp), col = mycols,
       lty = 1, ncol = 2, bty = "n")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(alsace)
Loading required package: ALS
Loading required package: nnls
Loading required package: Iso
Iso 0.0-17
Loading required package: ptw
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/alsace/opa.Rd_%03d_medium.png", width=480, height=480)
> ### Name: opa
> ### Title: Finding the most dissimilar variables in a data matrix: the
> ###   Orthogonal Projection Approach
> ### Aliases: opa
> ### Keywords: manip
> 
> ### ** Examples
> 
> data(tea)
> 
> tea <- lapply(tea.raw, preprocess, maxI = 100)
> 
> ncomp <- 7
> spectra <- opa(tea, ncomp)
> 
> myPalette <- colorRampPalette(c("black", "red", "blue", "green"))
> mycols <- myPalette(ncomp)
> matplot(as.numeric(rownames(spectra)), spectra, type = "l", lty = 1,
+         xlab = expression(lambda), ylab = "", col = mycols)
> legend("topright", legend = paste("Comp.", 1:ncomp), col = mycols,
+        lty = 1, ncol = 2, bty = "n")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>