From 280d36230052de4f94e384648c1283031fbc9840 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 17 Jul 2018 17:29:14 +0200 Subject: Fix inverse predictions for replicate measurements For details, see NEWS.md --- man/inverse.predict.Rd | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'man/inverse.predict.Rd') 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} -- cgit v1.2.1