predict.specproc_nas: Net Analyte Signal of New Samples

View source: R/nas.R

predict.specproc_nasR Documentation

Net Analyte Signal of New Samples

Description

Computes the net analyte signal, selectivity and predicted concentration of new samples with a model fitted by nas().

Usage

## S3 method for class 'specproc_nas'
predict(object, newdata, ...)

Arguments

object

An object returned by nas().

newdata

A numeric matrix or data frame of new spectra, with the same variables as the calibration spectra.

...

Not used.

Value

A tibble with one row per new sample and columns nas, selectivity, predicted and, if the model has a noise level, snr.

See Also

nas()

Examples

data(forageLIBS)
wl <- suppressWarnings(as.numeric(names(forageLIBS)))
spectra <- forageLIBS[which(wl > 760 & wl < 780)]  # the K I resonance lines
cal <- 1:300
fit <- nas(spectra[cal, ], forageLIBS$K[cal], ncomp = 3)
head(predict(fit, spectra[-cal, ]))

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