aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test_FOCUS_D_UBA_expertise.R
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testthat/test_FOCUS_D_UBA_expertise.R')
-rw-r--r--tests/testthat/test_FOCUS_D_UBA_expertise.R48
1 files changed, 34 insertions, 14 deletions
diff --git a/tests/testthat/test_FOCUS_D_UBA_expertise.R b/tests/testthat/test_FOCUS_D_UBA_expertise.R
index 3b241aa4..74097afa 100644
--- a/tests/testthat/test_FOCUS_D_UBA_expertise.R
+++ b/tests/testthat/test_FOCUS_D_UBA_expertise.R
@@ -19,15 +19,19 @@
context("Results for FOCUS D established in expertise for UBA (Ranke 2014)")
# Results are from p. 40
+SFO_SFO <- mkinmod(parent = list(type = "SFO", to = "m1"),
+ m1 = list(type = "SFO"), quiet = TRUE)
+SFO_SFO.ff <- mkinmod(parent = list(type = "SFO", to = "m1"),
+ m1 = list(type = "SFO"),
+ use_of_ff = "max", quiet = TRUE)
+
test_that("Fits without formation fractions are correct for FOCUS D", {
- SFO_SFO <- mkinmod(parent = list(type = "SFO", to = "m1"),
- m1 = list(type = "SFO"), quiet = TRUE)
fit.default <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
- expect_equal(round(as.numeric(endpoints(fit.default)$distimes["parent", ]), 2),
+ expect_equal(round(as.numeric(endpoints(fit.default)$distimes["parent", ]), 2),
c(7.02, 23.33))
- expect_equal(round(as.numeric(endpoints(fit.default)$distimes["m1", ]), 1),
+ expect_equal(round(as.numeric(endpoints(fit.default)$distimes["m1", ]), 1),
c(131.8, 437.7))
expect_equal(signif(summary(fit.default)$bpar[, "t value"], 5),
@@ -36,20 +40,36 @@ test_that("Fits without formation fractions are correct for FOCUS D", {
test_that("Fits with formation fractions are correct for FOCUS D", {
skip_on_cran()
- SFO_SFO.ff <- mkinmod(parent = list(type = "SFO", to = "m1"),
- m1 = list(type = "SFO"),
- use_of_ff = "max", quiet = TRUE)
-
fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
- expect_equivalent(round(fit.ff$bparms.optim, c(2, 4, 4, 4)),
+ expect_equivalent(round(fit.ff$bparms.optim, c(2, 4, 4, 4)),
c(99.60, 0.0987, 0.0053, 0.5145))
- expect_equivalent(round(100 * mkinerrmin(fit.ff)$err.min, 2),
+ expect_equivalent(round(100 * mkinerrmin(fit.ff)$err.min, 2),
c(6.40, 6.46, 4.69))
- expect_equal(round(as.numeric(endpoints(fit.ff)$distimes["parent", ]), 2),
+ expect_equal(round(as.numeric(endpoints(fit.ff)$distimes["parent", ]), 2),
+ c(7.02, 23.33))
+ expect_equal(round(as.numeric(endpoints(fit.ff)$distimes["m1", ]), 1),
+ c(131.8, 437.7))
+})
+
+test_that("Fits without internal transformations are correct for FOCUS D", {
+ skip_on_cran()
+ expect_warning(
+ fit.ff.notrans <- mkinfit(SFO_SFO.ff, FOCUS_2006_D,
+ transform_fractions = FALSE, transform_rates = FALSE, quiet = TRUE),
+ "sum of formation fractions")
+
+ expect_equivalent(round(fit.ff.notrans$bparms.optim, c(2, 4, 4, 4)),
+ c(99.60, 0.0987, 0.0053, 0.5145))
+
+ expect_equivalent(round(100 * mkinerrmin(fit.ff.notrans)$err.min, 2),
+ c(6.40, 6.46, 4.69))
+
+
+ expect_equal(round(as.numeric(endpoints(fit.ff.notrans)$distimes["parent", ]), 2),
c(7.02, 23.33))
- expect_equal(round(as.numeric(endpoints(fit.ff)$distimes["m1", ]), 1),
+ expect_equal(round(as.numeric(endpoints(fit.ff.notrans)$distimes["m1", ]), 1),
c(131.8, 437.7))
})
@@ -64,13 +84,13 @@ test_that("The t-value for fits using internal transformations corresponds with
M2 = mkinsub("SFO"),
use_of_ff = "min", quiet = TRUE)
- fit_DFOP_par_c_2 <- mkinfit(m_synth_DFOP_par.minff,
+ fit_DFOP_par_c_2 <- mkinfit(m_synth_DFOP_par.minff,
synthetic_data_for_UBA_2014[[12]]$data,
quiet = TRUE)
# Note that the k1 and k2 are exchanged in the untransformed fit evaluated with FME for this test
expect_equal(signif(summary(fit_DFOP_par_c_2)$bpar[1:7, "t value"], 5),
- c(parent_0 = 80.054, k_M1_sink = 12.291, k_M2_sink = 10.588,
+ c(parent_0 = 80.054, k_M1_sink = 12.291, k_M2_sink = 10.588,
f_parent_to_M1 = 21.4960, f_parent_to_M2 = 24.0890,
k1 = 16.1450, k2 = 8.1747))
})

Contact - Imprint