From f4fcef8228ebd5a1a73bc6edc47b5efa259c2e20 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 23 Mar 2022 10:32:36 +0100 Subject: Use 'investr' conditionally in tests, updates Most prominently, a README was added, giving a nice overview for the people visiting the github page, the package page on CRAN, or the online docs at pkgdown.jrwb.de. The maintainer e-mail address was also updated. --- docs/reference/calplot.lm-1.png | Bin 71915 -> 71932 bytes docs/reference/calplot.lm.html | 218 ++++++----------- docs/reference/din32645-1.png | Bin 70087 -> 70080 bytes docs/reference/din32645.html | 206 ++++++---------- docs/reference/figures/README-calplot-1.png | Bin 0 -> 39449 bytes docs/reference/index.html | 172 +++----------- docs/reference/inverse.predict.html | 350 +++++++++++----------------- docs/reference/lod.html | 236 +++++++------------ docs/reference/loq.html | 249 +++++++------------- docs/reference/massart97ex1.html | 123 +++------- docs/reference/massart97ex3.html | 276 +++++++++------------- docs/reference/rl95_cadmium.html | 119 ++-------- docs/reference/rl95_toluene.html | 121 ++-------- docs/reference/utstats14.html | 125 +++------- 14 files changed, 684 insertions(+), 1511 deletions(-) create mode 100644 docs/reference/figures/README-calplot-1.png (limited to 'docs/reference') diff --git a/docs/reference/calplot.lm-1.png b/docs/reference/calplot.lm-1.png index 5d4c4d9..c2deae8 100644 Binary files a/docs/reference/calplot.lm-1.png and b/docs/reference/calplot.lm-1.png differ diff --git a/docs/reference/calplot.lm.html b/docs/reference/calplot.lm.html index b041a8d..7865a66 100644 --- a/docs/reference/calplot.lm.html +++ b/docs/reference/calplot.lm.html @@ -1,68 +1,13 @@ - - - - - - - -Plot calibration graphs from univariate linear models — calplot • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot calibration graphs from univariate linear models — calplot • chemCal - - - - + + -
-
- -
- -
+
-
calplot(object, xlim = c("auto", "auto"), ylim = c("auto", "auto"),
-    xlab = "Concentration", ylab = "Response", legend_x = "auto",
-    alpha=0.05, varfunc = NULL)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
object

A univariate model object of class lm or - rlm - with model formula y ~ x or y ~ x - 1.

xlim

The limits of the plot on the x axis.

ylim

The limits of the plot on the y axis.

xlab

The label of the x axis.

ylab

The label of the y axis.

legend_x

An optional numeric value for adjusting the x coordinate of the legend.

alpha

The error tolerance level for the confidence and prediction bands. Note that this - includes both tails of the Gaussian distribution, unlike the alpha and beta parameters - used in lod (see note below).

varfunc

The variance function for generating the weights in the model. - Currently, this argument is ignored (see note below).

- -

Value

+
+
calplot(object, xlim = c("auto", "auto"), ylim = c("auto", "auto"),
+    xlab = "Concentration", ylab = "Response", legend_x = "auto",
+    alpha=0.05, varfunc = NULL)
+
+
+

Arguments

+
object
+

A univariate model object of class lm or + rlm + with model formula y ~ x or y ~ x - 1.

+
xlim
+

The limits of the plot on the x axis.

+
ylim
+

The limits of the plot on the y axis.

+
xlab
+

The label of the x axis.

+
ylab
+

The label of the y axis.

+
legend_x
+

An optional numeric value for adjusting the x coordinate of the legend.

+
alpha
+

The error tolerance level for the confidence and prediction bands. Note that this + includes both tails of the Gaussian distribution, unlike the alpha and beta parameters + used in lod (see note below).

+
varfunc
+

The variance function for generating the weights in the model. + Currently, this argument is ignored (see note below).

+
+
+

Value

A plot of the calibration data, of your fitted model as well as lines showing the confidence limits. Prediction limits are only shown for models from unweighted regression.

-

Note

- +
+
+

Note

Prediction bands for models from weighted linear regression require weights for the data, for which responses should be predicted. Prediction intervals using weights e.g. from a variance function are currently not supported by - the internally used function predict.lm, therefore, + the internally used function predict.lm, therefore, calplot does not draw prediction bands for such models.

