From d36f7665da7ed855885bbbcd17b203d3e8804bab Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 18 Nov 2024 19:04:11 +0100 Subject: Update badges in README.rmd --- README.html | 127 +++++++++++++++++++++++++----------------------------------- 1 file changed, 53 insertions(+), 74 deletions(-) (limited to 'README.html') diff --git a/README.html b/README.html index 3d9793c..c4809fd 100644 --- a/README.html +++ b/README.html @@ -587,12 +587,12 @@ code .in { color: #008080; } @@ -607,28 +607,7 @@ padding-top: 0px; Calibration functions for analytical chemistry -

buildbuildpassingpassing - - - - - - - - - - - - - - codecov - codecov - 53% - 53% - - - -

+

Codecov test coverage R-CMD-check

Overview

@@ -638,25 +617,25 @@ variable.

Installation

From within R, get the official chemCal release using

-
install.packages("chemCal")
+
install.packages("chemCal")

Usage

chemCal works with univariate linear models of class lm. Working with one of the datasets coming with chemCal, we can produce a calibration plot using the calplot function:

Plotting a calibration

-
library(chemCal)
-m0 <- lm(y ~ x, data = massart97ex3)
-calplot(m0)
+
library(chemCal)
+m0 <- lm(y ~ x, data = massart97ex3)
+calplot(m0)

LOD and LOQ

If you use unweighted regression, as in the above example, we can calculate a Limit Of Detection (LOD) from the calibration data.

-
lod(m0)
-#> $x
-#> [1] 5.407085
-#> 
-#> $y
-#> [1] 13.63911
+
lod(m0)
+#> $x
+#> [1] 5.407085
+#> 
+#> $y
+#> [1] 13.63911

This is the minimum detectable value (German: Erfassungsgrenze), i.e. the value where the probability that the signal is not detected although the analyte is present is below a specified error tolerance @@ -665,53 +644,53 @@ beta (default is 0.05 following the IUPAC recommendation).

i.e. the value that is significantly different from the blank signal with an error tolerance alpha (default is 0.05, again following IUPAC recommendations) by setting beta to 0.5.

-
lod(m0, beta = 0.5)
-#> $x
-#> [1] 2.720388
-#> 
-#> $y
-#> [1] 8.314841
+
lod(m0, beta = 0.5)
+#> $x
+#> [1] 2.720388
+#> 
+#> $y
+#> [1] 8.314841

Furthermore, you can calculate the Limit Of Quantification (LOQ), being defined as the value where the relative error of the quantification given the calibration model reaches a prespecified value (default is 1/3).

-
loq(m0)
-#> $x
-#> [1] 9.627349
-#> 
-#> $y
-#> [1] 22.00246
+
loq(m0)
+#> $x
+#> [1] 9.627349
+#> 
+#> $y
+#> [1] 22.00246

Confidence intervals for measured values

Finally, you can get a confidence interval for the values measured using the calibration curve, i.e. for the inverse predictions using the function inverse.predict.

-
inverse.predict(m0, 90)
-#> $Prediction
-#> [1] 43.93983
-#> 
-#> $`Standard Error`
-#> [1] 1.576985
-#> 
-#> $Confidence
-#> [1] 3.230307
-#> 
-#> $`Confidence Limits`
-#> [1] 40.70952 47.17014
+
inverse.predict(m0, 90)
+#> $Prediction
+#> [1] 43.93983
+#> 
+#> $`Standard Error`
+#> [1] 1.576985
+#> 
+#> $Confidence
+#> [1] 3.230307
+#> 
+#> $`Confidence Limits`
+#> [1] 40.70952 47.17014

If you have replicate measurements of the same sample, you can also give a vector of numbers.

-
inverse.predict(m0, c(91, 89, 87, 93, 90))
-#> $Prediction
-#> [1] 43.93983
-#> 
-#> $`Standard Error`
-#> [1] 0.796884
-#> 
-#> $Confidence
-#> [1] 1.632343
-#> 
-#> $`Confidence Limits`
-#> [1] 42.30749 45.57217
+
inverse.predict(m0, c(91, 89, 87, 93, 90))
+#> $Prediction
+#> [1] 43.93983
+#> 
+#> $`Standard Error`
+#> [1] 0.796884
+#> 
+#> $Confidence
+#> [1] 1.632343
+#> 
+#> $`Confidence Limits`
+#> [1] 42.30749 45.57217

Reference

You can use the R help system to view documentation, or you can have a look at the online -- cgit v1.2.1