aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-11-01 12:19:03 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2019-11-01 12:19:03 +0100
commitbbb74d4f60033899cd5cdd36aa70f157bc52209e (patch)
treeca0f620ba0ffd59ff242071260d2346e4ca254ff /tests/testthat
parent70e48e8360875f22970174d409c46cb3f076fa99 (diff)
Fix bug in yesterdays release, add methods for BIC
Diffstat (limited to 'tests/testthat')
-rw-r--r--tests/testthat/FOCUS_2006_D.csf2
-rw-r--r--tests/testthat/test_error_models.R8
-rw-r--r--tests/testthat/test_plots_summary_twa.R3
3 files changed, 11 insertions, 2 deletions
diff --git a/tests/testthat/FOCUS_2006_D.csf b/tests/testthat/FOCUS_2006_D.csf
index 942d56e1..a28aafec 100644
--- a/tests/testthat/FOCUS_2006_D.csf
+++ b/tests/testthat/FOCUS_2006_D.csf
@@ -5,7 +5,7 @@ Description:
MeasurementUnits: % AR
TimeUnits: days
Comments: Created using mkin::CAKE_export
-Date: 2019-10-31
+Date: 2019-11-01
Optimiser: IRLS
[Data]
diff --git a/tests/testthat/test_error_models.R b/tests/testthat/test_error_models.R
index 12a8b7e5..83cff2e5 100644
--- a/tests/testthat/test_error_models.R
+++ b/tests/testthat/test_error_models.R
@@ -36,30 +36,36 @@ test_that("The different error model fitting methods work for parent fits", {
f_9_OLS <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data,
quiet = TRUE)
expect_equivalent(round(AIC(f_9_OLS), 2), 137.43)
+ f_9_parms_const <- parms(f_9_OLS)
f_9_direct <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data,
error_model = "tc", error_model_algorithm = "direct", quiet = TRUE)
expect_equivalent(round(AIC(f_9_direct), 2), 134.94)
+ f_9_parms_tc_direct <- parms(f_9_direct)
f_9_twostep <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data,
error_model = "tc", error_model_algorithm = "twostep", quiet = TRUE)
- expect_equivalent(round(AIC(f_9_twostep), 2), 134.94)
+ expect_equivalent(parms(f_9_twostep), f_9_parms_tc_direct)
f_9_threestep <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data,
error_model = "tc", error_model_algorithm = "threestep", quiet = TRUE)
expect_equivalent(round(AIC(f_9_threestep), 2), 139.43)
+ expect_equivalent(parms(f_9_threestep)[1:3], f_9_parms_const)
f_9_fourstep <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data,
error_model = "tc", error_model_algorithm = "fourstep", quiet = TRUE)
expect_equivalent(round(AIC(f_9_fourstep), 2), 139.43)
+ expect_equivalent(parms(f_9_fourstep)[1:3], f_9_parms_const)
f_9_IRLS <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data,
error_model = "tc", error_model_algorithm = "IRLS", quiet = TRUE)
expect_equivalent(round(AIC(f_9_IRLS), 2), 139.43)
+ expect_equivalent(parms(f_9_IRLS)[1:3], f_9_parms_const)
f_9_d_3 <- mkinfit("SFO", experimental_data_for_UBA_2019[[9]]$data,
error_model = "tc", error_model_algorithm = "d_3", quiet = TRUE)
expect_equivalent(round(AIC(f_9_d_3), 2), 134.94)
+ expect_equivalent(parms(f_9_d_3), f_9_parms_tc_direct)
})
test_that("The default error model algorithm finds the best known AIC values for parent fits", {
diff --git a/tests/testthat/test_plots_summary_twa.R b/tests/testthat/test_plots_summary_twa.R
index 28c569b6..5917dd6e 100644
--- a/tests/testthat/test_plots_summary_twa.R
+++ b/tests/testthat/test_plots_summary_twa.R
@@ -126,4 +126,7 @@ test_that("The AIC is reproducible", {
data.frame(df = c(3, 4, 5, 5), AIC = c(59.3, 44.7, 29.0, 39.2)),
scale = 1, tolerance = 0.1)
expect_error(AIC(fits["SFO", ]), "column object")
+ expect_equivalent(BIC(fits[, "FOCUS_C"]),
+ data.frame(df = c(3, 4, 5, 5), AIC = c(59.9, 45.5, 30.0, 40.2)),
+ scale = 1, tolerance = 0.1)
})

Contact - Imprint