It is possible to compare the calplot prediction bands with the - lod values if the lod() alpha and beta parameters are + lod values if the lod() alpha and beta parameters are half the value of the calplot() alpha parameter.

-

Author

- +
+
+

Author

Johannes Ranke - jranke@uni-bremen.de

+ jranke@uni-bremen.de

+
-

Examples

-
data(massart97ex3) -m <- lm(y ~ x, data = massart97ex3) -calplot(m) -
+
+

Examples

+
data(massart97ex3)
+m <- lm(y ~ x, data = massart97ex3)
+calplot(m)
+
+
+
+
-
- +
- - + + diff --git a/docs/reference/din32645-1.png b/docs/reference/din32645-1.png index 27914e8..170a9ae 100644 Binary files a/docs/reference/din32645-1.png and b/docs/reference/din32645-1.png differ diff --git a/docs/reference/din32645.html b/docs/reference/din32645.html index b46103c..1c02f36 100644 --- a/docs/reference/din32645.html +++ b/docs/reference/din32645.html @@ -1,67 +1,12 @@ - - - - - - - -Calibration data from DIN 32645 — din32645 • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Calibration data from DIN 32645 — din32645 • chemCal - - - - + + -
-
- -
- -
+
-
data(din32645)
- - -

Format

+
+
data(din32645)
+
+
+

Format

A dataframe containing 10 rows of x and y values.

-

References

- +
+
+

References

DIN 32645 (equivalent to ISO 11843), Beuth Verlag, Berlin, 1994

Dintest. Plugin for MS Excel for evaluations of calibration data. Written by Georg Schmitt, University of Heidelberg. Formerly available from @@ -138,69 +72,75 @@

Currie, L. A. (1997) Nomenclature in evaluation of analytical methods including detection and quantification capabilities (IUPAC Recommendations 1995). Analytica Chimica Acta 391, 105 - 126.

+
-

Examples

-
m <- lm(y ~ x, data = din32645) -calplot(m) -
-## Prediction of x with confidence interval -prediction <- inverse.predict(m, 3500, alpha = 0.01) - -# This should give 0.07434 according to test data from Dintest, which -# was collected from Procontrol 3.1 (isomehr GmbH) in this case -round(prediction$Confidence, 5) -
#> [1] 0.07434
-## Critical value: -crit <- lod(m, alpha = 0.01, beta = 0.5) - -# According to DIN 32645, we should get 0.07 for the critical value -# (decision limit, "Nachweisgrenze") -round(crit$x, 2) -
#> [1] 0.07
# and according to Dintest test data, we should get 0.0698 from -round(crit$x, 4) -
#> [1] 0.0698
-## Limit of detection (smallest detectable value given alpha and beta) -# In German, the smallest detectable value is the "Erfassungsgrenze", and we -# should get 0.14 according to DIN, which we achieve by using the method -# described in it: -lod.din <- lod(m, alpha = 0.01, beta = 0.01, method = "din") -round(lod.din$x, 2) -
#> [1] 0.14
-## Limit of quantification -# This accords to the test data coming with the test data from Dintest again, -# except for the last digits of the value cited for Procontrol 3.1 (0.2121) -loq <- loq(m, alpha = 0.01) -round(loq$x, 4) -
#> [1] 0.212
-# A similar value is obtained using the approximation -# LQ = 3.04 * LC (Currie 1999, p. 120) -3.04 * lod(m, alpha = 0.01, beta = 0.5)$x -
#> [1] 0.2122306
+
+

Examples

