View source: R/calibration_curve.R
| predict.specproc_calibration | R Documentation |
Computes the concentrations of new samples from their signal, by inverse
prediction from a curve fitted with calibration_curve(), or the
expected signal at given concentrations, with confidence or prediction
intervals.
## S3 method for class 'specproc_calibration'
predict(
object,
newdata,
replicates = 1,
level = 0.95,
type = "concentration",
interval = "prediction",
...
)
object |
A curve fitted with |
newdata |
For |
replicates |
The number of replicate measurements averaged in each signal. Default is 1. |
level |
The confidence level of the intervals. Default is 0.95. |
type |
|
interval |
For |
... |
Not used. |
With type = "concentration" (default), the interval of each
concentration combines the uncertainty of the curve with the noise of the
new signal, the mean of replicates measurements (see
calibration_curve()).
With type = "signal", newdata holds concentrations, and the interval
is either the confidence interval of the mean signal (interval = "confidence") or the prediction interval of a new signal, the mean of
replicates measurements (interval = "prediction", default). For a
weighted curve, the noise of a new signal follows the weights at its
concentration (numeric weights give new samples a weight of 1).
For type = "concentration", a tibble with the signal, the
predicted concentration, its standard error se, the interval
(lower, upper), whether it is below the limit of detection
(below_lod) or of quantification (below_loq), whether it lies
outside the range of the standards (outside_range, an
extrapolation), and, with the ISO 11843 limits, whether the element is
detected (above the critical value). For type = "signal", a tibble with the concentration, the predicted signal,
its standard error se and the interval (lower, upper).
calibration_curve(), plot_calibration()
data(forageLIBS)
# the K I 769.90 nm line, normalized to the C I 247.86 nm line of the matrix
lines <- line_intensities(forageLIBS[-(1:14)], c(C = 247.856, K = 769.896), baseline = TRUE)
standards <- data.frame(
K = forageLIBS$K,
signal = lines$intensity[lines$line == "K"] / lines$intensity[lines$line == "C"]
)
cal <- calibration_curve(standards[1:300, ], signal, K)
predict(cal, standards$signal[301:305])
# the signal expected at given contents (% K)
predict(cal, c(1, 2, 3), type = "signal")
predict(cal, c(1, 2, 3), type = "signal", interval = "confidence")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.