Calculate external calibration curve results
Source:R/calc-calibrations.R
calc_calibration_results.Rd
Calibration curves are calculated for each feature using ISTD-normalized
intensities and the corresponding concentrations of calibration samples, as
defined in the qc_concentrations
metadata. The regression fit model (linear
or quadratic) and the weighting method (either "none", "1/x", or "1/x^2")
can be defined globally via the arguments fit_model
and fit_weighting
for all features, if overwrite_fit_param
is TRUE
. Alternatively, the
model and weighting can be defined individually for each feature in the
feature
metadata (columns curve_fit_model
and fit_weighting
). If
these details are missing in the metadata, the default values provided via
fit_model
and fit_weighting
will be used.
Usage
calc_calibration_results(
data = NULL,
variable = "feature_norm_intensity",
include_qualifier = TRUE,
overwrite_fit_param = TRUE,
fit_model,
fit_weighting,
ignore_missing_annotation = FALSE,
include_fit_object = FALSE
)
Arguments
- data
A
MidarExperiment
object containing the data to be used for calibration.- variable
A character string specifying the variable for calibration. Use
"feature_norm_intensity"
for typical scenarios involving internal standardization. When performing only external standardization, without internal standardization, use"feature_intensity"
.- include_qualifier
A logical value. If
TRUE
, the function will include quantifier features in the calibration curve calculations.- overwrite_fit_param
If
TRUE
, the function will ignore any fit method and weighting settings defined in the metadata and use the providedfit_model
andfit_weighting
values for all analytes.- fit_model
A character string specifying the default regression fit method to use for the calibration curve. Must be one of
"linear"
or"quadratic"
. This method will be applied if no specific fit method is defined for a feature in the metadata, or whenoverwrite_fit_param = TRUE
.- fit_weighting
A character string specifying the default weighting method for the regression points in the calibration curve. Must be one of
"none"
,"1/x"
, or"1/x^2"
. This method will be applied if no specific weighting method is defined for a feature in the metadata, or whenoverwrite_fit_param = TRUE
.- ignore_missing_annotation
If
FALSE
, an error will be raised if any of the following information is missing: calibration curve data, ISTD mix volume, and sample amounts for any feature.- include_fit_object
If
TRUE
, the function will return the full regression fit objects for each feature in themetrics_calibration
table.
Value
A modified MidarExperiment
object with an updated
metrics_calibration
table containing the calibration curve results,
including concentrations, LoD, and LoQ values for each feature.
Details
Additionally, the limit of detection (LoD) and limit of quantification (LoQ) are calculated for each feature based on the calibration curve. LoD is calculated as 3 times the sample standard error of the regression residuals divided by the regression slope, and LoQ is 10 times the same ratio. In the case of a quadratic fit, LoD and LoQ are calculated using the slope at the concentration of the lowest calibration point.
The results of the regression and the calculated LoD and LoQ values are
stored in the metrics_calibration
table of the returned MidarExperiment
object.
See also
quantify_by_calibration()
for calculating concentrations based on
external calibration curves.