aboutsummaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2018-07-17 17:29:14 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2018-07-17 17:38:29 +0200
commit280d36230052de4f94e384648c1283031fbc9840 (patch)
treedf0ba9e07386b593cc396b8b6976210d42ee1a46 /man
parente636c17f0d354a8e74546fc1469431dbe502dc76 (diff)
Fix inverse predictions for replicate measurements
For details, see NEWS.md
Diffstat (limited to 'man')
-rw-r--r--man/din32645.Rd13
-rw-r--r--man/inverse.predict.Rd23
-rw-r--r--man/lod.Rd1
-rw-r--r--man/loq.Rd4
-rw-r--r--man/massart97ex3.Rd31
-rw-r--r--man/rl95_toluene.Rd16
6 files changed, 61 insertions, 27 deletions
diff --git a/man/din32645.Rd b/man/din32645.Rd
index 12c641a..ffcbaed 100644
--- a/man/din32645.Rd
+++ b/man/din32645.Rd
@@ -10,19 +10,18 @@
A dataframe containing 10 rows of x and y values.
}
\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 <- 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)
+round(prediction$Confidence, 5)
## Critical value:
-(crit <- lod(m, alpha = 0.01, beta = 0.5))
+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")
@@ -40,12 +39,12 @@ round(lod.din$x, 2)
## 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)
+loq <- loq(m, alpha = 0.01)
+round(loq$x, 4)
# 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
+3.04 * lod(m, alpha = 0.01, beta = 0.5)$x
}
\references{
DIN 32645 (equivalent to ISO 11843), Beuth Verlag, Berlin, 1994
diff --git a/man/inverse.predict.Rd b/man/inverse.predict.Rd
index 26ba6b8..373623e 100644
--- a/man/inverse.predict.Rd
+++ b/man/inverse.predict.Rd
@@ -52,7 +52,10 @@
}
\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{
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,
@@ -60,10 +63,26 @@
}
\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
inverse.predict(m, 90) # 43.9 +- 4.9
inverse.predict(m, rep(90,5)) # 43.9 +- 3.2
+
+# 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
+inverse.predict(m3.means, 90, ws = 0.145) # 44.1 +- 7.9
+
}
\keyword{manip}
diff --git a/man/lod.Rd b/man/lod.Rd
index 04aac1f..ce32670 100644
--- a/man/lod.Rd
+++ b/man/lod.Rd
@@ -74,7 +74,6 @@
Analytica Chimica Acta 391, 105 - 126.
}
\examples{
-data(din32645)
m <- lm(y ~ x, data = din32645)
lod(m)
diff --git a/man/loq.Rd b/man/loq.Rd
index 082cf34..c247f34 100644
--- a/man/loq.Rd
+++ b/man/loq.Rd
@@ -68,9 +68,7 @@
and therefore not tested. Feedback is welcome.
}
\examples{
-data(massart97ex3)
-attach(massart97ex3)
-m <- lm(y ~ x)
+m <- lm(y ~ x, data = massart97ex1)
loq(m)
# We can get better by using replicate measurements
diff --git a/man/massart97ex3.Rd b/man/massart97ex3.Rd
index efdcf02..d7f8d00 100644
--- a/man/massart97ex3.Rd
+++ b/man/massart97ex3.Rd
@@ -5,29 +5,32 @@
\description{
Sample dataset from p. 188 to test the package.
}
-\usage{data(massart97ex3)}
+\usage{massart97ex3}
\format{
A dataframe containing 6 levels of x values with 5
observations of y for each level.
}
\examples{
-data(massart97ex3)
-attach(massart97ex3)
-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)
+# 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(m, 15, ws = 1.67) # 5.9 +- 2.5
-inverse.predict(m, 90, ws = 0.145) # 44.1 +- 7.9
+inverse.predict(m3.means, 15, ws = 1.67) # 5.9 +- 2.5
+inverse.predict(m3.means, 90, ws = 0.145) # 44.1 +- 7.9
# The LOD is only calculated for models from unweighted regression
# with this version of chemCal
-m0 <- lm(y ~ x)
+m0 <- lm(y ~ x, data = massart97ex3)
lod(m0)
# Limit of quantification from unweighted regression
@@ -38,7 +41,7 @@ loq(m0)
# 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)
+loq(m3.means, w.loq = 1.67)
# 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/man/rl95_toluene.Rd b/man/rl95_toluene.Rd
new file mode 100644
index 0000000..1faafdc
--- /dev/null
+++ b/man/rl95_toluene.Rd
@@ -0,0 +1,16 @@
+\name{rl95_toluene}
+\docType{data}
+\alias{rl95_toluene}
+\title{Toluene amounts by GC/MS as reported by Rocke and Lorenzato (1995)}
+\description{
+ Dataset reproduced from Table 4 in Rocke and Lorenzato (1995).
+}
+\format{
+ A dataframe containing four replicate observations for each
+ of the six calibration standards.
+}
+\source{
+ Rocke, David M. und Lorenzato, Stefan (1995) A two-component model for
+ measurement error in analytical chemistry. Technometrics 37(2), 176-184.
+}
+\keyword{datasets}

Contact - Imprint