+
m <- lm(y ~ x, data = din32645)
+calplot(m)
+
+
+## Prediction of x with confidence interval
+prediction <- inverse.predict(m, 3500, alpha = 0.01)
+
+# This should give 0.07434 according to test data from Dintest, which 
+# was collected from Procontrol 3.1 (isomehr GmbH) in this case
+round(prediction$Confidence, 5)
+#> [1] 0.07434
+
+## Critical value:
+crit <- lod(m, alpha = 0.01, beta = 0.5)
+
+# According to DIN 32645, we should get 0.07 for the critical value
+# (decision limit, "Nachweisgrenze")
+round(crit$x, 2)
+#> [1] 0.07
+# and according to Dintest test data, we should get 0.0698 from
+round(crit$x, 4)
+#> [1] 0.0698
+
+## Limit of detection (smallest detectable value given alpha and beta)
+# In German, the smallest detectable value is the "Erfassungsgrenze", and we
+# should get 0.14 according to DIN, which we achieve by using the method 
+# described in it:
+lod.din <- lod(m, alpha = 0.01, beta = 0.01, method = "din")
+round(lod.din$x, 2)
+#> [1] 0.14
+
+## Limit of quantification
+# This accords to the test data coming with the test data from Dintest again, 
+# except for the last digits of the value cited for Procontrol 3.1 (0.2121)
+loq <- loq(m, alpha = 0.01)
+round(loq$x, 4)
+#> [1] 0.212
+
+# A similar value is obtained using the approximation 
+# LQ = 3.04 * LC (Currie 1999, p. 120)
+3.04 * lod(m, alpha = 0.01, beta = 0.5)$x
+#> [1] 0.2122306
+
+
+
-
- +
- - + + diff --git a/docs/reference/figures/README-calplot-1.png b/docs/reference/figures/README-calplot-1.png new file mode 100644 index 0000000..b71d326 Binary files /dev/null and b/docs/reference/figures/README-calplot-1.png differ diff --git a/docs/reference/index.html b/docs/reference/index.html index 8549a1d..3685007 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,66 +1,12 @@ - - - - - - - -Function reference • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Function reference • chemCal - - + + - - -
-
- -
- -
+
- - - - - - - - - - -
-

All functions

+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+

All functions

+

calplot()

Plot calibration graphs from univariate linear models

+

din32645

Calibration data from DIN 32645

+

inverse.predict()

Predict x from y for a linear calibration

+

lod()

Estimate a limit of detection (LOD)

+

loq()

Estimate a limit of quantification (LOQ)

+

massart97ex1

Calibration data from Massart et al. (1997), example 1

+

massart97ex3

Calibration data from Massart et al. (1997), example 3

+

rl95_cadmium

Cadmium concentrations measured by AAS as reported by Rocke and Lorenzato (1995)

+

rl95_toluene

Toluene amounts measured by GC/MS as reported by Rocke and Lorenzato (1995)

+

utstats14

Example data for calibration with replicates from University of Toronto

- +
+
-
- +
- - + + diff --git a/docs/reference/inverse.predict.html b/docs/reference/inverse.predict.html index aece430..cb9fe98 100644 --- a/docs/reference/inverse.predict.html +++ b/docs/reference/inverse.predict.html @@ -1,46 +1,5 @@ - - - - - - - -Predict x from y for a linear calibration — inverse.predict • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Predict x from y for a linear calibration — inverse.predict • chemCal - - - - - - - - - - - - - + + -
-
- -
- -
+
-
inverse.predict(object, newdata, ...,
-  ws, alpha=0.05, var.s = "auto")
+
+
inverse.predict(object, newdata, ...,
+  ws, alpha=0.05, var.s = "auto")
+
-

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - -
object

A univariate model object of class lm or - rlm - with model formula y ~ x or y ~ x - 1.

newdata

A vector of observed y values for one sample.

...

Placeholder for further arguments that might be needed by - future implementations.

ws

The weight attributed to the sample. This argument is obligatory - if object has weights.

alpha

The error tolerance level for the confidence interval to be reported.

var.s

The estimated variance of the sample measurements. The default is to take +

+

Arguments

+
object
+

A univariate model object of class lm or + rlm + with model formula y ~ x or y ~ x - 1.

+
newdata
+

A vector of observed y values for one sample.

+
...
+

Placeholder for further arguments that might be needed by + future implementations.

+
ws
+

The weight attributed to the sample. This argument is obligatory + if object has weights.

+
alpha
+

The error tolerance level for the confidence interval to be reported.

+
var.s
+

The estimated variance of the sample measurements. The default is to take the residual standard error from the calibration and to adjust it using ws, if applicable. This means that var.s - overrides ws.

- -

Value

- + overrides ws.

+
+
+

Value

A list containing the predicted x value, its standard error and a confidence interval.

-

Note

- +
+
+

Note

The function was validated with examples 7 and 8 from Massart et al. (1997). Note that the behaviour of inverse.predict changed with chemCal version 0.2.1. Confidence intervals for x values obtained from calibrations with replicate measurements did not take the variation about the means into account. Please refer to the vignette for details.

-

References

- +
+
+

References

