aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test_din32645.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2018-07-05 18:44:22 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2018-07-05 18:44:22 +0200
commit9411139beee167c5339e96db448e5dbed19e06bc (patch)
tree1bba625b3a2288c1ede4eefe1c23d3bcfa0f9fcc /tests/testthat/test_din32645.R
parent801e95f1cc7bfcc8480f6f49b9da2331be71d1a9 (diff)
Maintenance in preparation of improvements
- Switch vignette to html - Switch tests to testthat - NEWS.md instead of ChangeLog - Remove names of y in lists returned by lod and loq
Diffstat (limited to 'tests/testthat/test_din32645.R')
-rw-r--r--tests/testthat/test_din32645.R33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/testthat/test_din32645.R b/tests/testthat/test_din32645.R
new file mode 100644
index 0000000..e6d2840
--- /dev/null
+++ b/tests/testthat/test_din32645.R
@@ -0,0 +1,33 @@
+context("Known results for the dataset provided in DIN 32645")
+
+require(chemCal)
+
+m <- lm(y ~ x, data = din32645)
+prediction <- inverse.predict(m, 3500, alpha = 0.01)
+
+test_that("We get correct confidence intervals", {
+ # Result collected from Procontrol 3.1 (isomehr GmbH)
+ expect_equal(round(prediction$Confidence, 5), 0.07434)
+})
+
+test_that("We get a correct critical value", {
+ crit <- lod(m, alpha = 0.01, beta = 0.5)
+ # DIN 32645 gives 0.07 for the critical value
+ # (decision limit, "Nachweisgrenze")
+ expect_equal(round(crit$x, 2), 0.07)
+ # According to Dintest test data, we should get 0.0698
+ expect_equal(round(crit$x, 4), 0.0698)
+})
+
+test_that("We get a correct smalles detectable value using the DIN method", {
+ lod.din <- lod(m, alpha = 0.01, beta = 0.01, method = "din")
+ # DIN 32645 gives 0.14 for the smallest detectable value ("Erfassungsgrenze")
+ expect_equal(round(lod.din$x, 2), 0.14)
+})
+
+test_that("We get a correct limit of quantification", {
+ loq.din <- loq(m, alpha = 0.01)
+ # The value cited for Procontrol 3.1 (0.2121) deviates
+ # at the last digit, so we only test for three digits
+ expect_equal(round(loq.din$x, 3), 0.212)
+})

Contact - Imprint