purevars: vector with indices for pure variables (optional, if you want to provide the variables directly).
offset: offset for correcting noise in computing maximum angles (should be value within [0, 1)).
exclrows: rows to be excluded from calculations (numbers, names or vector with logical values).
exclcols: columns to be excluded from calculations (numbers, names or vector with logical values).
info: a short text with description of the case (optional).
Returns
Returns an object of mcrpure class with the following fields: - resspec: matrix with resolved spectra.
rescont: matrix with resolved contributions.
purevars: indices of the selected pure variables.
purevals: purity values for the selected pure variables.
purityspec: purity spectra (matrix with purity values for each variable and component).
expvar: vector with explained variance for each component (in percent).
cumexpvar: vector with cumulative explained variance for each component (in percent).
offset: offset value used to compute the purity
ncomp: number of resolved components
info: information about the model, provided by user when build the model.
More details and examples can be found in the Bookdown tutorial.
Details
The method estimates purity of each variable and then uses the purest ones to decompose the spectral data into spectra (resspec) and contributions (rescont) of individual chemical components by ordinary least squares.
The pure variabes are identified using stepwise maximum angle calculations and described in detail in [1]. So the purity of a spectral variable (wavelength, wavenumber) is actually an angle (measured in degrees) between the variable and vector of ones for the first component; and between the variable and space formed by previously found pure variables for the other components.
Examples
library(mdatools)# resolve mixture of carbonhydrates Raman spectradata(carbs)m = mcrpure(carbs$D, ncomp =3)# examples for purity spectra plot (you can select which components to show)par(mfrow = c(2,1))plotPuritySpectra(m)plotPuritySpectra(m, comp =2:3)# you can do it manually and combine e.g. with original spectrapar(mfrow = c(1,1))mdaplotg( list("spectra"= prep.norm(carbs$D,"area"),"purity"= prep.norm(mda.subset(mda.t(m$resspec),1),"area")), col = c("gray","red"), type ="l")# show the maximum purity for each componentpar(mfrow = c(1,1))plotPurity(m)# plot cumulative and individual explained variancepar(mfrow = c(1,2))plotVariance(m)plotCumVariance(m)# plot resolved spectra (all of them or individually)par(mfrow = c(2,1))plotSpectra(m)plotSpectra(m, comp =2:3)# plot resolved contributions (all of them or individually)par(mfrow = c(2,1))plotContributions(m)plotContributions(m, comp =2:3)# of course you can do this manually as well, e.g. show original# and resolved spectrapar(mfrow = c(1,1))mdaplotg( list("original"= prep.norm(carbs$D,"area"),"resolved"= prep.norm(mda.subset(mda.t(m$resspec),1),"area")), col = c("gray","red"), type ="l")# in case if you have reference spectra of components you can compare them with# the resolved ones:par(mfrow = c(3,1))for(i in1:3){ mdaplotg( list("pure"= prep.norm(mda.subset(mda.t(carbs$S),1),"area"),"resolved"= prep.norm(mda.subset(mda.t(m$resspec),1),"area")), col = c("gray","red"), type ="l", lwd = c(3,1))}# See bookdown tutorial for more details.
References
Willem Windig, Neal B. Gallagher, Jeremy M. Shaver, Barry M. Wise. A new approach for interactive self-modeling mixture analysis. Chemometrics and Intelligent Laboratory Systems, 77 (2005) 85–96. DOI: 10.1016/j.chemolab.2004.06.009
See Also
Methods for mcrpure objects:
summary.mcrpure
shows some statistics for the case.
unmix.mcrpure
makes unmixing of new set of spectra.
predict.mcrpure
computes contributions by projection of new spectra to the resolved ones.