aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-10-21 21:05:58 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-10-21 21:05:58 +0200
commit0b9d87701328720558c2c7206c790ed1b17ce7bb (patch)
treef403b74219e9fd30a6ac01ab2ab3a8237cc6191c /tests
parent23258f4aa2faceb7b7f23c5386b2803b3a8e16ca (diff)
Explicit solution_type for FOCUS D in tests
Because on winbuilder obviously gcc was not found, so the Eigenvalue based solution method was used, leading to a test failure when comparing the summary, as the solution method is listed
Diffstat (limited to 'tests')
-rw-r--r--tests/testthat/setup_script.R7
-rw-r--r--tests/testthat/summary_DFOP_FOCUS_D_deSolve.txt (renamed from tests/testthat/summary_DFOP_FOCUS_D.txt)0
-rw-r--r--tests/testthat/summary_DFOP_FOCUS_D_eigen.txt125
-rw-r--r--tests/testthat/test_plots_summary_twa.R21
4 files changed, 147 insertions, 6 deletions
diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R
index c1d46dcb..d8d94d4b 100644
--- a/tests/testthat/setup_script.R
+++ b/tests/testthat/setup_script.R
@@ -45,9 +45,12 @@ SFO_SFO.ff <- mkinmod(parent = list(type = "SFO", to = "m1"),
m1 = list(type = "SFO"),
use_of_ff = "max", quiet = TRUE)
-f_sfo_sfo <- mkinfit(SFO_SFO,
+f_sfo_sfo_desolve <- mkinfit(SFO_SFO,
subset(FOCUS_2006_D, value != 0),
- quiet = TRUE)
+ solution_type = "deSolve", quiet = TRUE)
+f_sfo_sfo_eigen <- mkinfit(SFO_SFO,
+ subset(FOCUS_2006_D, value != 0),
+ solution_type = "eigen", quiet = TRUE)
f_sfo_sfo.ff <- mkinfit(SFO_SFO.ff,
subset(FOCUS_2006_D, value != 0),
diff --git a/tests/testthat/summary_DFOP_FOCUS_D.txt b/tests/testthat/summary_DFOP_FOCUS_D_deSolve.txt
index 8abc15e7..8abc15e7 100644
--- a/tests/testthat/summary_DFOP_FOCUS_D.txt
+++ b/tests/testthat/summary_DFOP_FOCUS_D_deSolve.txt
diff --git a/tests/testthat/summary_DFOP_FOCUS_D_eigen.txt b/tests/testthat/summary_DFOP_FOCUS_D_eigen.txt
new file mode 100644
index 00000000..b570a15e
--- /dev/null
+++ b/tests/testthat/summary_DFOP_FOCUS_D_eigen.txt
@@ -0,0 +1,125 @@
+mkin version used for fitting: Dummy 0.0 for testing
+R version used for fitting: Dummy R version for testing
+Date of fit: Dummy date for testing
+Date of summary: Dummy date for testing
+
+Equations:
+d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent
+d_m1/dt = + k_parent_m1 * parent - k_m1_sink * m1
+
+Model predictions using solution type eigen
+
+Fitted using test 0 model solutions performed in test time 0 s
+
+Error model: Constant variance
+
+Error model algorithm: OLS
+
+Starting values for parameters to be optimised:
+ value type
+parent_0 100.7500 state
+k_parent_sink 0.1000 deparm
+k_parent_m1 0.1001 deparm
+k_m1_sink 0.1002 deparm
+
+Starting values for the transformed parameters actually optimised:
+ value lower upper
+parent_0 100.750000 -Inf Inf
+log_k_parent_sink -2.302585 -Inf Inf
+log_k_parent_m1 -2.301586 -Inf Inf
+log_k_m1_sink -2.300587 -Inf Inf
+
+Fixed parameter values:
+ value type
+m1_0 0 state
+
+Optimised, transformed parameters with symmetric confidence intervals:
+ Estimate Std. Error Lower Upper
+parent_0 99.600 1.57000 96.400 102.800
+log_k_parent_sink -3.038 0.07626 -3.193 -2.883
+log_k_parent_m1 -2.980 0.04033 -3.062 -2.898
+log_k_m1_sink -5.248 0.13320 -5.518 -4.977
+sigma 3.126 0.35850 2.396 3.855
+
+Parameter correlation:
+ parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink
+parent_0 1e+00 6e-01 -6e-02 -2e-01
+log_k_parent_sink 6e-01 1e+00 -9e-02 -6e-01
+log_k_parent_m1 -6e-02 -9e-02 1e+00 5e-01
+log_k_m1_sink -2e-01 -6e-01 5e-01 1e+00
+sigma 1e-09 6e-10 3e-08 1e-09
+ sigma
+parent_0 1e-09
+log_k_parent_sink 6e-10
+log_k_parent_m1 3e-08
+log_k_m1_sink 1e-09
+sigma 1e+00
+
+Backtransformed parameters:
+Confidence intervals for internally transformed parameters are asymmetric.
+t-test (unrealistically) based on the assumption of normal distribution
+for estimators of untransformed parameters.
+ Estimate t value Pr(>t) Lower Upper
+parent_0 99.600000 63.430 2.298e-36 96.400000 1.028e+02
+k_parent_sink 0.047920 13.110 6.126e-15 0.041030 5.596e-02
+k_parent_m1 0.050780 24.800 3.269e-23 0.046780 5.512e-02
+k_m1_sink 0.005261 7.510 6.165e-09 0.004012 6.898e-03
+sigma 3.126000 8.718 2.235e-10 2.396000 3.855e+00
+
+FOCUS Chi2 error levels in percent:
+ err.min n.optim df
+All data 6.398 4 15
+parent 6.827 3 6
+m1 4.490 1 9
+
+Resulting formation fractions:
+ ff
+parent_sink 0.4855
+parent_m1 0.5145
+m1_sink 1.0000
+
+Estimated disappearance times:
+ DT50 DT90
+parent 7.023 23.33
+m1 131.761 437.70
+
+Data:
+ time variable observed predicted residual
+ 0 parent 99.46 99.59848 -1.385e-01
+ 0 parent 102.04 99.59848 2.442e+00
+ 1 parent 93.50 90.23787 3.262e+00
+ 1 parent 92.50 90.23787 2.262e+00
+ 3 parent 63.23 74.07320 -1.084e+01
+ 3 parent 68.99 74.07320 -5.083e+00
+ 7 parent 52.32 49.91207 2.408e+00
+ 7 parent 55.13 49.91207 5.218e+00
+ 14 parent 27.27 25.01257 2.257e+00
+ 14 parent 26.64 25.01257 1.627e+00
+ 21 parent 11.50 12.53462 -1.035e+00
+ 21 parent 11.64 12.53462 -8.946e-01
+ 35 parent 2.85 3.14787 -2.979e-01
+ 35 parent 2.91 3.14787 -2.379e-01
+ 50 parent 0.69 0.71624 -2.624e-02
+ 50 parent 0.63 0.71624 -8.624e-02
+ 75 parent 0.05 0.06074 -1.074e-02
+ 75 parent 0.06 0.06074 -7.382e-04
+ 1 m1 4.84 4.80296 3.704e-02
+ 1 m1 5.64 4.80296 8.370e-01
+ 3 m1 12.91 13.02400 -1.140e-01
+ 3 m1 12.96 13.02400 -6.400e-02
+ 7 m1 22.97 25.04476 -2.075e+00
+ 7 m1 24.47 25.04476 -5.748e-01
+ 14 m1 41.69 36.69002 5.000e+00
+ 14 m1 33.21 36.69002 -3.480e+00
+ 21 m1 44.37 41.65310 2.717e+00
+ 21 m1 46.44 41.65310 4.787e+00
+ 35 m1 41.22 43.31312 -2.093e+00
+ 35 m1 37.95 43.31312 -5.363e+00
+ 50 m1 41.19 41.21831 -2.831e-02
+ 50 m1 40.01 41.21831 -1.208e+00
+ 75 m1 40.09 36.44703 3.643e+00
+ 75 m1 33.85 36.44703 -2.597e+00
+ 100 m1 31.04 31.98163 -9.416e-01
+ 100 m1 33.13 31.98163 1.148e+00
+ 120 m1 25.15 28.78984 -3.640e+00
+ 120 m1 33.31 28.78984 4.520e+00
diff --git a/tests/testthat/test_plots_summary_twa.R b/tests/testthat/test_plots_summary_twa.R
index 68ac7dcd..306a585c 100644
--- a/tests/testthat/test_plots_summary_twa.R
+++ b/tests/testthat/test_plots_summary_twa.R
@@ -59,7 +59,7 @@ test_that("Summaries are reproducible", {
test_summary$Corr <- signif(test_summary$Corr, 1)
expect_known_output(print(test_summary), "summary_DFOP_FOCUS_C.txt")
- test_summary_2 <- summary(f_sfo_sfo)
+ test_summary_2 <- summary(f_sfo_sfo_eigen)
test_summary_2$fit_version <- "Dummy 0.0 for testing"
test_summary_2$fit_Rversion <- "Dummy R version for testing"
test_summary_2$date.fit <- "Dummy date for testing"
@@ -70,7 +70,20 @@ test_that("Summaries are reproducible", {
# It differs between i386 and amd64 on Windows
# and between Travis and my own Linux system
test_summary_2$Corr <- signif(test_summary_2$Corr, 1)
- expect_known_output(print(test_summary_2), "summary_DFOP_FOCUS_D.txt")
+ expect_known_output(print(test_summary_2), "summary_DFOP_FOCUS_D_eigen.txt")
+
+ test_summary_3 <- summary(f_sfo_sfo_desolve)
+ test_summary_3$fit_version <- "Dummy 0.0 for testing"
+ test_summary_3$fit_Rversion <- "Dummy R version for testing"
+ test_summary_3$date.fit <- "Dummy date for testing"
+ test_summary_3$date.summary <- "Dummy date for testing"
+ test_summary_3$calls <- "test 0"
+ test_summary_3$time <- c(elapsed = "test time 0")
+ # The correlation matrix is quite platform dependent
+ # It differs between i386 and amd64 on Windows
+ # and between Travis and my own Linux system
+ test_summary_3$Corr <- signif(test_summary_3$Corr, 1)
+ expect_known_output(print(test_summary_3), "summary_DFOP_FOCUS_D_deSolve.txt")
})
context("Plotting")
@@ -82,8 +95,8 @@ test_that("Plotting mkinfit and mmkin objects is reproducible", {
mkinerrplot_FOCUS_C_SFO <- function() mkinerrplot(fits[["SFO", "FOCUS_C"]])
mmkin_FOCUS_C <- function() plot(fits[, "FOCUS_C"])
mmkin_SFO <- function() plot(fits["SFO",])
- plot_res_sfo_sfo <- function() plot_res(f_sfo_sfo)
- plot_err_sfo_sfo <- function() plot_err(f_sfo_sfo)
+ plot_res_sfo_sfo <- function() plot_res(f_sfo_sfo_desolve)
+ plot_err_sfo_sfo <- function() plot_err(f_sfo_sfo_desolve)
vdiffr::expect_doppelganger("mkinfit plot for FOCUS C with sep = TRUE", plot_sep_FOCUS_C_SFO)
vdiffr::expect_doppelganger("mkinparplot for FOCUS C SFO", mkinparplot_FOCUS_C_SFO)

Contact - Imprint