aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-06-03 07:56:44 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-06-03 07:56:44 +0200
commitb6ea4f22fc1b6d1caea29f6b1e44774d14d6697c (patch)
tree8ee349ae11051bae622dc2441bd5954920637d66 /tests/testthat
parent037cdd16f39b8b889e7bda26961a90cd68c6f5a9 (diff)
Status von Samstag morgen - untested
Diffstat (limited to 'tests/testthat')
-rw-r--r--tests/testthat/test_error_models.R42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/testthat/test_error_models.R b/tests/testthat/test_error_models.R
index d7a5cea8..94703e7f 100644
--- a/tests/testthat/test_error_models.R
+++ b/tests/testthat/test_error_models.R
@@ -177,3 +177,45 @@ test_that("Reweighting method 'tc' produces reasonable variance estimates", {
# from 15 datasets
expect_true(all(abs(tcf_met_2_15_tc_error_model_errors) < 0.10))
})
+
+test_that("The two-component error model finds the best known AIC values for parent models", {
+ skip_on_cran()
+ experimental_data_for_UBA_2019
+ library(parallel)
+ source("~/git/mkin/R/mkinfit.R")
+ source("~/git/mkin/R/mmkin.R")
+ f_9 <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data)
+ f_9 <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data,
+ error_model = "tc", error_model_algorithm = "direct")
+ f_9 <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data,
+ error_model = "tc", error_model_algorithm = "twostep")
+ f_9 <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data,
+ error_model = "tc", error_model_algorithm = "threestep")
+ f_9 <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data,
+ error_model = "tc", error_model_algorithm = "fourstep")
+ f_9 <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data,
+ error_model = "tc", error_model_algorithm = "IRLS")
+ AIC(f_9)
+ f_tc_exp <- mmkin(c("SFO"),
+ lapply(experimental_data_for_UBA_2019, function(x) x$data),
+ error_model = "tc",
+ error_model_algorithm = "direct",
+ quiet = TRUE)
+ f_tc_exp <- mmkin(c("SFO"),
+ lapply(experimental_data_for_UBA_2019, function(x) x$data),
+ error_model = "tc",
+ error_model_algorithm = "twostep",
+ quiet = TRUE)
+ f_tc_exp <- mmkin(c("SFO"),
+ lapply(experimental_data_for_UBA_2019, function(x) x$data),
+ error_model = "tc",
+ error_model_algorithm = "threestep",
+ quiet = TRUE)
+
+ AIC_exp <- lapply(f_tc_exp, AIC)
+ dim(AIC_exp) <- dim(f_tc_exp)
+ dimnames(AIC_exp) <- dimnames(f_tc_exp)
+ expect_equivalent(round(AIC_exp["SFO", c(9, 11, 12)], 1), c(134.9, 125.5, 82.0))
+})
+
+

Contact - Imprint