slope_bias: Slope and Bias Correction of Predictions

View source: R/transfer.R

slope_biasR Documentation

Slope and Bias Correction of Predictions

Description

Corrects the predictions of a model applied to spectra of another instrument (or measured under other conditions) by a straight line, estimated on transfer samples whose reference values are known.

Usage

slope_bias(predicted, reference, slope = TRUE)

Arguments

predicted

The predictions of the model for the secondary spectra of the transfer samples.

reference

Their reference values (or the predictions for their primary spectra).

slope

A logical: correct the slope and the bias (TRUE, default), or the bias only.

Details

The model of the primary instrument, applied to the secondary spectra of the transfer samples, gives predictions \hat{y}; the reference values y are regressed on them, y = a + b\,\hat{y}, and the predictions of new secondary spectra are corrected likewise. With slope = FALSE, only the bias is corrected (b = 1). The correction leaves the spectra and the model unchanged, so it suits differences that affect all samples alike; it cannot correct differences of spectral shape that change the ranking of the samples (see ds(), sst() or pds()). The tests of the bias against 0 and of the slope against 1 tell whether the correction is needed.

Value

An object of class specproc_slope_bias, a list with the coefficients (a tibble with the bias and slope, their standard errors, the values they are tested against and the p-values), the number of transfer samples n, and the root mean square errors before and after correction (rmse). Use predict() to correct new predictions.

Author(s)

Christian L. Goueguel

References

  • Feudale, R.N., Woody, N.A., Tan, H., Myles, A.J., Brown, S.D., Ferré, J. (2002). Transfer of multivariate calibration models: a review. Chemometrics and Intelligent Laboratory Systems, 64(2):181-192.

See Also

predict.specproc_slope_bias(), ds(), sst(), pds()

Examples

# predictions of the potassium content of transfer samples on a second
# instrument, 10% too high and offset by 0.2%
set.seed(1)
reference <- runif(20, 0.5, 4)
predicted <- 0.2 + 1.1 * reference + rnorm(20, sd = 0.05)
correction <- slope_bias(predicted, reference)
correction
predict(correction, c(1.3, 2.4, 3.5))

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