aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test_error_models.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-04-10 10:17:35 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-04-10 10:17:35 +0200
commit194659fcaccdd1ee37851725b8c72e99daa3a8cf (patch)
treeedbbebe8956000b9eb725ca425b91e051571ec02 /tests/testthat/test_error_models.R
parent5814be02f286ce96d6cff8d698aea6844e4025f1 (diff)
Adapt tests, vignettes and examples
- Write the NEWS - Static documentation rebuilt by pkgdown - Adapt mkinerrmin - Fix (hopefully all) remaining problems in mkinfit
Diffstat (limited to 'tests/testthat/test_error_models.R')
-rw-r--r--tests/testthat/test_error_models.R17
1 files changed, 5 insertions, 12 deletions
diff --git a/tests/testthat/test_error_models.R b/tests/testthat/test_error_models.R
index bda8ca7f..5a7aa4e8 100644
--- a/tests/testthat/test_error_models.R
+++ b/tests/testthat/test_error_models.R
@@ -1,4 +1,4 @@
-# Copyright (C) 2018 Johannes Ranke
+# Copyright (C) 2018,2019 Johannes Ranke
# Contact: jranke@uni-bremen.de
# This file is part of the R package mkin
@@ -70,13 +70,6 @@ test_that("Error model 'tc' works", {
expect_equivalent(parms_3, c(102.1, 0.7393, 0.2992, 0.0202, 0.7687, 0.7229))
})
-test_that("Error model 'obs_tc' works", {
- skip_on_cran()
- fit_obs_tc_1 <- expect_warning(mkinfit(m_synth_SFO_lin, SFO_lin_a, error_model = "obs_tc", quiet = TRUE), "NaN")
- # Here the error model is overparameterised
- expect_warning(summary(fit_obs_tc_1), "singular system")
-})
-
test_that("Reweighting method 'tc' produces reasonable variance estimates", {
# I need to make the tc method more robust against that
@@ -148,7 +141,7 @@ test_that("Reweighting method 'tc' produces reasonable variance estimates", {
d_met_2_15 <- add_err(d_synth_DFOP_lin,
sdfunc = function(x) sigma_twocomp(x, 0.5, 0.07),
- n = 15, reps = 100, digits = 5, LOD = -Inf, seed = 123456)
+ n = 15, reps = 100, digits = 5, LOD = 0.01, seed = 123456)
# For a single fit, we get a relative error of less than 10% in the error
# model components
@@ -165,14 +158,14 @@ test_that("Reweighting method 'tc' produces reasonable variance estimates", {
parms_met_2_15_tc_e4 <- apply(sapply(f_met_2_15_tc_e4, function(x) x$bparms.optim), 1, mean)
parm_errors_met_2_15_tc_e4 <- (parms_met_2_15_tc_e4[names(parms_DFOP_lin_optim)] -
parms_DFOP_lin_optim) / parms_DFOP_lin_optim
- expect_true(all(abs(parm_errors_met_2_15_tc_e4) < 0.01))
+ expect_true(all(abs(parm_errors_met_2_15_tc_e4) < 0.015))
tcf_met_2_15_tc <- apply(sapply(f_met_2_15_tc_e4, function(x) x$errparms), 1, mean, na.rm = TRUE)
tcf_met_2_15_tc_error_model_errors <- (tcf_met_2_15_tc - c(0.5, 0.07)) /
c(0.5, 0.07)
- # Here we get a precision < 15% for retrieving the original error model components
+ # Here we get a precision < 10% for retrieving the original error model components
# from 15 datasets
- expect_true(all(abs(tcf_met_2_15_tc_error_model_errors) < 0.15))
+ expect_true(all(abs(tcf_met_2_15_tc_error_model_errors) < 0.10))
})

Contact - Imprint