From 73e650114af77582238abf5273e63005e0b2287e Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 6 Mar 2017 17:00:48 +0100 Subject: Static documentation now built by pkgdown::build_site() --- docs/reference/calplot-2.png | Bin 0 -> 21681 bytes docs/reference/calplot.lm.html | 177 ++++++++++++++++++++++++++++++ docs/reference/chemCal-package.html | 115 ++++++++++++++++++++ docs/reference/din32645-2.png | Bin 0 -> 19858 bytes docs/reference/din32645.html | 175 ++++++++++++++++++++++++++++++ docs/reference/index.html | 146 +++++++++++++++++++++++++ docs/reference/inverse.predict.html | 211 ++++++++++++++++++++++++++++++++++++ docs/reference/lod.html | 210 +++++++++++++++++++++++++++++++++++ docs/reference/loq.html | 205 +++++++++++++++++++++++++++++++++++ docs/reference/massart97ex1.html | 118 ++++++++++++++++++++ docs/reference/massart97ex3-5.png | Bin 0 -> 16419 bytes docs/reference/massart97ex3.html | 188 ++++++++++++++++++++++++++++++++ 12 files changed, 1545 insertions(+) create mode 100644 docs/reference/calplot-2.png create mode 100644 docs/reference/calplot.lm.html create mode 100644 docs/reference/chemCal-package.html create mode 100644 docs/reference/din32645-2.png create mode 100644 docs/reference/din32645.html create mode 100644 docs/reference/index.html create mode 100644 docs/reference/inverse.predict.html create mode 100644 docs/reference/lod.html create mode 100644 docs/reference/loq.html create mode 100644 docs/reference/massart97ex1.html create mode 100644 docs/reference/massart97ex3-5.png create mode 100644 docs/reference/massart97ex3.html (limited to 'docs/reference') diff --git a/docs/reference/calplot-2.png b/docs/reference/calplot-2.png new file mode 100644 index 0000000..7e40a4b Binary files /dev/null and b/docs/reference/calplot-2.png differ diff --git a/docs/reference/calplot.lm.html b/docs/reference/calplot.lm.html new file mode 100644 index 0000000..f66e636 --- /dev/null +++ b/docs/reference/calplot.lm.html @@ -0,0 +1,177 @@ + + + + + + + + +Plot calibration graphs from univariate linear models — calplot • chemCal + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + + +

Produce graphics of calibration data, the fitted model as well + as confidence, and, for unweighted regression, prediction bands.

+ + +
calplot(object, xlim = c("auto", "auto"), ylim = c("auto", "auto"),
+    xlab = "Concentration", ylab = "Response", 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. +
+
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

+ +

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, + 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 + half the value of the calplot() alpha parameter.

+ + +

Examples

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

Site built with pkgdown.

+
+ +
+
+ + + diff --git a/docs/reference/chemCal-package.html b/docs/reference/chemCal-package.html new file mode 100644 index 0000000..18e3822 --- /dev/null +++ b/docs/reference/chemCal-package.html @@ -0,0 +1,115 @@ + + + + + + + + + + — chemCal-package • chemCal + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + + +

See ../DESCRIPTION

+ + + +

Details

+ +

There is a package vignette located in ../doc/chemCal.pdf.

+ + +
+ +
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + diff --git a/docs/reference/din32645-2.png b/docs/reference/din32645-2.png new file mode 100644 index 0000000..1d1e8ab Binary files /dev/null and b/docs/reference/din32645-2.png differ diff --git a/docs/reference/din32645.html b/docs/reference/din32645.html new file mode 100644 index 0000000..1b64592 --- /dev/null +++ b/docs/reference/din32645.html @@ -0,0 +1,175 @@ + + + + + + + + +Calibration data from DIN 32645 — din32645 • chemCal + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + + +

Sample dataset to test the package.

+ + +
data(din32645)
+ +

Format

+ +

A dataframe containing 10 rows of x and y values.

+ +

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 + the Website of the University of Heidelberg.

+

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

+
data(din32645) +m <- lm(y ~ x, data = din32645) +calplot(m)
+## Prediction of x with confidence interval +(prediction <- inverse.predict(m, 3500, alpha = 0.01))
#> $Prediction +#> [1] 0.1054792 +#> +#> $`Standard Error` +#> [1] 0.02215619 +#> +#> $Confidence +#> [1] 0.07434261 +#> +#> $`Confidence Limits` +#> [1] 0.03113656 0.17982178 +#>
+# 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))
#> $x +#> [1] 0.0698127 +#> +#> $y +#> 1 +#> 3155.393 +#>
+# 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))
#> $x +#> [1] 0.2119575 +#> +#> $y +#> 1 +#> 4528.787 +#>
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
+
+ +
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + diff --git a/docs/reference/index.html b/docs/reference/index.html new file mode 100644 index 0000000..b55336a --- /dev/null +++ b/docs/reference/index.html @@ -0,0 +1,146 @@ + + + + + + + + +Function reference • chemCal + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + diff --git a/docs/reference/inverse.predict.html b/docs/reference/inverse.predict.html new file mode 100644 index 0000000..60d169c --- /dev/null +++ b/docs/reference/inverse.predict.html @@ -0,0 +1,211 @@ + + + + + + + + +Predict x from y for a linear calibration — inverse.predict • chemCal + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + + +

This function predicts x values using a univariate linear model that has been + generated for the purpose of calibrating a measurement method. Prediction + intervals are given at the specified confidence level. + The calculation method was taken from Massart et al. (1997). In particular, + Equations 8.26 and 8.28 were combined in order to yield a general treatment + of inverse prediction for univariate linear models, taking into account + weights that have been used to create the linear model, and at the same + time providing the possibility to specify a precision in sample measurements + differing from the precision in standard samples used for the calibration. + This is elaborated in the package vignette.

+ + +
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 + the residual standard error from the calibration and to adjust it + using ws, if applicable. This means that var.s + overrides ws. +
+
+ +

Value

+ +

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

+ +

Note

+ +

The function was validated with examples 7 and 8 from Massart et al. (1997).

+ +

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) +data(massart97ex1) +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 +#>
+
+ +
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + diff --git a/docs/reference/lod.html b/docs/reference/lod.html new file mode 100644 index 0000000..7c33d47 --- /dev/null +++ b/docs/reference/lod.html @@ -0,0 +1,210 @@ + + + + + + + + +Estimate a limit of detection (LOD) — lod • chemCal + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + + +

