Description Usage Arguments Details Value References See Also Examples
purity
is a class for resolving pure spectra and contributions from spectra of mixtures
using pure variable approach.
1 2 |
spectra |
a matrix with spectral data |
ncomp |
number of pure components to identify |
offset |
offset in percent for calculation of parameter alpha |
by.spec |
logical, should the algorithm works with spectra (rows) or with concentrations (columns) |
use.deriv |
shall a second derivative be used (0 - no, 1 - only for unmixing, 2 - both for locating pure variables and for unmixing) |
savgol |
vector of parameters for Savitzky-Goley filter: derivative order, width of filter and polynomial order |
exclude |
vector of column numbers that should be excluded when pure variables are being detected |
wavelength |
a vector with wavelength if necessary |
The unmixing is done with two steps. First, pure variables are identified using methods, described in [1-2]. Then the selected pure variables are used to resolve the pure spectra and contributions with ordinary least squares.
By default method works with spectra, rows of the data matrix, but it is possible to make the
unmixing using concentration profiles (with parameter by.spec
set to FALSE
). Also
an inverse second derivative of the data can be used for either unmixing step or for both
identifying the pure variables and for unmixing in case if spectral peaks are overlapped.
The method returns an object of purity
class - a list with with following fields:
spec |
resolved spectra of pure components. |
conc |
resolved concentrations of pure components. |
ncomp |
number of resolved components. |
purvars |
vector with indices for pure variables. |
purityspec |
matrix with purity values for each resolved components. |
stdspec |
matrix with weighted standard deviation values. |
purity |
vector with purity values for resolved components. |
wavelength |
vector with wavelength/wavebands/wavenumbers. |
1. W. Windig, J. Guilment, Anal. Chem. 63 (1991) 1425-1432. 2. W. Windig, Chemom. Intell. Lab. Syst. 23 (1994) 71-86.
The class has numerous methods for exploring and refining the unmixing results.
print | prints information about a purity object. |
summary | shows summary statistics for the object. |
plot | plot overview of unmixing results. |
plotPurity | shows purity values and weighted standard deviation as a line plot. |
plotSpectra | shows a plot with resolved spectra. |
plotConcentrations | shows a plot with resolved concentrations. |
plotVariance | shows a plot with residual variance vs. number of components. |
plotSpectraComparison | compares resolved and ethalon spectra if available. |
image.purity | if data is a hypercube, shows resolved concetration map as an image. |
explore | a GUI tool to explore and tune the results (requires `shiny`). |
The steps of the algorithms can be also applied separately with functions
getpurevars
and unmix
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | ## 1. Resolving of Raman spectra of carbonhydrates
# get the data
data(puredata)
# do unmixing with standard settings
res = purity(carbs$D, 3, wavelength = carbs$wavelength)
summary(res)
plot(res)
# compare the unmixed spectra with ethalon
par(mfrow = c(3, 1))
plotSpectraComparison(res, carbs$S, 1)
plotSpectraComparison(res, carbs$S, 2)
plotSpectraComparison(res, carbs$S, 3)
par(mfrow = c(1, 1))
# do unmixing with two different settings and compare purity for first component
res1 = purity(carbs$D, 3, offset = 5, use.deriv = FALSE)
res2 = purity(carbs$D, 3, offset = 15, use.deriv = TRUE, savgol = c(2, 5, 2))
par(mfrow = c(2, 1))
plotPurity(res1, 1)
plotPurity(res2, 1)
par(mfrow = c(1, 1))
## 2. Hyperspectral image of oil-in-water emulsion
# get the data
data(puredata)
# it is important that variable has proper attributes
show(attr(hsi$D, 'width'))
show(attr(hsi$D, 'height'))
# do unmixing
res = purity(hsi$D, 3, offset = 3, wavelength = hsi$wavelength)
summary(res)
plot(res)
# show concentration maps
par(mfrow = c(1, 3))
image(res, 1)
image(res, 2)
image(res, 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.