Skip to contents

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_method and fit_weighting for all features, if overwrite_metadata is TRUE. Alternatively, the model and weighting can be defined individually for each feature in the feature metadata (columns curve_fit_method and fit_weighting). If these details are missing in the metadata, the default values provided via fit_method and fit_weighting will be used.

Usage

calc_calibration_results(
  data = NULL,
  overwrite_metadata = FALSE,
  fit_method = c("linear", "quadratic"),
  fit_weighting = c("none", "1/x", "1/x^2"),
  error_missing_annotation = TRUE,
  include_fit_object = FALSE
)

Arguments

data

A MidarExperiment object containing the data to be used for calibration.

overwrite_metadata

A logical value (TRUE or FALSE). If TRUE, the function will ignore any fit method and weighting settings defined in the metadata and use the provided fit_method and fit_weighting values for all analytes.

fit_method

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.

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.

error_missing_annotation

If TRUE, 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 the metrics_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 2x the concentration of 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.