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/404.html | 117 +++---- docs/articles/chemCal.html | 117 ++++--- .../figure-html/unnamed-chunk-1-1.png | Bin 72545 -> 72561 bytes .../figure-html/unnamed-chunk-2-1.png | Bin 44457 -> 44458 bytes docs/articles/index.html | 109 ++----- docs/authors.html | 138 +++----- docs/index.html | 159 ++++++++-- docs/news/index.html | 161 +++------- docs/pkgdown.css | 83 +++-- docs/pkgdown.js | 4 +- docs/pkgdown.yml | 4 +- 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 ++------ docs/sitemap.xml | 57 ++++ 26 files changed, 1120 insertions(+), 2024 deletions(-) create mode 100644 docs/reference/figures/README-calplot-1.png create mode 100644 docs/sitemap.xml (limited to 'docs') diff --git a/docs/404.html b/docs/404.html index 2fb6573..9ea600b 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1,66 +1,27 @@ - - - - + + + + - Page not found (404) • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - -
-
- + +
+ + + - - -
+
+
-
- +
+ + - - diff --git a/docs/articles/chemCal.html b/docs/articles/chemCal.html index 8d18c3a..4e145bf 100644 --- a/docs/articles/chemCal.html +++ b/docs/articles/chemCal.html @@ -19,6 +19,8 @@ + +
+
-
-

-Basic calibration functions

+
+

Basic calibration functions +

The chemCal package was first designed in the course of a lecture and lab course on “Analytics of Organic Trace Contaminants” at the University of Bremen from October to December 2004. In the fall 2005, an email exchange with Ron Wehrens led to the belief that it would be desirable to implement the inverse prediction method given in Massart et al. (1997) since it also covers the case of weighted regression. Studies of the IUPAC orange book and of DIN 32645 (equivalent to ISO 11843), publications by Currie (1997) and the Analytical Method Committee of the Royal Society of Chemistry (Analytical Methods Committee 1989) and a nice paper by Castells and Castillo (Castells and Castillo 2000) provided some further understanding of the matter.

-

At the moment, the package consists of four functions (calplot, lod, loq and inverse.predict), working on univariate linear models of class lm or rlm, plus several datasets for validation.

-

A bug report and the following e-mail exchange on the r-devel mailing list about prediction intervals from weighted regression entailed some further studies on this subject. However, I did not encounter any proof or explanation of the formula cited below yet, so I can’t really confirm that Massart’s method is correct.

+

At the moment, the package consists of four functions (calplot, lod, loq and inverse.predict), working on univariate linear models of class lm or rlm, plus several datasets for validation.

+

A bug report and the following e-mail exchange on the r-devel mailing list about prediction intervals from weighted regression entailed some further studies on this subject. However, I did not encounter any proof or explanation of the formula cited below yet, so I can’t really confirm that Massart’s method is correct.

In fact, in June 2018 I was made aware of the fact that the inverse prediction method implemented in chemCal version 0.1.37 and before did not take the variance of replicate calibration standards about their means into account, nor the number of replicates when calculating the degrees of freedom. Thanks to PhD student Anna Burniol Figols for reporting this issue!

As a consequence, I rewrote inverse.predict not to automatically work with the mean responses for each calibration standard any more. The example calculations from Massart et al. (1997) can still be reproduced when the regression model is calculated using the means of the calibration data as shown below.

-
-

-Usage

+
+

Usage +

When calibrating an analytical method, the first task is to generate a suitable model. If we want to use the chemCal functions, we have to restrict ourselves to univariate, possibly weighted, linear regression so far.

Once such a model has been created, the calibration can be graphically shown by using the calplot function:

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

As we can see, the scatter increases with increasing x. This is also illustrated by one of the diagnostic plots for linear models provided by R:

-plot(m0, which=3)
+plot(m0, which=3)

Therefore, in Example 8 in Massart et al. (1997), weighted regression is proposed which can be reproduced by the following code. Note that we are building the model on the mean values for each standard in order to be able to reproduce the results given in the book with the current version of chemCal.

-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)
+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)
+massart97ex3.means <- aggregate(y ~ x, massart97ex3, mean)
 
-m <- lm(y ~ x, w = weights, data = massart97ex3.means)
+m <- lm(y ~ x, w = weights, data = massart97ex3.means)

If we now want to predict a new x value from measured y values, we use the inverse.predict function:

 inverse.predict(m, 15, ws=1.67)
-
## $Prediction
-## [1] 5.865367
-## 
-## $`Standard Error`
-## [1] 0.8926109
-## 
-## $Confidence
-## [1] 2.478285
-## 
-## $`Confidence Limits`
-## [1] 3.387082 8.343652
+
## $Prediction
+## [1] 5.865367
+## 
+## $`Standard Error`
+## [1] 0.8926109
+## 
+## $Confidence
+## [1] 2.478285
+## 
+## $`Confidence Limits`
+## [1] 3.387082 8.343652
 inverse.predict(m, 90, ws = 0.145)
