aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NAMESPACE1
-rw-r--r--R/mhmkin.R39
-rw-r--r--R/status.R43
-rw-r--r--log/test.log40
-rw-r--r--man/status.Rd6
5 files changed, 70 insertions, 59 deletions
diff --git a/NAMESPACE b/NAMESPACE
index 37b6c74d..a5691eee 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -61,6 +61,7 @@ S3method(print,summary.nlme.mmkin)
S3method(print,summary.saem.mmkin)
S3method(residuals,mkinfit)
S3method(saem,mmkin)
+S3method(status,mhmkin)
S3method(status,mmkin)
S3method(status,multistart)
S3method(status,multistart.saem.mmkin)
diff --git a/R/mhmkin.R b/R/mhmkin.R
index 47b84b9d..7f3ff9fa 100644
--- a/R/mhmkin.R
+++ b/R/mhmkin.R
@@ -136,45 +136,6 @@ print.mhmkin <- function(x, ...) {
print(status(x))
}
-status.mhmkin <- function(object, ...) {
- if (inherits(object[[1]], "saem.mmkin")) {
- test_func <- function(fit) {
- if (inherits(fit$so, "try-error")) {
- return("E")
- } else {
- if (!is.null(fit$FIM_failed)) {
- return_values <- c("fixed effects" = "Fth",
- "random effects and error model parameters" = "FO")
- return(paste(return_values[fit$FIM_failed], collapse = ", "))
- } else {
- return("OK")
- }
- }
- }
- } else {
- stop("Only mhmkin objects containing saem.mmkin objects currently supported")
- }
- result <- lapply(object, test_func)
- result <- unlist(result)
- dim(result) <- dim(object)
- dimnames(result) <- dimnames(object)
-
- class(result) <- "status.mhmkin"
- return(result)
-}
-
-#' @export
-print.status.mhmkin <- function(x, ...) {
- class(x) <- NULL
- print(x, quote = FALSE)
- cat("\n")
- if (any(x == "OK")) cat("OK: Fit terminated successfully\n")
- if (any(x == "Fth")) cat("Fth: Could not invert FIM for fixed effects\n")
- if (any(x == "FO")) cat("FO: Could not invert FIM for random effects and error model parameters\n")
- if (any(x == "Fth, FO")) cat("Fth, FO: Could not invert FIM for fixed effects, nor for random effects and error model parameters\n")
- if (any(x == "E")) cat("E: Error\n")
-}
-
#' @export
AIC.mhmkin <- function(object, ..., k = 2) {
if (inherits(object[[1]], "saem.mmkin")) {
diff --git a/R/status.R b/R/status.R
index 44d2a9bc..8bcd3a16 100644
--- a/R/status.R
+++ b/R/status.R
@@ -68,3 +68,46 @@ print.status.mmkin <- function(x, ...) {
if (any(x == "OK")) cat("OK: No warnings\n")
if (any(x == "E")) cat("E: Error\n")
}
+
+#' @rdname status
+#' @export
+status.mhmkin <- function(object, ...) {
+ if (inherits(object[[1]], "saem.mmkin")) {
+ test_func <- function(fit) {
+ if (inherits(fit$so, "try-error")) {
+ return("E")
+ } else {
+ if (!is.null(fit$FIM_failed)) {
+ return_values <- c("fixed effects" = "Fth",
+ "random effects and error model parameters" = "FO")
+ return(paste(return_values[fit$FIM_failed], collapse = ", "))
+ } else {
+ return("OK")
+ }
+ }
+ }
+ } else {
+ stop("Only mhmkin objects containing saem.mmkin objects currently supported")
+ }
+ result <- lapply(object, test_func)
+ result <- unlist(result)
+ dim(result) <- dim(object)
+ dimnames(result) <- dimnames(object)
+
+ class(result) <- "status.mhmkin"
+ return(result)
+}
+
+#' @rdname status
+#' @export
+print.status.mhmkin <- function(x, ...) {
+ class(x) <- NULL
+ print(x, quote = FALSE)
+ cat("\n")
+ if (any(x == "OK")) cat("OK: Fit terminated successfully\n")
+ if (any(x == "Fth")) cat("Fth: Could not invert FIM for fixed effects\n")
+ if (any(x == "FO")) cat("FO: Could not invert FIM for random effects and error model parameters\n")
+ if (any(x == "Fth, FO")) cat("Fth, FO: Could not invert FIM for fixed effects, nor for random effects and error model parameters\n")
+ if (any(x == "E")) cat("E: Error\n")
+}
+
diff --git a/log/test.log b/log/test.log
index dee62073..429a2e02 100644
--- a/log/test.log
+++ b/log/test.log
@@ -1,53 +1,53 @@
ℹ Testing mkin
✔ | F W S OK | Context
✔ | 5 | AIC calculation
-✔ | 5 | Analytical solutions for coupled models [3.4s]
+✔ | 5 | Analytical solutions for coupled models [3.3s]
✔ | 5 | Calculation of Akaike weights
✔ | 3 | Export dataset for reading into CAKE
✔ | 12 | Confidence intervals and p-values [1.0s]
-✔ | 1 12 | Dimethenamid data from 2018 [32.5s]
+✔ | 1 12 | Dimethenamid data from 2018 [43.2s]
────────────────────────────────────────────────────────────────────────────────
Skip (test_dmta.R:98:3): Different backends get consistent results for SFO-SFO3+, dimethenamid data
Reason: Fitting this ODE model with saemix takes about 15 minutes on my system
────────────────────────────────────────────────────────────────────────────────
-✔ | 14 | Error model fitting [5.0s]
+✔ | 14 | Error model fitting [11.5s]
✔ | 5 | Time step normalisation
-✔ | 4 | Calculation of FOCUS chi2 error levels [0.6s]
-✔ | 14 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [0.8s]
-✔ | 4 | Test fitting the decline of metabolites from their maximum [0.4s]
-✔ | 1 | Fitting the logistic model [0.2s]
-✔ | 7 | Batch fitting and diagnosing hierarchical kinetic models [14.5s]
-✔ | 1 12 | Nonlinear mixed-effects models [0.3s]
+✔ | 4 | Calculation of FOCUS chi2 error levels [1.3s]
+✔ | 14 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [1.9s]
+✔ | 4 | Test fitting the decline of metabolites from their maximum [0.9s]
+✔ | 1 | Fitting the logistic model [0.6s]
+✔ | 7 | Batch fitting and diagnosing hierarchical kinetic models [30.9s]
+✔ | 1 12 | Nonlinear mixed-effects models [0.4s]
────────────────────────────────────────────────────────────────────────────────
Skip (test_mixed.R:74:3): saemix results are reproducible for biphasic fits
Reason: Fitting with saemix takes around 10 minutes when using deSolve
────────────────────────────────────────────────────────────────────────────────
✔ | 3 | Test dataset classes mkinds and mkindsg
-✔ | 10 | Special cases of mkinfit calls [0.4s]
-✔ | 3 | mkinfit features [0.7s]
-✔ | 8 | mkinmod model generation and printing [0.2s]
+✔ | 10 | Special cases of mkinfit calls [0.7s]
+✔ | 3 | mkinfit features [1.0s]
+✔ | 8 | mkinmod model generation and printing [0.3s]
✔ | 3 | Model predictions with mkinpredict [0.3s]
-✔ | 7 | Multistart method for saem.mmkin models [37.6s]
-✔ | 16 | Evaluations according to 2015 NAFTA guidance [2.3s]
-✔ | 9 | Nonlinear mixed-effects models with nlme [8.7s]
+✔ | 7 | Multistart method for saem.mmkin models [39.8s]
+✔ | 16 | Evaluations according to 2015 NAFTA guidance [2.6s]
+✔ | 9 | Nonlinear mixed-effects models with nlme [8.8s]
✔ | 16 | Plotting [10.1s]
✔ | 4 | Residuals extracted from mkinfit models
-✔ | 1 36 | saemix parent models [72.8s]
+✔ | 1 36 | saemix parent models [72.3s]
────────────────────────────────────────────────────────────────────────────────
Skip (test_saemix_parent.R:152:3): We can also use mkin solution methods for saem
Reason: This still takes almost 2.5 minutes although we do not solve ODEs
────────────────────────────────────────────────────────────────────────────────
✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [1.4s]
✔ | 11 | Processing of residue series
-✔ | 7 | Fitting the SFORB model [3.7s]
+✔ | 7 | Fitting the SFORB model [3.8s]
✔ | 1 | Summaries of old mkinfit objects
✔ | 5 | Summary [0.2s]
✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [2.2s]
-✔ | 9 | Hypothesis tests [8.3s]
-✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.1s]
+✔ | 9 | Hypothesis tests [8.0s]
+✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.2s]
══ Results ═════════════════════════════════════════════════════════════════════
-Duration: 210.4 s
+Duration: 249.3 s
── Skipped tests ──────────────────────────────────────────────────────────────
• Fitting this ODE model with saemix takes about 15 minutes on my system (1)
diff --git a/man/status.Rd b/man/status.Rd
index 8ff3531b..1cadbfcc 100644
--- a/man/status.Rd
+++ b/man/status.Rd
@@ -4,6 +4,8 @@
\alias{status}
\alias{status.mmkin}
\alias{print.status.mmkin}
+\alias{status.mhmkin}
+\alias{print.status.mhmkin}
\title{Method to get status information for fit array objects}
\usage{
status(object, ...)
@@ -11,6 +13,10 @@ status(object, ...)
\method{status}{mmkin}(object, ...)
\method{print}{status.mmkin}(x, ...)
+
+\method{status}{mhmkin}(object, ...)
+
+\method{print}{status.mhmkin}(x, ...)
}
\arguments{
\item{object}{The object to investigate}

Contact - Imprint