diff options
| -rw-r--r-- | NEWS.md | 4 | ||||
| -rw-r--r-- | R/mkinfit.R | 18 | ||||
| -rw-r--r-- | inst/testdata/fit_old_FOCUS_D.rda | bin | 0 -> 21174 bytes | |||
| -rw-r--r-- | test.log | 15 | ||||
| -rw-r--r-- | tests/testthat/FOCUS_2006_D.csf | 2 | ||||
| -rw-r--r-- | tests/testthat/test_summary_old_objects.R | 29 | 
6 files changed, 51 insertions, 17 deletions
| @@ -1,9 +1,11 @@ -# mkin 0.9.49.6 (2019-07-05) +# mkin 0.9.49.6 (2019-07-08)  - Update README and the introductory vignette  - Report 'OLS' as error_model_algorithm in the summary in the case that the default error_model ('const') is used +- Support summarizing 'mkinfit' objects generated with versions < 0.9.49.5 +  # mkin 0.9.49.5 (2019-07-04)  - Several algorithms for minimization of the negative log-likelihood for non-constant error models (two-component and variance by variable). In the case the error model is constant variance, least squares is used as this is more stable. The default algorithm 'd_3' tries direct minimization and a three-step procedure, and returns the model with the highest likelihood. diff --git a/R/mkinfit.R b/R/mkinfit.R index 6606ec7a..c14c1cea 100644 --- a/R/mkinfit.R +++ b/R/mkinfit.R @@ -803,14 +803,16 @@ print.summary.mkinfit <- function(x, digits = max(3, getOption("digits") - 3), .    cat("\nFitted using", x$calls, "model solutions performed in", x$time[["elapsed"]],  "s\n")
 -  cat("\nError model: ")
 -  cat(switch(x$err_mod,
 -             const = "Constant variance",
 -             obs = "Variance unique to each observed variable",
 -             tc = "Two-component variance function"), "\n")
 -
 -  cat("\nError model algorithm:", x$error_model_algorithm, "\n")
 -  if (!is.null(x$d_3_message)) cat(x$d_3_message, "\n")
 +  if (!is.null(x$err_mod)) {
 +    cat("\nError model: ")
 +    cat(switch(x$err_mod,
 +               const = "Constant variance",
 +               obs = "Variance unique to each observed variable",
 +               tc = "Two-component variance function"), "\n")
 +
 +    cat("\nError model algorithm:", x$error_model_algorithm, "\n")
 +    if (!is.null(x$d_3_message)) cat(x$d_3_message, "\n")
 +  }
    cat("\nStarting values for parameters to be optimised:\n")
    print(x$start)
 diff --git a/inst/testdata/fit_old_FOCUS_D.rda b/inst/testdata/fit_old_FOCUS_D.rdaBinary files differ new file mode 100644 index 00000000..b60faa96 --- /dev/null +++ b/inst/testdata/fit_old_FOCUS_D.rda @@ -2,7 +2,7 @@ Loading mkin  Testing mkin  ✔ |  OK F W S | Context  
