From aaa4cab7e0c7212f91147a9789af54b97fe342ca Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 29 Nov 2022 20:23:17 +0100 Subject: Complete starting values in summary for saem.mmkin fits Also update tests to the changes in mhmkin (see NEWS) --- tests/testthat/test_mhmkin.R | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'tests/testthat/test_mhmkin.R') diff --git a/tests/testthat/test_mhmkin.R b/tests/testthat/test_mhmkin.R index 93333ac1..e2339f28 100644 --- a/tests/testthat/test_mhmkin.R +++ b/tests/testthat/test_mhmkin.R @@ -46,14 +46,4 @@ test_that("Multiple hierarchical kinetic models can be fitted and diagnosed", { print(fits_synth_const), "print_fits_synth_const.txt") - hfits_no_ranef_auto <- update(hfits, no_random_effect = "auto", auto_ranef_threshold = 2) - - expect_known_output( - print(hfits_no_ranef_auto), - "print_hfits_synth_no_ranef_auto.txt") - - expect_known_output( - print(illparms(hfits_no_ranef_auto)), - "illparms_hfits_synth_no_ranef_auto.txt") - }) -- cgit v1.2.1 From 74e44dfed5af6e6fd421abe82d3e3f190771f85a Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 1 Dec 2022 11:20:00 +0100 Subject: Possibility to manually specify no_random_effects in mhmkin --- tests/testthat/test_mhmkin.R | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'tests/testthat/test_mhmkin.R') diff --git a/tests/testthat/test_mhmkin.R b/tests/testthat/test_mhmkin.R index e2339f28..da063326 100644 --- a/tests/testthat/test_mhmkin.R +++ b/tests/testthat/test_mhmkin.R @@ -3,8 +3,11 @@ context("Batch fitting and diagnosing hierarchical kinetic models") test_that("Multiple hierarchical kinetic models can be fitted and diagnosed", { skip_on_cran() - fits_synth_const <- suppressWarnings( - mmkin(c("SFO", "FOMC"), ds_sfo[1:6], cores = n_cores, quiet = TRUE)) + fits_synth_const <- mmkin(c("SFO", "FOMC"), ds_fomc[1:6], cores = n_cores, quiet = TRUE) + + expect_known_output( + print(fits_synth_const), + "print_fits_synth_const.txt") fits_synth_tc <- suppressWarnings( update(fits_synth_const, error_model = "tc")) @@ -19,8 +22,8 @@ test_that("Multiple hierarchical kinetic models can be fitted and diagnosed", { print(illparms(hfits)), "illparms_hfits_synth.txt") - expect_equal(which.min(AIC(hfits)), 3) - expect_equal(which.min(BIC(hfits)), 3) + expect_equal(which.min(AIC(hfits)), 4) + expect_equal(which.min(BIC(hfits)), 4) hfit_sfo_tc <- update(hfits[["SFO", "tc"]], covariance.model = diag(c(0, 1))) @@ -38,12 +41,19 @@ test_that("Multiple hierarchical kinetic models can be fitted and diagnosed", { expect_known_output(print(test_summary, digits = 1), "summary_hfit_sfo_tc.txt") - # It depends on the platform exactly which of the datasets fail to converge - # with FOMC, because they were generated to be SFO - skip_on_travis() - - expect_known_output( - print(fits_synth_const), - "print_fits_synth_const.txt") - + hfits_sfo_reduced <- update(hfits, + no_random_effect = illparms(hfits)) + expect_equal( + as.character(illparms(hfits_sfo_reduced)), + rep("", 4)) + + # We can also manually set up an object specifying random effects to be + # excluded. Entries in the inital list have to be by column + no_ranef <- list("parent_0", "log_beta", "parent_0", c("parent_0", "log_beta")) + dim(no_ranef) <- c(2, 2) + + hfits_sfo_reduced_2 <- update(hfits, + no_random_effect = no_ranef) + expect_equivalent(round(anova(hfits_sfo_reduced), 0), + round(anova(hfits_sfo_reduced_2), 0)) }) -- cgit v1.2.1