Massart, L.M, Vandenginste, B.G.M., Buydens, L.M.C., De Jong, S., Lewi, P.J., Smeyers-Verbeke, J. (1997) Handbook of Chemometrics and Qualimetrics: Part A, p. 200

+
-

Examples

-
# This is example 7 from Chapter 8 in Massart et al. (1997) -m <- lm(y ~ x, data = massart97ex1) -inverse.predict(m, 15) # 6.1 +- 4.9 -
#> $Prediction -#> [1] 6.09381 -#> -#> $`Standard Error` -#> [1] 1.767278 -#> -#> $Confidence -#> [1] 4.906751 -#> -#> $`Confidence Limits` -#> [1] 1.187059 11.000561 -#>
inverse.predict(m, 90) # 43.9 +- 4.9 -
#> $Prediction -#> [1] 43.93983 -#> -#> $`Standard Error` -#> [1] 1.767747 -#> -#> $Confidence -#> [1] 4.908053 -#> -#> $`Confidence Limits` -#> [1] 39.03178 48.84788 -#>
inverse.predict(m, rep(90,5)) # 43.9 +- 3.2 -
#> $Prediction -#> [1] 43.93983 -#> -#> $`Standard Error` -#> [1] 1.141204 -#> -#> $Confidence -#> [1] 3.168489 -#> -#> $`Confidence Limits` -#> [1] 40.77134 47.10832 -#>
-# For reproducing the results for replicate standard measurements in example 8, -# we need to do the calibration on the means when using chemCal > 0.2 -weights <- with(massart97ex3, { - yx <- split(y, x) - ybar <- sapply(yx, mean) - s <- round(sapply(yx, sd), digits = 2) - w <- round(1 / (s^2), digits = 3) -}) - -massart97ex3.means <- aggregate(y ~ x, massart97ex3, mean) - -m3.means <- lm(y ~ x, w = weights, data = massart97ex3.means) - -inverse.predict(m3.means, 15, ws = 1.67) # 5.9 +- 2.5 -
#> $Prediction -#> [1] 5.865367 -#> -#> $`Standard Error` -#> [1] 0.8926109 -#> -#> $Confidence -#> [1] 2.478285 -#> -#> $`Confidence Limits` -#> [1] 3.387082 8.343652 -#>
inverse.predict(m3.means, 90, ws = 0.145) # 44.1 +- 7.9 -
#> $Prediction -#> [1] 44.06025 -#> -#> $`Standard Error` -#> [1] 2.829162 -#> -#> $Confidence -#> [1] 7.855012 -#> -#> $`Confidence Limits` -#> [1] 36.20523 51.91526 -#>
-
+
+

Examples

+
# This is example 7 from Chapter 8 in Massart et al. (1997)
+m <- lm(y ~ x, data = massart97ex1)
+inverse.predict(m, 15)        #  6.1 +- 4.9
+#> $Prediction
+#> [1] 6.09381
+#> 
+#> $`Standard Error`
+#> [1] 1.767278
+#> 
+#> $Confidence
+#> [1] 4.906751
+#> 
+#> $`Confidence Limits`
+#> [1]  1.187059 11.000561
+#> 
+inverse.predict(m, 90)        # 43.9 +- 4.9
+#> $Prediction
+#> [1] 43.93983
+#> 
+#> $`Standard Error`
+#> [1] 1.767747
+#> 
+#> $Confidence
+#> [1] 4.908053
+#> 
+#> $`Confidence Limits`
+#> [1] 39.03178 48.84788
+#> 
+inverse.predict(m, rep(90,5)) # 43.9 +- 3.2
+#> $Prediction
+#> [1] 43.93983
+#> 
+#> $`Standard Error`
+#> [1] 1.141204
+#> 
+#> $Confidence
+#> [1] 3.168489
+#> 
+#> $`Confidence Limits`
+#> [1] 40.77134 47.10832
+#> 
+
+# For reproducing the results for replicate standard measurements in example 8,
+# we need to do the calibration on the means when using chemCal > 0.2
+weights <- with(massart97ex3, {
+  yx <- split(y, x)
+  ybar <- sapply(yx, mean)
+  s <- round(sapply(yx, sd), digits = 2)
+  w <- round(1 / (s^2), digits = 3)
+})
+
+massart97ex3.means <- aggregate(y ~ x, massart97ex3, mean)
+
+m3.means <- lm(y ~ x, w = weights, data = massart97ex3.means)
+
+inverse.predict(m3.means, 15, ws = 1.67)  # 5.9 +- 2.5
+#> $Prediction
+#> [1] 5.865367
+#> 
+#> $`Standard Error`
+#> [1] 0.8926109
+#> 
+#> $Confidence
+#> [1] 2.478285
+#> 
+#> $`Confidence Limits`
+#> [1] 3.387082 8.343652
+#> 
+inverse.predict(m3.means, 90, ws = 0.145) # 44.1 +- 7.9
+#> $Prediction
+#> [1] 44.06025
+#> 
+#> $`Standard Error`
+#> [1] 2.829162
+#> 
+#> $Confidence
+#> [1] 7.855012
+#> 
+#> $`Confidence Limits`
+#> [1] 36.20523 51.91526
+#> 
+
+
+
+
- - - + + diff --git a/docs/reference/lod.html b/docs/reference/lod.html index 42fc533..a2d66ce 100644 --- a/docs/reference/lod.html +++ b/docs/reference/lod.html @@ -1,74 +1,19 @@ - - - - - - - -Estimate a limit of detection (LOD) — lod • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Estimate a limit of detection (LOD) — lod • chemCal - - - - - - - - - - - - - + + -
-
- -
- -
+
-
lod(object, ..., alpha = 0.05, beta = 0.05, method = "default", tol = "default")
+
+
lod(object, ..., alpha = 0.05, beta = 0.05, method = "default", tol = "default")
+
-

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - -
object

