concentration-prediction-from-calibration-model
Summary
Fit a weighted linear regression model to calibration-line samples with known concentrations, then apply the fitted model to predict absolute concentrations for study samples from their measured compound/internal-standard ratios. This enables quantification of metabolites in untargeted metabolomics when authentic standards are available.
When to use
Use this skill when you have (1) a set of calibration samples with known spiked concentrations of target compounds, (2) measured compound/internal-standard ratios for both calibration and study samples, and (3) need to convert ratios to absolute concentrations for reporting. This is typical after batch correction and internal standard normalization in LC-MS/MS metabolomics workflows.
When NOT to use
- Calibration samples show non-linear relationship between ratio and concentration (fit polynomial or non-linear model instead)
- Concentration column is missing entirely or calibration samples are not flagged in metadata
- Study samples have measured ratios far outside the calibration range (extrapolation beyond empirical range is unreliable)
Inputs
- SummarizedExperiment object with assay containing compound/internal-standard ratios
- colData column 'concentration' with known values for calibration samples (NA for study samples)
- rowData and colData metadata identifying sample types (calibration vs. study)
Outputs
- SummarizedExperiment with added assay column containing predicted absolute concentrations for study samples
- Concentration plot (scatter plot with fitted linear model line, calibration points, and sample projections)
- Linear model object (slope, intercept, R² value, residuals)
How to apply
Filter the SummarizedExperiment to retain only calibration samples (where concentration column is not NA). Calculate the compound/internal-standard ratio for each calibration sample. Fit a weighted linear regression model with ratio as predictor and known concentration as response using R's lm() or weighted-lm function (weights typically inversely proportional to variance). Visually inspect the calibration line for linearity and outliers. Apply the fitted model coefficients to all study samples (where concentration = NA) to predict their absolute concentrations from measured ratios. Generate a concentration plot overlay showing calibration points, the fitted line, and projected sample predictions; ideally all predictions fall within or near the calibration range.
Related tools
- mzQuality (R package that implements calibration model fitting and concentration prediction via doAnalysis() and concentrationPlot() functions on SummarizedExperiment objects) — https://github.com/hankemeierlab/mzQuality
- SummarizedExperiment (Bioconductor container class storing assays (ratios), colData (sample metadata including concentrations), and rowData (compound metadata))
- R (base lm/weighted.lm) (Statistical function for fitting linear regression; mzQuality wraps this for weighted fitting by concentration)
- mzQualityDashboard (Interactive Shiny application frontend for visualizing calibration plots and inspecting concentration predictions without scripting) — https://github.com/hankemeierlab/mzQualityDashboard
Examples
exp <- doAnalysis(exp = exp); concentrationPlot(exp, assay = "concentration")
Evaluation signals
- R² value of the fitted model is ≥ 0.95, indicating strong linear fit of calibration samples
- Study sample predictions fall within or close to the concentration range spanned by calibration samples (no large extrapolations)
- Concentration plot visually shows calibration points, fitted line, and study sample projections all on the same axis without obvious outliers or gaps
- No NA or inf values in the output concentration assay for study samples (model was successfully applied)
- Residual plot of calibration samples shows random scatter around zero with no systematic bias
Limitations
- Assumes a linear relationship between compound/IS ratio and absolute concentration; non-linear response (saturation, suppression) will reduce accuracy
- Predictions for study samples with ratios outside calibration range (extrapolation) are unreliable and should be flagged
- Requires sufficient and well-distributed calibration points; sparse or clustered calibration may yield poor model fit
- Weighted regression requires assumption about error variance; unequal weighting can bias estimates if variance model is misspecified
- Internal standard must be stable and not co-elute; if IS area varies unexpectedly, ratio and concentration estimates will be biased
Evidence
- [other] The Concentration Plot is a scatter plot with a linear model added, based on the calculated
ratio and known concentration. The measurements of the other samples are projected on this line, ideally within the range of the calibration line.: "The Concentration Plot is a scatter plot with a linear model added, based on the calculated ratio and known concentration. The measurements of the other samples are projected on this line,"
- [other] Filter the experiment object to retain only calibration samples with known concentrations using the concentration column. Calculate the compound/internal-standard ratio for each calibration sample. Fit a weighted linear regression model with ratio as predictor and concentration as response using R's lm or weighted-lm function.: "Filter the experiment object to retain only calibration samples with known concentrations using the concentration column. Calculate the compound/internal-standard ratio for each calibration sample."
- [intro] by supplying calibration line samples and known concentrations for spiked compounds, mzQuality is able to calculate absolute concentrations: "by supplying calibration line samples and known concentrations for spiked compounds, mzQuality is able to calculate absolute concentrations"
- [readme] If known concentrations for calibration lines have been supplied, the
doAnalysis function will also calculate the concentrations and the corresponding R2 value given the provided calibration lines.: "If known concentrations for calibration lines have been supplied, the doAnalysis function will also calculate the concentrations and the corresponding R2 value given the provided calibration lines."
- [other] Apply the fitted model to all study samples (those with concentration = NA) to predict their absolute concentrations from their measured ratios.: "Apply the fitted model to all study samples (those with concentration = NA) to predict their absolute concentrations from their measured ratios."
1---2name: concentration-prediction-from-calibration-model3description: Use when you have (1) a set of calibration samples with known spiked concentrations of target compounds, (2) measured compound/internal-standard ratios for both calibration and study samples, and (3) need to convert ratios to absolute concentrations for reporting.4license: CC-BY-4.05---67# concentration-prediction-from-calibration-model89## Summary1011Fit a weighted linear regression model to calibration-line samples with known concentrations, then apply the fitted model to predict absolute concentrations for study samples from their measured compound/internal-standard ratios. This enables quantification of metabolites in untargeted metabolomics when authentic standards are available.1213## When to use1415Use this skill when you have (1) a set of calibration samples with known spiked concentrations of target compounds, (2) measured compound/internal-standard ratios for both calibration and study samples, and (3) need to convert ratios to absolute concentrations for reporting. This is typical after batch correction and internal standard normalization in LC-MS/MS metabolomics workflows.1617## When NOT to use1819- Calibration samples show non-linear relationship between ratio and concentration (fit polynomial or non-linear model instead)20- Concentration column is missing entirely or calibration samples are not flagged in metadata21- Study samples have measured ratios far outside the calibration range (extrapolation beyond empirical range is unreliable)2223## Inputs2425- SummarizedExperiment object with assay containing compound/internal-standard ratios26- colData column 'concentration' with known values for calibration samples (NA for study samples)27- rowData and colData metadata identifying sample types (calibration vs. study)2829## Outputs3031- SummarizedExperiment with added assay column containing predicted absolute concentrations for study samples32- Concentration plot (scatter plot with fitted linear model line, calibration points, and sample projections)33- Linear model object (slope, intercept, R² value, residuals)3435## How to apply3637Filter the SummarizedExperiment to retain only calibration samples (where concentration column is not NA). Calculate the compound/internal-standard ratio for each calibration sample. Fit a weighted linear regression model with ratio as predictor and known concentration as response using R's lm() or weighted-lm function (weights typically inversely proportional to variance). Visually inspect the calibration line for linearity and outliers. Apply the fitted model coefficients to all study samples (where concentration = NA) to predict their absolute concentrations from measured ratios. Generate a concentration plot overlay showing calibration points, the fitted line, and projected sample predictions; ideally all predictions fall within or near the calibration range.3839## Related tools4041- **mzQuality** (R package that implements calibration model fitting and concentration prediction via doAnalysis() and concentrationPlot() functions on SummarizedExperiment objects) — https://github.com/hankemeierlab/mzQuality42- **SummarizedExperiment** (Bioconductor container class storing assays (ratios), colData (sample metadata including concentrations), and rowData (compound metadata))43- **R (base lm/weighted.lm)** (Statistical function for fitting linear regression; mzQuality wraps this for weighted fitting by concentration)44- **mzQualityDashboard** (Interactive Shiny application frontend for visualizing calibration plots and inspecting concentration predictions without scripting) — https://github.com/hankemeierlab/mzQualityDashboard4546## Examples4748```49exp <- doAnalysis(exp = exp); concentrationPlot(exp, assay = "concentration")50```5152## Evaluation signals5354- R² value of the fitted model is ≥ 0.95, indicating strong linear fit of calibration samples55- Study sample predictions fall within or close to the concentration range spanned by calibration samples (no large extrapolations)56- Concentration plot visually shows calibration points, fitted line, and study sample projections all on the same axis without obvious outliers or gaps57- No NA or inf values in the output concentration assay for study samples (model was successfully applied)58- Residual plot of calibration samples shows random scatter around zero with no systematic bias5960## Limitations6162- Assumes a linear relationship between compound/IS ratio and absolute concentration; non-linear response (saturation, suppression) will reduce accuracy63- Predictions for study samples with ratios outside calibration range (extrapolation) are unreliable and should be flagged64- Requires sufficient and well-distributed calibration points; sparse or clustered calibration may yield poor model fit65- Weighted regression requires assumption about error variance; unequal weighting can bias estimates if variance model is misspecified66- Internal standard must be stable and not co-elute; if IS area varies unexpectedly, ratio and concentration estimates will be biased6768## Evidence6970- [other] The Concentration Plot is a scatter plot with a linear model added, based on the calculated `ratio` and known `concentration`. The measurements of the other samples are projected on this line, ideally within the range of the calibration line.: "The Concentration Plot is a scatter plot with a linear model added, based on the calculated `ratio` and known `concentration`. The measurements of the other samples are projected on this line,"71- [other] Filter the experiment object to retain only calibration samples with known concentrations using the concentration column. Calculate the compound/internal-standard ratio for each calibration sample. Fit a weighted linear regression model with ratio as predictor and concentration as response using R's lm or weighted-lm function.: "Filter the experiment object to retain only calibration samples with known concentrations using the concentration column. Calculate the compound/internal-standard ratio for each calibration sample."72- [intro] by supplying calibration line samples and known concentrations for spiked compounds, mzQuality is able to calculate absolute concentrations: "by supplying calibration line samples and known concentrations for spiked compounds, mzQuality is able to calculate absolute concentrations"73- [readme] If known concentrations for calibration lines have been supplied, the `doAnalysis` function will also calculate the concentrations and the corresponding R2 value given the provided calibration lines.: "If known concentrations for calibration lines have been supplied, the `doAnalysis` function will also calculate the concentrations and the corresponding R2 value given the provided calibration lines."74- [other] Apply the fitted model to all study samples (those with concentration = NA) to predict their absolute concentrations from their measured ratios.: "Apply the fitted model to all study samples (those with concentration = NA) to predict their absolute concentrations from their measured ratios."