-
## $Prediction
-## [1] 44.06025
-## 
-## $`Standard Error`
-## [1] 2.829162
-## 
-## $Confidence
-## [1] 7.855012
-## 
-## $`Confidence Limits`
-## [1] 36.20523 51.91526
+
## $Prediction
+## [1] 44.06025
+## 
+## $`Standard Error`
+## [1] 2.829162
+## 
+## $Confidence
+## [1] 7.855012
+## 
+## $`Confidence Limits`
+## [1] 36.20523 51.91526

The weight ws assigned to the measured y value has to be given by the user in the case of weighted regression, or alternatively, the approximate variance var.s at this location.

-
-

-Background for inverse.predict -

+
+

Background for inverse.predict +

Equation 8.28 in Massart et al. (1997) gives a general equation for predicting the standard error \(s_{\hat{x_s}}\) for an \(x\) value predicted from measurements of \(y\) according to the linear calibration function \(y = b_0 + b_1 \cdot x\):

\[\begin{equation} s_{\hat{x_s}} = \frac{s_e}{b_1} \sqrt{\frac{1}{w_s m} + \frac{1}{\sum{w_i}} + @@ -203,11 +198,13 @@ s_{\hat{x_s}} = \frac{1}{b_1} \sqrt{\frac{{s_s}^2}{w_s m} +

-

Site built with pkgdown 1.6.1.

+

+

Site built with pkgdown 2.0.2.

@@ -216,5 +213,7 @@ s_{\hat{x_s}} = \frac{1}{b_1} \sqrt{\frac{{s_s}^2}{w_s m} + + + diff --git a/docs/articles/chemCal_files/figure-html/unnamed-chunk-1-1.png b/docs/articles/chemCal_files/figure-html/unnamed-chunk-1-1.png index fc76c68..51f854a 100644 Binary files a/docs/articles/chemCal_files/figure-html/unnamed-chunk-1-1.png and b/docs/articles/chemCal_files/figure-html/unnamed-chunk-1-1.png differ diff --git a/docs/articles/chemCal_files/figure-html/unnamed-chunk-2-1.png b/docs/articles/chemCal_files/figure-html/unnamed-chunk-2-1.png index 605137b..f30d115 100644 Binary files a/docs/articles/chemCal_files/figure-html/unnamed-chunk-2-1.png and b/docs/articles/chemCal_files/figure-html/unnamed-chunk-2-1.png differ diff --git a/docs/articles/index.html b/docs/articles/index.html index 48a4eca..3e53fde 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -1,66 +1,12 @@ - - - - - - - -Articles • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Articles • chemCal + + - - - - -
-
- -
- -
+
+
Introduction to chemCal
+
+
-
- +
- - + + diff --git a/docs/authors.html b/docs/authors.html index 476cf5e..694eb5b 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,66 +1,12 @@ - - - - - - - -Authors • chemCal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Authors and Citation • chemCal - - + + - - - -
-
-
- -
+
- @@ -129,22 +81,20 @@ -
- +
- - + + diff --git a/docs/index.html b/docs/index.html index a724173..4019484 100644 --- a/docs/index.html +++ b/docs/index.html @@ -25,6 +25,8 @@ + +
-
- +
+ -

Static documentation of this R package can be found at https://pkgdown.jrwb.de/chemCal

+
+

Overview +

+

chemCal is an R package providing some basic functions for conveniently working with linear calibration curves with one explanatory variable.

+
+
+

Installation +

+

From within R, get the official chemCal release using

+
+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)
+

+
+
+

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
+

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 beta (default is 0.05 following the IUPAC recommendation).

+

You can also calculate the decision limit (German: Nachweisgrenze), 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
+

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
+
+
+

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
+

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
+
+
+
+

Reference +

+

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

+
- - + + 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 - - - - + + -
-
- -
- -
+
+
-
- +
- - + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml new file mode 100644 index 0000000..5d588da --- /dev/null +++ b/docs/sitemap.xml @@ -0,0 +1,57 @@ + + + + /404.html + + + /articles/chemCal.html + + + /articles/index.html + + + /authors.html + + + /index.html + + + /news/index.html + + + /reference/calplot.lm.html + + + /reference/chemCal-package.html + + + /reference/din32645.html + + + /reference/index.html + + + /reference/inverse.predict.html + + + /reference/lod.html + + + /reference/loq.html + + + /reference/massart97ex1.html + + + /reference/massart97ex3.html + + + /reference/rl95_cadmium.html + + + /reference/rl95_toluene.html + + + /reference/utstats14.html + + -- cgit v1.2.1