A univariate model object of class lm or - rlm +

+

Arguments

+
object
+

A univariate model object of class lm or + rlm with model formula y ~ x or y ~ x - 1, - optionally from a weighted regression.

...

Placeholder for further arguments that might be needed by - future implementations.

alpha

The error tolerance for the decision limit (critical value).

beta

The error tolerance beta for the detection limit.

method

The “default” method uses a prediction interval at the LOD + optionally from a weighted regression.

+
...
+

Placeholder for further arguments that might be needed by + future implementations.

+
alpha
+

The error tolerance for the decision limit (critical value).

+
beta
+

The error tolerance beta for the detection limit.

+
method
+

The “default” method uses a prediction interval at the LOD for the estimation of the LOD, which obviously requires iteration. This is described for example in Massart, p. 432 ff. - The “din” method uses the prediction interval at - x = 0 as an approximation.

tol

When the “default” method is used, the default tolerance + The “din” method uses the prediction interval at + x = 0 as an approximation.

+
tol
+

When the “default” method is used, the default tolerance for the LOD on the x scale is the value of the smallest non-zero standard - divided by 1000. Can be set to a numeric value to override this.

- -

Value

- + divided by 1000. Can be set to a numeric value to override this.

+
+
+

Value

A list containig the corresponding x and y values of the estimated limit of detection of a model used for calibration.

-

Note

- +
+
+

Note

- The default values for alpha and beta are the ones recommended by IUPAC. - The estimation of the LOD in terms of the analyte amount/concentration xD from the LOD in the signal domain SD is done by simply inverting the calibration function (i.e. assuming a known calibration function). - The calculation of a LOD from weighted calibration models requires - a weights argument for the internally used predict.lm + a weights argument for the internally used predict.lm function, which is currently not supported in R.

-

References

- +
+
+

References

Massart, L.M, Vandenginste, B.G.M., Buydens, L.M.C., De Jong, S., Lewi, P.J., Smeyers-Verbeke, J. (1997) Handbook of Chemometrics and Qualimetrics: Part A, Chapter 13.7.8

@@ -202,53 +124,55 @@

Currie, L. A. (1997) Nomenclature in evaluation of analytical methods including detection and quantification capabilities (IUPAC Recommendations 1995). Analytica Chimica Acta 391, 105 - 126.

-

See also

- -

Examples for din32645

- -

Examples

-
m <- lm(y ~ x, data = din32645) -lod(m) -
#> $x -#> [1] 0.08655484 -#> -#> $y -#> [1] 3317.154 -#>
-# The critical value (decision limit, German Nachweisgrenze) can be obtained -# by using beta = 0.5: -lod(m, alpha = 0.01, beta = 0.5) -
#> $x -#> [1] 0.0698127 -#> -#> $y -#> [1] 3155.393 -#>
+
+
+

See also

+

Examples for din32645

+
+ +
+

Examples

