| Title: | Validation of Analytical Calibration Curves |
|---|---|
| Description: | Provides transparent tools for fitting and evaluating analytical calibration curves. Ordinary and weighted least squares fits are supported, together with lack-of-fit, heteroscedasticity and influence diagnostics, back-calculation, prediction uncertainty and publication-ready base graphics. The workflow is designed to support validation studies rather than rely on a single goodness-of-fit statistic. Methods follow Magnusson and Ornemark (2014) <https://www.eurachem.org/images/stories/Guides/pdf/MV_guide_2nd_ed_EN.pdf> and International Council for Harmonisation (2023) <https://database.ich.org/sites/default/files/ICH_Q2%28R2%29_Guideline_2023_1130_ErrorCorrection_2025.pdf>. |
| Authors: | Isaque Wilkson de Sousa Brandão [aut, cre] |
| Maintainer: | Isaque Wilkson de Sousa Brandão <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-09-22 09:58:48 UTC |
| Source: | https://github.com/isaquebrand/valcurvar |
Fit an analytical calibration curve
ajustar_curva( dados, metodo = c("auto", "ols", "wls"), pesos = c("variancia_nivel", "1/x", "1/x2", "1/y", "1/y2") )ajustar_curva( dados, metodo = c("auto", "ols", "wls"), pesos = c("variancia_nivel", "1/x", "1/x2", "1/y", "1/y2") )
dados |
Validated data from |
metodo |
One of |
pesos |
WLS strategy. |
A valcurva_fit object.
Fits leave-one-out models solely for technical review. It never changes the original data or approves exclusion of a measurement.
analisar_sensibilidade(ajuste, observacoes = NULL)analisar_sensibilidade(ajuste, observacoes = NULL)
ajuste |
A |
observacoes |
Optional row numbers. By default, all observations flagged by Cook's distance, leverage, DFFITS, DFBETAS or studentized residuals are used. |
A data frame comparing each leave-one-out model with the original fit.
No universal acceptance limits are imposed. Supply only the limits applicable to the analytical procedure, matrix, and intended range. A missing criterion is reported as not assessed rather than silently approved.
avaliar_adequacao(ajuste, criterios = list())avaliar_adequacao(ajuste, criterios = list())
ajuste |
A |
criterios |
A named list. Supported names are |
An object of class valcurva_adequacao with a criterion table,
back-calculation table, and conclusion.
Compare OLS and WLS calibration models
comparar_modelos(ols, wls)comparar_modelos(ols, wls)
ols |
An OLS |
wls |
A WLS |
A data frame intended as decision support, not an automatic approval.
Fifteen individual absorbance measurements at five cadmium calibration levels. Values are transcribed from Table A5.2 of the Eurachem/CITAC uncertainty guide and are supplied in long format to preserve replicates.
dados_eurachem_a52()dados_eurachem_a52()
A data frame with concentracao_mg_L, replica, and absorbancia.
dados <- dados_eurachem_a52() curva <- validar_curva(dados, concentracao_mg_L, absorbancia, replica) ajuste <- ajustar_curva(curva, metodo = "ols") grafico_calibracao(ajuste)dados <- dados_eurachem_a52() curva <- validar_curva(dados, concentracao_mg_L, absorbancia, replica) ajuste <- ajustar_curva(curva, metodo = "ols") grafico_calibracao(ajuste)
Calculate calibration-curve diagnostics
diagnosticar_curva(ajuste)diagnosticar_curva(ajuste)
ajuste |
An object returned by |
A named list of diagnostic results.
Generate a complete calibration-validation report in PDF
gerar_relatorio_pdf( ajuste, arquivo = file.path(tempdir(), "relatorio-calibracao.pdf"), titulo = "Relatorio de validacao da curva de calibracao", criterios = list(), quiet = TRUE )gerar_relatorio_pdf( ajuste, arquivo = file.path(tempdir(), "relatorio-calibracao.pdf"), titulo = "Relatorio de validacao da curva de calibracao", criterios = list(), quiet = TRUE )
ajuste |
A |
arquivo |
Output PDF path. By default, a temporary file is used so the function does not write to the user's working directory. |
titulo |
Title shown in the report. |
criterios |
Optional acceptance criteria forwarded to |
quiet |
Logical; suppress R Markdown progress messages. |
Invisibly, the normalized path to the generated PDF.
Draws individual data, centroids, fitted line and 95% prediction limits in the visual language of the metrology article supplied for this project.
grafico_calibracao(ajuste, nivel = 0.95, ...)grafico_calibracao(ajuste, nivel = 0.95, ...)
ajuste |
A |
nivel |
Confidence level for prediction limits. |
... |
Graphical parameters passed to |
Invisibly, a data frame used to draw the prediction curves.
Plot inverse prediction uncertainty over the calibration range
grafico_incerteza_predicao(ajuste, k = c(1, 2, 3, 4, 9, 16))grafico_incerteza_predicao(ajuste, k = c(1, 2, 3, 4, 9, 16))
ajuste |
A |
k |
Numeric vector of numbers of replicate measurements. |
Invisibly, plotted uncertainty data.
Plot Cook's distance and leverage against their screening limits
grafico_influencia(ajuste)grafico_influencia(ajuste)
ajuste |
A |
Invisibly, the influence diagnostics.
Plot a normal Q-Q graph with a simulation envelope for residuals
grafico_qq(ajuste, nivel = 0.95, simulacoes = 999L, semente = NULL)grafico_qq(ajuste, nivel = 0.95, simulacoes = 999L, semente = NULL)
ajuste |
A |
nivel |
Envelope coverage level. |
simulacoes |
Number of normal samples used to build the envelope. |
semente |
Optional seed for a reproducible envelope. |
Invisibly, data used to construct the graph.
Plot standardized residuals against concentration
grafico_residuos(ajuste)grafico_residuos(ajuste)
ajuste |
A |
Invisibly, residual diagnostic data.
Plot instrumental-response variability by concentration
grafico_variancia(ajuste)grafico_variancia(ajuste)
ajuste |
A |
Invisibly, the level summary.
Create the four-panel calibration figure
painel_calibracao(ajuste, k = c(1, 2, 3, 4, 9, 16))painel_calibracao(ajuste, k = c(1, 2, 3, 4, 9, 16))
ajuste |
A |
k |
Replicate counts for the uncertainty panel. |
Invisibly, ajuste.
Build an auditable calibration summary
relatorio_auditoria(ajuste, criterios = list())relatorio_auditoria(ajuste, criterios = list())
ajuste |
A |
criterios |
Optional criteria forwarded to |
A named list with model, diagnostics, adequacy assessment, and data.
The measurement model is x = (y - a) / b. The covariance of the fitted
intercept (a) and slope (b) is retained explicitly in the combined
uncertainty. It must not be discarded or treated as two independent inputs.
retrocalcular_concentracao( ajuste, sinal, k = 1L, u_sinal = NULL, nivel = 0.95, fator_cobertura = NULL )retrocalcular_concentracao( ajuste, sinal, k = 1L, u_sinal = NULL, nivel = 0.95, fator_cobertura = NULL )
ajuste |
A |
sinal |
Numeric vector of instrumental responses. |
k |
Number of replicate signals averaged for each result. |
u_sinal |
Standard uncertainty of each reported signal. If |
nivel |
Confidence level. |
fator_cobertura |
Optional coverage factor. If |
A data frame with concentration, combined and expanded GUM uncertainty, and the individual variance contributions.
Keeps the original measurements in long format. A horizontal table is also
accepted: omit sinal and every numeric column other than concentracao
is converted internally to a replicate column. Replicates must not be
averaged before validation because they are needed for variance and
lack-of-fit diagnostics.
validar_curva(dados, concentracao, sinal = NULL, replica = NULL)validar_curva(dados, concentracao, sinal = NULL, replica = NULL)
dados |
A data frame. |
concentracao |
Concentration column, supplied bare or as a string. |
sinal |
Instrumental response column, supplied bare or as a string. Omit it for horizontal data with one numeric response column per replicate. |
replica |
Optional replicate identifier column. |
A data.frame with standard internal columns .x, .y and
.replica.