applicability_domain: Applicability Domain of a Calibration

View source: R/applicability_domain.R

applicability_domainR Documentation

Applicability Domain of a Calibration

Description

Describes the space of the calibration spectra by a principal component analysis (PCA), so that the spectra of new samples can be flagged when they lie outside it: their predictions, by any model calibrated on these spectra, are then extrapolations.

Usage

applicability_domain(
  x,
  ncomp = NULL,
  var_explained = 0.99,
  conf_level = 0.99,
  center = TRUE,
  scale = FALSE
)

Arguments

x

The calibration spectra: a numeric matrix or data frame, one spectrum per row.

ncomp

The number of principal components. By default, chosen from var_explained.

var_explained

The fraction of the variance explained by the components, when ncomp is not given. Default is 0.99.

conf_level

The confidence level of the limits. Default is 0.99.

center, scale

Passed to stats::prcomp(). Default is TRUE and FALSE.

Details

A new spectrum is outside the applicability domain when its Hotelling T^2, the distance within the plane of the first ncomp components, or its Q residual, the squared distance to that plane, exceeds its limit at conf_level (see q_residuals()). A high T^2 is a sample more extreme than the calibration samples (for example, a higher concentration); a high Q, a sample of another kind (another matrix, a contamination, an instrumental problem). The limit of T^2 is that of a new observation, and that of Q the Jackson-Mudholkar limit.

By default, ncomp is the smallest number of components that explain the fraction var_explained of the variance of the calibration spectra. Prepare the spectra as for the model (baseline correction, normalization), since the domain is that of the variables the model uses. The PCA is classical: remove the outlying calibration spectra first (see robpca()).

Value

An object of class specproc_domain, a list with the pca (stats::prcomp() fit), the number of components ncomp, the fraction of the variance they explained, the conf_level and the limits of T^2 and Q. predict() flags new spectra.

Author(s)

Christian L. Goueguel

References

  • Jackson, J.E., Mudholkar, G.S. (1979). Control procedures for residuals associated with principal component analysis. Technometrics, 21(3):341-349.

  • Nomikos, P., MacGregor, J.F. (1995). Multivariate SPC charts for monitoring batch processes. Technometrics, 37(1):41-59.

See Also

predict.specproc_domain(), q_residuals(), plot_influence()

Examples

data(forageLIBS)
wl <- suppressWarnings(as.numeric(names(forageLIBS)))
spectra <- as.matrix(forageLIBS[which(wl > 380 & wl < 430)])
domain <- applicability_domain(spectra[1:300, ])
domain
flags <- predict(domain, spectra[301:368, ])
table(flags$inside)

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