+
m <- lm(y ~ x, data = din32645)
+lod(m) 
+#> $x
+#> [1] 0.08655484
+#> 
+#> $y
+#> [1] 3317.154
+#> 
+
+# The critical value (decision limit, German Nachweisgrenze) can be obtained
+# by using beta = 0.5:
+lod(m, alpha = 0.01, beta = 0.5)
+#> $x
+#> [1] 0.0698127
+#> 
+#> $y
+#> [1] 3155.393
+#> 
+
+
+
- - - + + diff --git a/docs/reference/loq.html b/docs/reference/loq.html index 973b1ff..0960251 100644 --- a/docs/reference/loq.html +++ b/docs/reference/loq.html @@ -1,73 +1,18 @@ - - - - - - - -Estimate a limit of quantification (LOQ) — loq • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Estimate a limit of quantification (LOQ) — loq • chemCal - - - - - - - - - - - - - + + -
-
- -
- -
+
-
loq(object, ..., alpha = 0.05, k = 3, n = 1, w.loq = "auto",
-    var.loq = "auto", tol = "default")
+
+
loq(object, ..., alpha = 0.05, k = 3, n = 1, w.loq = "auto",
+    var.loq = "auto", tol = "default")
+
-

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
object

A univariate model object of class lm or - rlm +

+

Arguments

+
object
+

A univariate model object of class lm or + rlm with model formula y ~ x or y ~ x - 1, optionally from a weighted regression. If weights are specified in the model, either w.loq or var.loq have to - be specified.

alpha

The error tolerance for the prediction of x values in the calculation.

...

Placeholder for further arguments that might be needed by - future implementations.

k

The inverse of the maximum relative error tolerated at the - desired LOQ.

n

The number of replicate measurements for which the LOQ should be - specified.

w.loq

The weight that should be attributed to the LOQ. Defaults + be specified.

+
alpha
+

The error tolerance for the prediction of x values in the calculation.

+
...
+

Placeholder for further arguments that might be needed by + future implementations.

+
k
+

The inverse of the maximum relative error tolerated at the + desired LOQ.

+
n
+

The number of replicate measurements for which the LOQ should be + specified.

+
w.loq
+

The weight that should be attributed to the LOQ. Defaults to one for unweighted regression, and to the mean of the weights - for weighted regression. See massart97ex3 for + for weighted regression. See massart97ex3 for an example how to take advantage of knowledge about the - variance function.

var.loq

The approximate variance at the LOQ. The default value is - calculated from the model.

tol

The default tolerance for the LOQ on the x scale is the value of the + variance function.

+
var.loq
+

The approximate variance at the LOQ. The default value is + calculated from the model.

+
tol
+

The default tolerance for the LOQ on the x scale is the value of the smallest non-zero standard divided by 1000. Can be set to a - numeric value to override this.

- -

Value

- + numeric value to override this.

+
+
+

Value

The estimated limit of quantification for a model used for calibration.

-

Note

- +
+
+

Note

- IUPAC recommends to base the LOQ on the standard deviation of the signal where x = 0. - The calculation of a LOQ based on weighted regression is non-standard and therefore not tested. Feedback is welcome.

-

See also

- -

Examples for din32645

- -

Examples

-
m <- lm(y ~ x, data = massart97ex1) -loq(m) -
#> $x -#> [1] 13.97764 -#> -#> $y -#> [1] 30.6235 -#>
-# We can get better by using replicate measurements -loq(m, n = 3) -
#> $x -#> [1] 9.971963 -#> -#> $y -#> [1] 22.68539 -#>
+
+
+

See also

+

Examples for din32645

+
+ +
+

Examples

+
m <- lm(y ~ x, data = massart97ex1)
+loq(m)
+#> $x
+#> [1] 13.97764
+#> 
+#> $y
+#> [1] 30.6235
+#> 
+
+# We can get better by using replicate measurements
+loq(m, n = 3)
+#> $x
+#> [1] 9.971963
+#> 
+#> $y
+#> [1] 22.68539
+#> 
+
+
+
- - - + + diff --git a/docs/reference/massart97ex1.html b/docs/reference/massart97ex1.html index c82bf6f..e5dd85a 100644 --- a/docs/reference/massart97ex1.html +++ b/docs/reference/massart97ex1.html @@ -1,67 +1,12 @@ - - - - - - - -Calibration data from Massart et al. (1997), example 1 — massart97ex1 • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Calibration data from Massart et al. (1997), example 1 — massart97ex1 • chemCal - - - - + + -
-
- -
- -
+
-
data(massart97ex1)
- - -