The decision limit (German: Nachweisgrenze) is defined as the signal or + analyte concentration that is significantly different from the blank signal + with a first order error alpha (one-sided significance test). + The detection limit, or more precise, the minimum detectable value + (German: Erfassungsgrenze), is then defined as the signal or analyte + concentration where the probability that the signal is not detected although + the analyte is present (type II or false negative error), is beta (also a + one-sided significance test).

+ + +
lod(object, …, alpha = 0.05, beta = 0.05, method = "default", tol = "default")
+ +

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

+ +

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

+ +

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 + function, which is currently not supported in R.

+ +

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

+

J. Inczedy, T. Lengyel, and A.M. Ure (2002) International Union of Pure and + Applied Chemistry Compendium of Analytical Nomenclature: Definitive Rules. + Web edition.

+

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

+
data(din32645) +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 +#>
+
+ +
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + diff --git a/docs/reference/loq.html b/docs/reference/loq.html new file mode 100644 index 0000000..bc62e75 --- /dev/null +++ b/docs/reference/loq.html @@ -0,0 +1,205 @@ + + + + + + + + +Estimate a limit of quantification (LOQ) — loq • chemCal + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + + +

The limit of quantification is the x value, where the relative error + of the quantification given the calibration model reaches a prespecified + value 1/k. Thus, it is the solution of the equation + $$L = k c(L)$$ + where c(L) is half of the length of the confidence interval at the limit L + (DIN 32645, equivalent to ISO 11843). c(L) is internally estimated by + inverse.predict, and L is obtained by iteration.

+ + +
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 + 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 + to one for unweighted regression, and to the mean of the weights + 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 + smallest non-zero standard divided by 1000. Can be set to a + numeric value to override this. +
+
+ +

Value

+ +

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

+ +

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

+
data(massart97ex3) +attach(massart97ex3) +m <- lm(y ~ x) +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 +#>
+
+ +
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + diff --git a/docs/reference/massart97ex1.html b/docs/reference/massart97ex1.html new file mode 100644 index 0000000..9b95a5f --- /dev/null +++ b/docs/reference/massart97ex1.html @@ -0,0 +1,118 @@ + + + + + + + + +Calibration data from Massart et al. (1997), example 1 — massart97ex1 • chemCal + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + + +

Sample dataset from p. 175 to test the package.

+ + +
data(massart97ex1)
+ +

Format

+ +

A dataframe containing 6 observations of x and y data.

+ +

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.

+ + +
+ +
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + diff --git a/docs/reference/massart97ex3-5.png b/docs/reference/massart97ex3-5.png new file mode 100644 index 0000000..c6c080e Binary files /dev/null and b/docs/reference/massart97ex3-5.png differ diff --git a/docs/reference/massart97ex3.html b/docs/reference/massart97ex3.html new file mode 100644 index 0000000..2ec8f6f --- /dev/null +++ b/docs/reference/massart97ex3.html @@ -0,0 +1,188 @@ + + + + + + + + +Calibration data from Massart et al. (1997), example 3 — massart97ex3 • chemCal + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + + +

Sample dataset from p. 188 to test the package.

+ + +
data(massart97ex3)
+ +

Format

+ +

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

+ +

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

+
data(massart97ex3) +attach(massart97ex3)
#> The following objects are masked from massart97ex3 (pos = 3): +#> +#> x, y
yx <- split(y, x) +ybar <- sapply(yx, mean) +s <- round(sapply(yx, sd), digits = 2) +w <- round(1 / (s^2), digits = 3) +weights <- w[factor(x)] +m <- lm(y ~ x, w = weights) +calplot(m)
#> Warning: Assuming constant prediction variance even though model fit is weighted
+# The following concords with the book p. 200 +inverse.predict(m, 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(m, 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) +lod(m0)
#> $x +#> [1] 5.407085 +#> +#> $y +#> 1 +#> 13.63911 +#>
+# Limit of quantification from unweighted regression +loq(m0)
#> $x +#> [1] 13.97764 +#> +#> $y +#> 1 +#> 30.6235 +#>
+# 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(m, 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.
+
+ +
+ + +
+ + + -- cgit v1.2.1