⠏ |   0       | Export dataset for reading into CAKE
✔ |   1       | Export dataset for reading into CAKE -
⠏ |   0       | Error model fitting
⠋ |   1       | Error model fitting
⠹ |   3       | Error model fitting
⠸ |   4       | Error model fitting
⠼ |   5       | Error model fitting
⠴ |   6       | Error model fitting
⠧ |   8       | Error model fitting
⠏ |  10       | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  11       | Error model fitting
⠹ |  13       | Error model fitting
⠸ |  14       | Error model fitting
⠼ |  15       | Error model fitting
⠴ |  16       | Error model fitting
⠦ |  17       | Error model fitting
⠧ |  18       | Error model fitting
⠇ |  19       | Error model fitting
⠏ |  20       | Error model fitting
✔ |  20       | Error model fitting [415.0 s] +
⠏ |   0       | Error model fitting
⠋ |   1       | Error model fitting
⠹ |   3       | Error model fitting
⠸ |   4       | Error model fitting
⠼ |   5       | Error model fitting
⠴ |   6       | Error model fitting
⠧ |   8       | Error model fitting
⠏ |  10       | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  10   1   | Error model fitting
⠋ |  11       | Error model fitting
⠹ |  13       | Error model fitting
⠸ |  14       | Error model fitting
⠼ |  15       | Error model fitting
⠴ |  16       | Error model fitting
⠦ |  17       | Error model fitting
⠧ |  18       | Error model fitting
⠇ |  19       | Error model fitting
⠏ |  20       | Error model fitting
✔ |  20       | Error model fitting [413.8 s]  
⠏ |   0       | Calculation of FOCUS chi2 error levels
⠋ |   1       | Calculation of FOCUS chi2 error levels
⠹ |   3       | Calculation of FOCUS chi2 error levels
⠼ |   5       | Calculation of FOCUS chi2 error levels
✔ |   5       | Calculation of FOCUS chi2 error levels [3.5 s]  
⠏ |   0       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠋ |   1       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠙ |   2       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠸ |   4       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
⠇ |   9       | Results for FOCUS D established in expertise for UBA (Ranke 2014)
✔ |  13       | Results for FOCUS D established in expertise for UBA (Ranke 2014) [3.7 s]  
⠏ |   0       | Test fitting the decline of metabolites from their maximum
⠋ |   1       | Test fitting the decline of metabolites from their maximum
⠹ |   3       | Test fitting the decline of metabolites from their maximum
⠼ |   5       | Test fitting the decline of metabolites from their maximum
✔ |   6       | Test fitting the decline of metabolites from their maximum [0.9 s] @@ -11,19 +11,20 @@ Testing mkin  
⠏ |   0       | Special cases of mkinfit calls
⠋ |   1       | Special cases of mkinfit calls
⠇ |   9       | Special cases of mkinfit calls
⠏ |  10       | Special cases of mkinfit calls
⠋ |  11       | Special cases of mkinfit calls
⠙ |  12       | Special cases of mkinfit calls
✔ |  12       | Special cases of mkinfit calls [2.7 s]  
⠏ |   0       | mkinmod model generation and printing
⠇ |   9       | mkinmod model generation and printing
✔ |   9       | mkinmod model generation and printing [0.2 s]  
⠏ |   0       | Model predictions with mkinpredict
⠋ |   1       | Model predictions with mkinpredict
✔ |   3       | Model predictions with mkinpredict [0.3 s] -
⠏ |   0       | Evaluations according to 2015 NAFTA guidance
⠙ |   2       | Evaluations according to 2015 NAFTA guidance
⠇ |   9       | Evaluations according to 2015 NAFTA guidance
⠏ |  10       | Evaluations according to 2015 NAFTA guidance
⠴ |  16       | Evaluations according to 2015 NAFTA guidance
✔ |  16       | Evaluations according to 2015 NAFTA guidance [4.1 s] -
⠏ |   0       | Fitting of parent only models
⠋ |   1       | Fitting of parent only models
⠙ |   2       | Fitting of parent only models
⠹ |   3       | Fitting of parent only models
⠸ |   4       | Fitting of parent only models
⠼ |   5       | Fitting of parent only models
⠴ |   6       | Fitting of parent only models
⠦ |   7       | Fitting of parent only models
⠧ |   8       | Fitting of parent only models
⠇ |   9       | Fitting of parent only models
⠏ |  10       | Fitting of parent only models
⠋ |  11       | Fitting of parent only models
⠙ |  12       | Fitting of parent only models
⠹ |  13       | Fitting of parent only models
⠴ |  16       | Fitting of parent only models
⠧ |  18       | Fitting of parent only models
⠏ |  20       | Fitting of parent only models
✔ |  21       | Fitting of parent only models [40.7 s] +
⠏ |   0       | Evaluations according to 2015 NAFTA guidance
⠙ |   2       | Evaluations according to 2015 NAFTA guidance
⠇ |   9       | Evaluations according to 2015 NAFTA guidance
⠏ |  10       | Evaluations according to 2015 NAFTA guidance
⠴ |  16       | Evaluations according to 2015 NAFTA guidance
✔ |  16       | Evaluations according to 2015 NAFTA guidance [4.0 s] +
⠏ |   0       | Fitting of parent only models
⠋ |   1       | Fitting of parent only models
⠙ |   2       | Fitting of parent only models
⠹ |   3       | Fitting of parent only models
⠸ |   4       | Fitting of parent only models
⠼ |   5       | Fitting of parent only models
⠴ |   6       | Fitting of parent only models
⠦ |   7       | Fitting of parent only models
⠧ |   8       | Fitting of parent only models
⠇ |   9       | Fitting of parent only models
⠏ |  10       | Fitting of parent only models
⠋ |  11       | Fitting of parent only models
⠙ |  12       | Fitting of parent only models
⠹ |  13       | Fitting of parent only models
⠴ |  16       | Fitting of parent only models
⠧ |  18       | Fitting of parent only models
⠏ |  20       | Fitting of parent only models
✔ |  21       | Fitting of parent only models [40.6 s]  
⠏ |   0       | Calculation of maximum time weighted average concentrations (TWAs)
⠋ |   1       | Calculation of maximum time weighted average concentrations (TWAs)
⠙ |   2       | Calculation of maximum time weighted average concentrations (TWAs)
⠹ |   3       | Calculation of maximum time weighted average concentrations (TWAs)
⠸ |   4       | Calculation of maximum time weighted average concentrations (TWAs)
✔ |   4       | Calculation of maximum time weighted average concentrations (TWAs) [2.2 s]  
⠏ |   0       | Summary
✔ |   1       | Summary  
⠏ |   0       | Plotting
⠹ |   3       | Plotting
✔ |   4       | Plotting [0.3 s]  
⠏ |   0       | AIC calculation
✔ |   2       | AIC calculation -
⠏ |   0       | Complex test case from Schaefer et al. (2007) Piacenza paper
⠋ |   1       | Complex test case from Schaefer et al. (2007) Piacenza paper
✔ |   2       | Complex test case from Schaefer et al. (2007) Piacenza paper [5.4 s] -
⠏ |   0       | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠋ |   1       | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠹ |   3       | Results for synthetic data established in expertise for UBA (Ranke 2014)
✔ |   4       | Results for synthetic data established in expertise for UBA (Ranke 2014) [7.0 s] +
⠏ |   0       | Complex test case from Schaefer et al. (2007) Piacenza paper
⠋ |   1       | Complex test case from Schaefer et al. (2007) Piacenza paper
✔ |   2       | Complex test case from Schaefer et al. (2007) Piacenza paper [5.2 s] +
⠏ |   0       | Summaries of old mkinfit objects
✔ |   1       | Summaries of old mkinfit objects +
⠏ |   0       | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠋ |   1       | Results for synthetic data established in expertise for UBA (Ranke 2014)
⠹ |   3       | Results for synthetic data established in expertise for UBA (Ranke 2014)
✔ |   4       | Results for synthetic data established in expertise for UBA (Ranke 2014) [7.2 s]  ══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 492.4 s +Duration: 491.0 s -OK:       125 +OK:       126  Failed:   0  Warnings: 0  Skipped:  0 diff --git a/tests/testthat/FOCUS_2006_D.csf b/tests/testthat/FOCUS_2006_D.csf index 0869672b..f9233770 100644 --- a/tests/testthat/FOCUS_2006_D.csf +++ b/tests/testthat/FOCUS_2006_D.csf @@ -5,7 +5,7 @@ Description:  MeasurementUnits: % AR  TimeUnits: days  Comments: Created using mkin::CAKE_export -Date: 2019-07-05 +Date: 2019-07-08  Optimiser: IRLS  [Data] diff --git a/tests/testthat/test_summary_old_objects.R b/tests/testthat/test_summary_old_objects.R new file mode 100644 index 00000000..11e63553 --- /dev/null +++ b/tests/testthat/test_summary_old_objects.R @@ -0,0 +1,29 @@ +# Copyright (C) 2019 Johannes Ranke +# Contact: jranke@uni-bremen.de + +# This file is part of the R package mkin + +# mkin is free software: you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more +# details. + +# You should have received a copy of the GNU General Public License along with +# this program. If not, see <http://www.gnu.org/licenses/> + +context("Summaries of old mkinfit objects") + +test_that("A fit generated with mkin 0.9.48.1 can be summarised", { +  # Generated with mkin 0.9.48.1 +  # SFO_SFO <- mkinmod(parent = list(type = "SFO", to = "m1"), +  #                    m1 = list(type = "SFO"), quiet = TRUE) +  # fit_old <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE) +  # save(fit_old, file = "~/git/mkin/inst/testdata/fit_old_FOCUS_D.rda", version = 2 ) +  load(system.file("testdata/fit_old_FOCUS_D.rda", package = "mkin")) +  expect_true(length(summary(fit_old)) > 0) +}) | 
