diff options
| author | Johannes Ranke <jranke@uni-bremen.de> | 2020-12-09 09:44:14 +0100 | 
|---|---|---|
| committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-12-09 09:44:14 +0100 | 
| commit | f33ce936323d9afc884f9254fb57d19744cadf75 (patch) | |
| tree | d19d0d3ac4bbbacea712550a82d9764fadd89477 | |
| parent | c51fe964d66303f531d6b593b6fe46bdfacb13b4 (diff) | |
Fix tests and rerun
| -rw-r--r-- | test.log | 38 | ||||
| -rw-r--r-- | tests/testthat/print_saem_biphasic_s.txt | 40 | ||||
| -rw-r--r-- | tests/testthat/summary_DFOP_FOCUS_C.txt | 125 | ||||
| -rw-r--r-- | tests/testthat/test_plot.R | 4 | ||||
| -rw-r--r-- | tests/testthat/test_saem.R | 2 | 
5 files changed, 98 insertions, 111 deletions
| @@ -3,14 +3,15 @@ Loading required package: parallel  Testing mkin  ✔ |  OK F W S | Context  ✔ |   5       | AIC calculation -✔ |   2       | Export dataset for reading into CAKE +✔ |   2       | Export dataset for reading into CAKE [0.2 s]  ✔ |  14       | Results for FOCUS D established in expertise for UBA (Ranke 2014) [1.0 s]  ✔ |   4       | Calculation of FOCUS chi2 error levels [0.5 s]  ✔ |   7       | Fitting the SFORB model [3.5 s]  ✔ |   5       | Analytical solutions for coupled models [3.2 s]  ✔ |   5       | Calculation of Akaike weights  ✔ |  14       | Confidence intervals and p-values [1.2 s] -✔ |  14       | Error model fitting [4.5 s] +✔ |  14       | Error model fitting [4.6 s] +✔ |   1       | Time step normalisation  ✔ |   4       | Test fitting the decline of metabolites from their maximum [0.3 s]  ✔ |   1       | Fitting the logistic model [0.2 s]  ✔ |   1       | Test dataset class mkinds used in gmkin @@ -18,38 +19,19 @@ Testing mkin  ✔ |  12       | Special cases of mkinfit calls [0.7 s]  ✔ |   8       | mkinmod model generation and printing [0.2 s]  ✔ |   3       | Model predictions with mkinpredict [0.4 s] -✔ |  14     2 | Evaluations according to 2015 NAFTA guidance [1.3 s] -──────────────────────────────────────────────────────────────────────────────── -Skip (test_nafta.R:25:5): Test data from Appendix B are correctly evaluated -Reason: getRversion() < "4.1.0"  is TRUE - -Skip (test_nafta.R:53:5): Test data from Appendix D are correctly evaluated -Reason: getRversion() < "4.1.0"  is TRUE -──────────────────────────────────────────────────────────────────────────────── -✔ |   9       | Nonlinear mixed-effects models [7.9 s] -✔ |   0     1 | Plotting [0.7 s] -──────────────────────────────────────────────────────────────────────────────── -Skip (test_plot.R:28:3): Plotting mkinfit and mmkin objects is reproducible -Reason: getRversion() < "4.1.0"  is TRUE -──────────────────────────────────────────────────────────────────────────────── +✔ |  16       | Evaluations according to 2015 NAFTA guidance [1.6 s] +✔ |   9       | Nonlinear mixed-effects models [7.7 s] +✔ |  18       | Plotting [2.1 s]  ✔ |   4       | Residuals extracted from mkinfit models -✔ |  13     1 | Nonlinear mixed effects models fitted with SAEM from saemix [19.0 s] -──────────────────────────────────────────────────────────────────────────────── -Skip (test_saem.R:103:1): Simple models with metabolite can be fitted with saemix -Reason: empty test -──────────────────────────────────────────────────────────────────────────────── +✔ |  17       | Nonlinear mixed effects models fitted with SAEM from saemix [19.1 s]  ✔ |   2       | Complex test case from Schaefer et al. (2007) Piacenza paper [1.5 s]  ✔ |   4       | Summary [0.1 s]  ✔ |   1       | Summaries of old mkinfit objects  ✔ |   4       | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.3 s] -✔ |   9       | Hypothesis tests [7.3 s] +✔ |   9       | Hypothesis tests [7.4 s]  ✔ |   4       | Calculation of maximum time weighted average concentrations (TWAs) [2.4 s]  ══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 59.7 s - -── Skipped tests  ────────────────────────────────────────────────────────────── -● empty test (1) -● getRversion() < "4.1.0"  is TRUE (3) +Duration: 62.0 s -[ FAIL 0 | WARN 0 | SKIP 4 | PASS 164 ] +[ FAIL 0 | WARN 0 | SKIP 0 | PASS 189 ] diff --git a/tests/testthat/print_saem_biphasic_s.txt b/tests/testthat/print_saem_biphasic_s.txt index 4d20117e..3c07b715 100644 --- a/tests/testthat/print_saem_biphasic_s.txt +++ b/tests/testthat/print_saem_biphasic_s.txt @@ -15,23 +15,23 @@ Likelihood computed by importance sampling    2692 2702  -1333  Fitted parameters: -                    estimate     lower     upper -parent_0           1.002e+02 99.302986 1.011e+02 -k_m1               2.182e-03  0.001576 2.788e-03 -f_parent_to_m1     4.883e-01  0.447687 5.289e-01 -k1                 4.014e-02  0.023941 5.634e-02 -k2                 1.517e-02  0.008507 2.184e-02 -g                  5.007e-01  0.380534 6.208e-01 -Var.parent_0       1.511e+00 -0.551247 3.574e+00 -Var.k_m1           1.912e-02 -0.151313 1.896e-01 -Var.f_parent_to_m1 8.082e-02  0.018430 1.432e-01 -Var.k1             5.037e-01  0.095343 9.121e-01 -Var.k2             6.129e-01  0.124868 1.101e+00 -Var.g              7.107e-02 -0.244901 3.870e-01 -a.1                2.749e+00  2.568674 2.929e+00 -SD.parent_0        1.229e+00  0.390443 2.068e+00 -SD.k_m1            1.383e-01 -0.477984 7.545e-01 -SD.f_parent_to_m1  2.843e-01  0.174562 3.940e-01 -SD.k1              7.097e-01  0.422037 9.974e-01 -SD.k2              7.829e-01  0.471184 1.095e+00 -SD.g               2.666e-01 -0.326044 8.592e-01 +                   estimate  lower upper +parent_0              1e+02 99.303 1e+02 +k_m1                  2e-03  0.002 3e-03 +f_parent_to_m1        5e-01  0.448 5e-01 +k1                    4e-02  0.024 6e-02 +k2                    2e-02  0.009 2e-02 +g                     5e-01  0.381 6e-01 +Var.parent_0          2e+00 -0.551 4e+00 +Var.k_m1              2e-02 -0.151 2e-01 +Var.f_parent_to_m1    8e-02  0.018 1e-01 +Var.k1                5e-01  0.095 9e-01 +Var.k2                6e-01  0.125 1e+00 +Var.g                 7e-02 -0.245 4e-01 +a.1                   3e+00  2.569 3e+00 +SD.parent_0           1e+00  0.390 2e+00 +SD.k_m1               1e-01 -0.478 8e-01 +SD.f_parent_to_m1     3e-01  0.175 4e-01 +SD.k1                 7e-01  0.422 1e+00 +SD.k2                 8e-01  0.471 1e+00 +SD.g                  3e-01 -0.326 9e-01 diff --git a/tests/testthat/summary_DFOP_FOCUS_C.txt b/tests/testthat/summary_DFOP_FOCUS_C.txt index da3276e1..2b0210c0 100644 --- a/tests/testthat/summary_DFOP_FOCUS_C.txt +++ b/tests/testthat/summary_DFOP_FOCUS_C.txt @@ -1,77 +1,82 @@ -saemix version used for fitting:      3.1.9000  -mkin version used for pre-fitting:  0.9.50.4  -R version used for fitting:         4.0.3  -Date of fit:     Wed Dec  9 08:16:28 2020  -Date of summary: Wed Dec  9 08:23:19 2020  +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 = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *             time)) / (g * exp(-k1 * time) + (1 - g) * exp(-k2 * time)))             * parent -d_m1/dt = + f_parent_to_m1 * ((k1 * g * exp(-k1 * time) + k2 * (1 - g) -           * exp(-k2 * time)) / (g * exp(-k1 * time) + (1 - g) * -           exp(-k2 * time))) * parent - k_m1 * m1 - -Data: -509 observations of 2 variable(s) grouped in 15 datasets  Model predictions using solution type analytical  -Fitted in 10.222 s using 300, 100 iterations +Fitted using test 0 model solutions performed in test time 0 s + +Error model: Constant variance  -Variance model: Constant variance  +Error model algorithm: OLS  -Mean of starting values for individual parameters: -      parent_0           k_m1 f_parent_to_m1             k1             k2  -  1.007005e+02   1.837381e-03   4.803953e-01   4.534096e-02   1.918378e-02  -             g  -  5.068235e-01  +Starting values for parameters to be optimised: +         value   type +parent_0 85.10  state +k1        0.10 deparm +k2        0.01 deparm +g         0.50 deparm -Fixed degradation parameter values: +Starting values for the transformed parameters actually optimised: +             value lower upper +parent_0 85.100000  -Inf   Inf +log_k1   -2.302585  -Inf   Inf +log_k2   -4.605170  -Inf   Inf +g_qlogis  0.000000  -Inf   Inf + +Fixed parameter values:  None  Results: -Likelihood computed by importance sampling -   AIC  BIC logLik -  2692 2702  -1333 - -Optimised parameters: -                    est.     lower     upper -parent_0       1.002e+02 99.302986 1.011e+02 -k_m1           2.182e-03  0.001576 2.788e-03 -f_parent_to_m1 4.883e-01  0.447687 5.289e-01 -k1             4.014e-02  0.023941 5.634e-02 -k2             1.517e-02  0.008507 2.184e-02 -g              5.007e-01  0.380534 6.208e-01 - -Correlation:  -               prnt_0 k_m1   f_p__1 k1     k2     -k_m1           -0.152                             -f_parent_to_m1 -0.138  0.396                      -k1              0.085 -0.036 -0.026               -k2              0.005  0.067  0.018 -0.043        -g              -0.075 -0.113 -0.029 -0.248 -0.263 - -Random effects: -                    est.   lower  upper -SD.parent_0       1.2293  0.3904 2.0682 -SD.k_m1           0.1383 -0.4780 0.7545 -SD.f_parent_to_m1 0.2843  0.1746 0.3940 -SD.k1             0.7097  0.4220 0.9974 -SD.k2             0.7829  0.4712 1.0946 -SD.g              0.2666 -0.3260 0.8592 - -Variance model: -     est. lower upper -a.1 2.749 2.569 2.929 - -Resulting formation fractions: -                ff -parent_m1   0.4883 -parent_sink 0.5117 +       AIC      BIC    logLik +  29.02372 30.00984 -9.511861 + +Optimised, transformed parameters with symmetric confidence intervals: +         Estimate Std. Error   Lower   Upper +parent_0  85.0000    0.66620 83.1500 86.8500 +log_k1    -0.7775    0.03380 -0.8713 -0.6836 +log_k2    -4.0260    0.13100 -4.3890 -3.6620 +g_qlogis   1.7660    0.08218  1.5380  1.9940 +sigma      0.6962    0.16410  0.2406  1.1520 + +Parameter correlation: +[1] "Correlation matrix is platform dependent, not tested" + +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 85.00000 127.600 1.131e-08 83.15000 86.85000 +k1        0.45960  29.580 3.887e-06  0.41840  0.50480 +k2        0.01785   7.636 7.901e-04  0.01241  0.02568 +g         0.85390  83.310 6.221e-08  0.82310  0.88020 +sigma     0.69620   4.243 6.618e-03  0.24060  1.15200 + +FOCUS Chi2 error levels in percent: +         err.min n.optim df +All data   2.661       4  5 +parent     2.661       4  5  Estimated disappearance times: -         DT50   DT90 DT50back DT50_k1 DT50_k2 -parent  27.07  110.1    33.14   17.27   45.68 -m1     317.69 1055.4       NA      NA      NA +        DT50  DT90 DT50back DT50_k1 DT50_k2 +parent 1.887 21.25    6.397   1.508   38.83 + +Data: + time variable observed predicted residual +    0   parent     85.1    85.003  0.09726 +    1   parent     57.9    58.039 -0.13912 +    3   parent     29.9    30.054 -0.15351 +    7   parent     14.6    13.866  0.73388 +   14   parent      9.7     9.787 -0.08657 +   28   parent      6.6     7.532 -0.93205 +   63   parent      4.0     4.033 -0.03269 +   91   parent      3.9     2.447  1.45348 +  119   parent      0.6     1.484 -0.88424 diff --git a/tests/testthat/test_plot.R b/tests/testthat/test_plot.R index bafcd561..4d815d33 100644 --- a/tests/testthat/test_plot.R +++ b/tests/testthat/test_plot.R @@ -32,10 +32,10 @@ test_that("Plotting mkinfit and mmkin objects is reproducible", {    plot_err_sfo_sfo <- function() plot_err(f_sfo_sfo_desolve)    vdiffr::expect_doppelganger("plot_err for FOCUS D", plot_err_sfo_sfo) -  plot_errmod_fit_obs_1 <- function() plot_err(fit_obs_1, sep_obs = FALSE) +  plot_errmod_fit_tc_1 <- function() plot_err(fit_tc_1, sep_obs = FALSE)    vdiffr::expect_doppelganger("plot_errmod with SFO_lin_a_tc", plot_errmod_fit_tc_1) -  plot_errmod_fit_tc_1 <- function() plot_err(fit_tc_1, sep_obs = FALSE) +  plot_errmod_fit_obs_1 <- function() plot_err(fit_obs_1, sep_obs = FALSE)    vdiffr::expect_doppelganger("plot_errmod with SFO_lin_a_obs", plot_errmod_fit_obs_1)    skip_on_travis() diff --git a/tests/testthat/test_saem.R b/tests/testthat/test_saem.R index d41efbfa..37456ed4 100644 --- a/tests/testthat/test_saem.R +++ b/tests/testthat/test_saem.R @@ -102,7 +102,7 @@ test_that("Parent only models can be fitted with saemix", {  test_that("Simple models with metabolite can be fitted with saemix", { -  expect_known_output(print(saem_biphasic_s), "print_saem_biphasic_s.txt") +  expect_known_output(print(saem_biphasic_s, digits = 1), "print_saem_biphasic_s.txt")    test_summary <- summary(saem_biphasic_s)    test_summary$saemixversion <- "Dummy 0.0 for testing" | 
