pds: Piecewise Direct Standardization

View source: R/pds.R

pdsR Documentation

Piecewise Direct Standardization

Description

The pds function performs Piecewise Direct Standardization (PDS), a method proposed by Wang et al. (1991) to transfer spectra from one instrument to another. Optionally, the local models can be blended with a global PLSR model (direct standardization), which can lead to better transfer performance when the instrumental differences are not purely local.

Usage

pds(x1, x2, win = 5, ncomp = 2, alpha = 0)

Arguments

x1

A matrix or data frame containing spectra acquired with the primary (reference) instrument.

x2

A matrix or data frame containing spectra of the same samples acquired with the secondary instrument, to be standardized.

win

An integer specifying the half size of the moving window used for PLSR. A larger value may improve the transfer but will increase computational time. Default is 5.

ncomp

An integer specifying the number of components to be used in PLSR. Typically, a small number (e.g., 2-5) is sufficient. Default is 2.

alpha

A numeric value between 0 and 1 specifying the weight for the global PLSR model. A value of 0 (default) corresponds to the original PDS method, while a value of 1 corresponds to using only the global PLSR model.

Details

For each wavelength j of the primary (reference) instrument, a PLSR model is fitted between the response of the primary instrument at j and the responses of the secondary instrument in the window [j - win, j + win] (truncated at the edges of the spectrum). The regression coefficients are stored in a banded transfer matrix \textbf{F}, and the intercepts in a vector \textbf{b}_0. Spectra measured on the secondary instrument are then standardized as

\textbf{X}_{2,std} = \textbf{X}_2 \textbf{F} + \textbf{1}\textbf{b}_0^T

When alpha > 0, a global PLSR model mapping the whole secondary spectrum to the whole primary spectrum is also fitted, and the transfer matrix and intercept are (1 - \alpha) times the local ones plus \alpha times the global ones.

Value

An object of class specproc_transfer, a list with

transfer_matrix

The p \times p transfer matrix \textbf{F}.

intercept

A vector of length p containing the intercepts.

and the settings of the transfer. Use predict() to transfer secondary spectra.

Author(s)

Christian L. Goueguel

References

  • Wang, Y., Veltkamp, D.J., Kowalski, B.R., (1991). Multivariate instrument standardization. Analytical Chemistry, 63(23):2750-2756.

  • Bouveresse, E., Massart, D.L., (1996). Improvement of the piecewise direct standardization procedure for the transfer of NIR spectra for multivariate calibration. Chemometrics and Intelligent Laboratory Systems, (32)2:201-213.

See Also

ds(), sst(), slope_bias(), predict.specproc_transfer()

Examples

data(forageLIBS)
wl <- suppressWarnings(as.numeric(names(forageLIBS)))
spectra <- forageLIBS[which(wl > 760 & wl < 780)]  # the K I resonance lines
# a second instrument, with a shifted and less sensitive response
x1 <- as.matrix(spectra[1:30, ])
x2 <- 0.8 * cbind(x1[, -1], x1[, ncol(x1)]) + 50
res <- pds(x1, x2, win = 3, ncomp = 2)
# spectra of the second instrument transferred to the first one
transferred <- predict(res, x2)
max(abs(transferred - x1)) / max(x1)

specProc documentation built on Nov. 20, 2026, 5:11 p.m.