Format

+
+
data(massart97ex1)
+
+
+

Format

A dataframe containing 6 observations of x and y data.

-

Source

- +
+
+

Source

Massart, L.M, Vandenginste, B.G.M., Buydens, L.M.C., De Jong, S., Lewi, P.J., Smeyers-Verbeke, J. (1997) Handbook of Chemometrics and Qualimetrics: Part A, Chapter 8.

+
+
-
- +
- - + + diff --git a/docs/reference/massart97ex3.html b/docs/reference/massart97ex3.html index 4cbf7ce..4196882 100644 --- a/docs/reference/massart97ex3.html +++ b/docs/reference/massart97ex3.html @@ -1,67 +1,12 @@ - - - - - - - -Calibration data from Massart et al. (1997), example 3 — massart97ex3 • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Calibration data from Massart et al. (1997), example 3 — massart97ex3 • chemCal - - - - + + -
-
- -
- -
+
-
massart97ex3
- - -

Format

+
+
massart97ex3
+
+
+

Format

A dataframe containing 6 levels of x values with 5 observations of y for each level.

-

Source

- +
+
+

Source

Massart, L.M, Vandenginste, B.G.M., Buydens, L.M.C., De Jong, S., Lewi, P.J., Smeyers-Verbeke, J. (1997) Handbook of Chemometrics and Qualimetrics: Part A, Chapter 8.

+
-

Examples

-
# For reproducing the results for replicate standard measurements in example 8, -# we need to do the calibration on the means when using chemCal > 0.2 -weights <- with(massart97ex3, { - yx <- split(y, x) - ybar <- sapply(yx, mean) - s <- round(sapply(yx, sd), digits = 2) - w <- round(1 / (s^2), digits = 3) -}) - -massart97ex3.means <- aggregate(y ~ x, massart97ex3, mean) - -m3.means <- lm(y ~ x, w = weights, data = massart97ex3.means) - -# The following concords with the book p. 200 -inverse.predict(m3.means, 15, ws = 1.67) # 5.9 +- 2.5 -
#> $Prediction -#> [1] 5.865367 -#> -#> $`Standard Error` -#> [1] 0.8926109 -#> -#> $Confidence -#> [1] 2.478285 -#> -#> $`Confidence Limits` -#> [1] 3.387082 8.343652 -#>
inverse.predict(m3.means, 90, ws = 0.145) # 44.1 +- 7.9 -
#> $Prediction -#> [1] 44.06025 -#> -#> $`Standard Error` -#> [1] 2.829162 -#> -#> $Confidence -#> [1] 7.855012 -#> -#> $`Confidence Limits` -#> [1] 36.20523 51.91526 -#>
-# The LOD is only calculated for models from unweighted regression -# with this version of chemCal -m0 <- lm(y ~ x, data = massart97ex3) -lod(m0) -
#> $x -#> [1] 5.407085 -#> -#> $y -#> [1] 13.63911 -#>
-# Limit of quantification from unweighted regression -loq(m0) -
#> $x -#> [1] 9.627349 -#> -#> $y -#> [1] 22.00246 -#>
-# For calculating the limit of quantification from a model from weighted -# regression, we need to supply weights, internally used for inverse.predict -# If we are not using a variance function, we can use the weight from -# the above example as a first approximation (x = 15 is close to our -# loq approx 14 from above). -loq(m3.means, w.loq = 1.67) -
#> $x -#> [1] 7.346195 -#> -#> $y -#> [1] 17.90777 -#>
# The weight for the loq should therefore be derived at x = 7.3 instead -# of 15, but the graphical procedure of Massart (p. 201) to derive the -# variances on which the weights are based is quite inaccurate anyway. -
+
+

Examples

