This function computes the net analyte signal (NAS) of each sample for a multivariate inverse calibration model (PLS or PCR), following Lorber (1997) and Faber (1998), and the figures of merit derived from it: sensitivity, selectivity and, when the instrumental noise is known, analytical sensitivity, limits of detection and quantification, and signal-to-noise ratios.
Arguments
- x
A numeric matrix or data frame of calibration spectra (one per row).
- y
A numeric vector (or one-column matrix or data frame) of analyte concentrations.
- ncomp
A positive integer giving the number of latent variables of the calibration model. Default is 5.
- method
The inverse calibration model:
"pls"(default, SIMPLS) or"pcr".- center
A logical value indicating whether to mean-center
xandy. Default isTRUE.- scale
A logical value indicating whether to scale the columns of
xto unit variance. Default isFALSE. The figures of merit are then expressed in scaled units.- noise
An optional positive number: the standard deviation of the instrumental noise, in the units of
x. Needed for the analytical sensitivity, LOD, LOQ and signal-to-noise ratios.
Value
An object of class specproc_nas, a list with:
nas: A tibble with one row per calibration sample: the scalarnas, theselectivity, the fitted concentrationfittedand, ifnoiseis given, the signal-to-noise ratiosnr.figures_of_merit: A named vector with thesensitivity, the mean selectivity (selectivity) and, ifnoiseis given,analytical_sensitivity,lodandloq.nas_vectors: A tibble of the NAS vectors \(\textbf{r}_i^*\) of the calibration samples.coefficients: The regression vector \(\textbf{b}\).ncomp,method,noise,center,scaleandy_center: the model settings and preprocessing parameters.
Use predict() to compute the NAS, selectivity and predicted concentration of new samples.
Details
The net analyte signal is the part of a spectrum that is unique to the analyte, i.e. orthogonal to the spectral contributions of all other constituents (the interferents). In an inverse calibration model \(\hat{y} = \bar{y} + (\textbf{x} - \bar{\textbf{x}})^T\textbf{b}\) with \(A\) latent variables, the interferent space is spanned by the calibration spectra reconstructed from the model, from which the part explained by \(\hat{\textbf{y}}\) has been removed. The regression vector \(\textbf{b}\) is orthogonal to this space, so the NAS space within the model is one-dimensional and spanned by \(\textbf{b}\) (Faber, 1998; Bro and Andersen, 2003). The NAS vector of sample \(i\) is therefore $$\textbf{r}_i^* = \frac{(\textbf{x}_i - \bar{\textbf{x}})^T\textbf{b}}{\|\textbf{b}\|^2}\,\textbf{b}$$ and its signed length, the scalar NAS, is $$\mathrm{NAS}_i = \frac{(\textbf{x}_i - \bar{\textbf{x}})^T\textbf{b}}{\|\textbf{b}\|} = \frac{\hat{y}_i - \bar{y}}{\|\textbf{b}\|}$$
The figures of merit follow Olivieri et al. (2006):
Sensitivity, \(\mathrm{SEN} = 1 / \|\textbf{b}\|\): the NAS produced by a unit change in concentration, in signal units per concentration unit.
Selectivity of sample \(i\), \(\mathrm{SEL}_i = |\mathrm{NAS}_i| / \|\textbf{x}_i - \bar{\textbf{x}}\|\): the fraction of the (centered) signal that is used for prediction, between 0 and 1.
With the standard deviation of the instrumental noise \(\sigma_x\) (
noise): the analytical sensitivity \(\gamma = \mathrm{SEN} / \sigma_x\), whose inverse is the smallest concentration difference that can be distinguished; the limit of detection \(\mathrm{LOD} = 3.3\,\sigma_x / \mathrm{SEN}\); the limit of quantification \(\mathrm{LOQ} = 10\,\sigma_x / \mathrm{SEN}\); and the signal-to-noise ratio of each sample, \(\mathrm{NAS}_i / \sigma_x\).
The LOD and LOQ above account for the instrumental noise only, not for
the uncertainty of the calibration model or of the reference values, so
they are lower bounds. The noise level must be estimated independently,
for example as the standard deviation of the differences between repeated
spectra of the same sample divided by \(\sqrt{2}\), in the same units
(and after the same preprocessing) as x.
All quantities depend on the number of latent variables ncomp, which
should be chosen by validation beforehand.
Before specProc 0.4.0, nas() returned spectra filtered by direct
orthogonalization; that correction is available from
direct_orthogonal().
References
Lorber, A. (1986). Error propagation and figures of merit for quantification by solving matrix equations. Analytical Chemistry, 58(6):1167-1172.
Lorber, A., Faber, K., Kowalski, B.R. (1997). Net analyte signal calculation in multivariate calibration. Analytical Chemistry, 69(8):1620-1626.
Faber, N.M. (1998). Efficient computation of net analyte signal vector in inverse multivariate calibration models. Analytical Chemistry, 70(23):5108-5110.
Bro, R., Andersen, C.M. (2003). Theory of net analyte signal vectors in inverse regression. Journal of Chemometrics, 17(12):646-652.
Olivieri, A.C., Faber, N.M., Ferré, J., Boqué, R., Kalivas, J.H., Mark, H. (2006). Uncertainty estimation and figures of merit for multivariate calibration (IUPAC Technical Report). Pure and Applied Chemistry, 78(3):633-661.
See also
direct_orthogonal() for the filter formerly returned by
nas().
Examples
data(forageLIBS)
spectra <- forageLIBS[-(1:14)] # the spectral channels
# the three samples measured twice
twice <- forageLIBS$Sample[duplicated(forageLIBS$Sample)]
first <- match(twice, forageLIBS$Sample)
second <- vapply(twice, function(s) max(which(forageLIBS$Sample == s)), integer(1))
# the noise of the spectra, from the differences between repeated measurements
noise <- stats::sd(as.matrix(spectra[second, ]) - as.matrix(spectra[first, ])) / sqrt(2)
cal <- 1:300
fit <- nas(spectra[cal, ], forageLIBS$K[cal], ncomp = 7, noise = noise)
fit
#> Net analyte signal (PLS model, 7 components)
#>
#> Calibration samples: 300
#> Sensitivity: 15538
#> Mean selectivity: 0.108
#> Noise (sd): 694.6
#> Analytical sensitivity: 22.37
#> LOD: 0.1475
#> LOQ: 0.447
head(fit$nas)
#> # A tibble: 6 × 4
#> nas selectivity fitted snr
#> <dbl> <dbl> <dbl> <dbl>
#> 1 13972. 0.354 2.91 20.1
#> 2 5715. 0.155 2.38 8.23
#> 3 2864. 0.0570 2.20 4.12
#> 4 3420. 0.0452 2.23 4.92
#> 5 -5771. 0.130 1.64 -8.31
#> 6 955. 0.0332 2.08 1.37
# the net analyte signal and selectivity of new spectra
head(predict(fit, spectra[-cal, ]))
#> # A tibble: 6 × 4
#> nas selectivity predicted snr
#> <dbl> <dbl> <dbl> <dbl>
#> 1 2284. 0.0194 2.16 3.29
#> 2 3659. 0.0376 2.25 5.27
#> 3 9189. 0.173 2.61 13.2
#> 4 1537. 0.0181 2.11 2.21
#> 5 949. 0.0129 2.08 1.37
#> 6 -5425. 0.0648 1.67 -7.81
