aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test_lod_loq.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_lod_loq.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_lod_loq.R')
-rw-r--r--tests/testthat/test_lod_loq.R28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/testthat/test_lod_loq.R b/tests/testthat/test_lod_loq.R
new file mode 100644
index 0000000..6ba0ad0
--- /dev/null
+++ b/tests/testthat/test_lod_loq.R
@@ -0,0 +1,28 @@
+context("LOD and LOQ")
+
+library(chemCal)
+
+test_that("lod is stable across chemCal versions", {
+ m <- lm(y ~ x, data = din32645)
+ lod_1 <- lod(m)
+ expect_equal(signif(lod_1$x, 7), 0.08655484)
+ expect_equal(signif(lod_1$y, 7), 3317.154)
+
+ # Critical value (decision limit, Nachweisgrenze)
+ lod_2 <- lod(m, alpha = 0.01, beta = 0.5)
+ expect_equal(signif(lod_2$x, 7), 0.0698127)
+ expect_equal(signif(lod_2$y, 7), 3155.393)
+})
+
+test_that("loq is stable across chemCal versions", {
+ m2 <- lm(y ~ x, data = massart97ex3)
+ loq_1 <- loq(m2)
+ expect_equal(signif(loq_1$x, 7), 13.97764)
+ expect_equal(signif(loq_1$y, 7), 30.6235)
+
+ loq_2 <- loq(m2, n = 3)
+ expect_equal(signif(loq_2$x, 7), 9.971963)
+ expect_equal(signif(loq_2$y, 7), 22.68539)
+})
+
+

Contact - Imprint