+
# For reproducing the results for replicate standard measurements in example 8,
+# we need to do the calibration on the means when using chemCal > 0.2
+weights <- with(massart97ex3, {
+  yx <- split(y, x)
+  ybar <- sapply(yx, mean)
+  s <- round(sapply(yx, sd), digits = 2)
+  w <- round(1 / (s^2), digits = 3)
+})
+
+massart97ex3.means <- aggregate(y ~ x, massart97ex3, mean)
+
+m3.means <- lm(y ~ x, w = weights, data = massart97ex3.means)
+
+# The following concords with the book p. 200
+inverse.predict(m3.means, 15, ws = 1.67)  # 5.9 +- 2.5
+#> $Prediction
+#> [1] 5.865367
+#> 
+#> $`Standard Error`
+#> [1] 0.8926109
+#> 
+#> $Confidence
+#> [1] 2.478285
+#> 
+#> $`Confidence Limits`
+#> [1] 3.387082 8.343652
+#> 
+inverse.predict(m3.means, 90, ws = 0.145) # 44.1 +- 7.9
+#> $Prediction
+#> [1] 44.06025
+#> 
+#> $`Standard Error`
+#> [1] 2.829162
+#> 
+#> $Confidence
+#> [1] 7.855012
+#> 
+#> $`Confidence Limits`
+#> [1] 36.20523 51.91526
+#> 
+
+# The LOD is only calculated for models from unweighted regression
+# with this version of chemCal
+m0 <- lm(y ~ x, data = massart97ex3) 
+lod(m0)
+#> $x
+#> [1] 5.407085
+#> 
+#> $y
+#> [1] 13.63911
+#> 
+
+# Limit of quantification from unweighted regression
+loq(m0)
+#> $x
+#> [1] 9.627349
+#> 
+#> $y
+#> [1] 22.00246
+#> 
+
+# For calculating the limit of quantification from a model from weighted
+# regression, we need to supply weights, internally used for inverse.predict
+# If we are not using a variance function, we can use the weight from
+# the above example as a first approximation (x = 15 is close to our
+# loq approx 14 from above).
+loq(m3.means, w.loq = 1.67)
+#> $x
+#> [1] 7.346195
+#> 
+#> $y
+#> [1] 17.90777
+#> 
+# The weight for the loq should therefore be derived at x = 7.3 instead
+# of 15, but the graphical procedure of Massart (p. 201) to derive the 
+# variances on which the weights are based is quite inaccurate anyway. 
+
+
+
-
- +
- - + + diff --git a/docs/reference/rl95_cadmium.html b/docs/reference/rl95_cadmium.html index 3b311ec..da9294d 100644 --- a/docs/reference/rl95_cadmium.html +++ b/docs/reference/rl95_cadmium.html @@ -1,67 +1,12 @@ - - - - - - - -Cadmium concentrations measured by AAS as reported by Rocke and Lorenzato (1995) — rl95_cadmium • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Cadmium concentrations measured by AAS as reported by Rocke and Lorenzato (1995) — rl95_cadmium • chemCal - - - - + + -
-
- -
- -
+
- -

Format

- +
+

Format

A dataframe containing four replicate observations for each of the six calibration standards.

-

Source

- +
+
+

Source

Rocke, David M. und Lorenzato, Stefan (1995) A two-component model for measurement error in analytical chemistry. Technometrics 37(2), 176-184.

+
+
-
- +
- - + + diff --git a/docs/reference/rl95_toluene.html b/docs/reference/rl95_toluene.html index 6b2542b..fb071e1 100644 --- a/docs/reference/rl95_toluene.html +++ b/docs/reference/rl95_toluene.html @@ -1,69 +1,14 @@ - - - - - - - -Toluene amounts measured by GC/MS as reported by Rocke and Lorenzato (1995) — rl95_toluene • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Toluene amounts measured by GC/MS as reported by Rocke and Lorenzato (1995) — rl95_toluene • chemCal - - - - - - - - - - - - - + + -
-
- -
- -
+
- -

Format

- +
+

Format

A dataframe containing four replicate observations for each of the six calibration standards.

-

Source

- +
+
+

Source

Rocke, David M. und Lorenzato, Stefan (1995) A two-component model for measurement error in analytical chemistry. Technometrics 37(2), 176-184.

+
+
-
- +
- - + + diff --git a/docs/reference/utstats14.html b/docs/reference/utstats14.html index a2822fc..78d2604 100644 --- a/docs/reference/utstats14.html +++ b/docs/reference/utstats14.html @@ -1,68 +1,13 @@ - - - - - - - -Example data for calibration with replicates from University of Toronto — utstats14 • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Example data for calibration with replicates from University of Toronto — utstats14 • chemCal - - - - + + -
-
- -
- -
+
+
-
- - + + -- cgit v1.2.1