aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2023-04-02 16:58:56 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2023-04-02 16:58:56 +0200
commit0311f0658a276fab84e78c060b73c0b46c33b100 (patch)
treecbf4ba9576869008978848a403833679638e5cbb
parent7d5f4cd06b5a3a95a98b345f6b5e1e4ab3526e0a (diff)
Deal with covariates in summary for saem.mmkin objects
-rw-r--r--NEWS.md4
-rw-r--r--R/summary.saem.mmkin.R11
-rw-r--r--log/check.log11
-rw-r--r--log/test.log26
-rw-r--r--man/summary.saem.mmkin.Rd17
5 files changed, 49 insertions, 20 deletions
diff --git a/NEWS.md b/NEWS.md
index ff6541da..ea69db02 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,10 +1,10 @@
# mkin 1.2.3
-- Depend on upcoming deSolve version with the possibility to avoid resolving symbols in a shared library (compiled models) over and over.
+- Depend on current deSolve version with the possibility to avoid resolving symbols in a shared library (compiled models) over and over, thanks to Thomas Petzoldt.
- 'R/mkinerrmin.R': Fix typo in subset (use of = instead of ==), thanks to Sebastian Meyer for spotting this during his work on R 4.3.0.
-- 'R/{endpoints,parms,plot.mixed.mmkin}.R': Calculate parameters and endpoints and plot population curves for specific covariate values, or specific percentiles of covariate values used in saem fits.
+- 'R/{endpoints,parms,plot.mixed.mmkin,summary.saem.mmkin}.R': Calculate parameters and endpoints and plot population curves for specific covariate values, or specific percentiles of covariate values used in saem fits.
# mkin 1.2.2 (unreleased)
diff --git a/R/summary.saem.mmkin.R b/R/summary.saem.mmkin.R
index 49b02a50..c470ccf0 100644
--- a/R/summary.saem.mmkin.R
+++ b/R/summary.saem.mmkin.R
@@ -15,6 +15,7 @@
#' included.
#' @param digits Number of digits to use for printing
#' @param \dots optional arguments passed to methods like \code{print}.
+#' @inheritParams endpoints
#' @return The summary function returns a list based on the [saemix::SaemixObject]
#' obtained in the fit, with at least the following additional components
#' \item{saemixversion, mkinversion, Rversion}{The saemix, mkin and R versions used}
@@ -93,7 +94,9 @@
#' }
#'
#' @export
-summary.saem.mmkin <- function(object, data = FALSE, verbose = FALSE, distimes = TRUE, ...) {
+summary.saem.mmkin <- function(object, data = FALSE, verbose = FALSE,
+ covariates = NULL, covariate_quantile = 0.5,
+ distimes = TRUE, ...) {
mod_vars <- names(object$mkinmod$diffs)
@@ -199,6 +202,7 @@ summary.saem.mmkin <- function(object, data = FALSE, verbose = FALSE, distimes =
}
ep <- endpoints(object)
+ object$covariates <- ep$covariates
if (length(ep$ff) != 0)
object$ff <- ep$ff
if (distimes) object$distimes <- ep$distimes
@@ -281,6 +285,11 @@ print.summary.saem.mmkin <- function(x, digits = max(3, getOption("digits") - 3)
print(x$confint_back, digits = digits)
}
+ if (!is.null(x$covariates)) {
+ cat("\nCovariates used for endpoints below:\n")
+ print(x$covariates)
+ }
+
printSFORB <- !is.null(x$SFORB)
if(printSFORB){
cat("\nEstimated Eigenvalues of SFORB model(s):\n")
diff --git a/log/check.log b/log/check.log
index 9f05935f..cb313bc0 100644
--- a/log/check.log
+++ b/log/check.log
@@ -21,7 +21,8 @@ Maintainer: ‘Johannes Ranke <johannes.ranke@jrwb.de>’
* checking whether package ‘mkin’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
-* checking for future file timestamps ... OK
+* checking for future file timestamps ... NOTE
+unable to verify current time
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
@@ -58,7 +59,7 @@ Maintainer: ‘Johannes Ranke <johannes.ranke@jrwb.de>’
* checking sizes of PDF files under ‘inst/doc’ ... OK
* checking installed files from ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
-* checking examples ... [11s/11s] OK
+* checking examples ... [10s/11s] OK
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ... SKIPPED
* checking for unstated dependencies in vignettes ... OK
@@ -70,5 +71,9 @@ Maintainer: ‘Johannes Ranke <johannes.ranke@jrwb.de>’
* checking for detritus in the temp directory ... OK
* DONE
-Status: OK
+Status: 1 NOTE
+See
+ ‘/home/jranke/git/mkin/mkin.Rcheck/00check.log’
+for details.
+
diff --git a/log/test.log b/log/test.log
index de28f836..54aa3c73 100644
--- a/log/test.log
+++ b/log/test.log
@@ -4,50 +4,50 @@
✔ | 5 | Analytical solutions for coupled models [1.6s]
✔ | 5 | Calculation of Akaike weights
✔ | 3 | Export dataset for reading into CAKE
-✔ | 12 | Confidence intervals and p-values [0.4s]
-✔ | 1 12 | Dimethenamid data from 2018 [12.0s]
+✔ | 12 | Confidence intervals and p-values [0.3s]
+✔ | 1 12 | Dimethenamid data from 2018 [12.5s]
────────────────────────────────────────────────────────────────────────────────
Skip ('test_dmta.R:99'): 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 [2.3s]
+✔ | 14 | Error model fitting [2.4s]
✔ | 5 | Time step normalisation
✔ | 4 | Calculation of FOCUS chi2 error levels [0.3s]
-✔ | 14 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [0.4s]
+✔ | 14 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [0.5s]
✔ | 4 | Test fitting the decline of metabolites from their maximum [0.2s]
✔ | 1 | Fitting the logistic model [0.1s]
-✔ | 10 | Batch fitting and diagnosing hierarchical kinetic models [19.0s]
-✔ | 1 11 | Nonlinear mixed-effects models [5.9s]
+✔ | 10 | Batch fitting and diagnosing hierarchical kinetic models [19.5s]
+✔ | 1 11 | Nonlinear mixed-effects models [5.7s]
────────────────────────────────────────────────────────────────────────────────
Skip ('test_mixed.R:78'): 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.5s]
+✔ | 10 | Special cases of mkinfit calls [0.4s]
✔ | 3 | mkinfit features [0.5s]
✔ | 8 | mkinmod model generation and printing
✔ | 3 | Model predictions with mkinpredict [0.1s]
-✔ | 12 | Multistart method for saem.mmkin models [21.7s]
+✔ | 12 | Multistart method for saem.mmkin models [21.2s]
✔ | 16 | Evaluations according to 2015 NAFTA guidance [1.5s]
✔ | 9 | Nonlinear mixed-effects models with nlme [3.7s]
-✔ | 15 | Plotting [4.9s]
+✔ | 15 | Plotting [4.4s]
✔ | 4 | Residuals extracted from mkinfit models
-✔ | 1 36 | saemix parent models [32.6s]
+✔ | 1 36 | saemix parent models [30.8s]
────────────────────────────────────────────────────────────────────────────────
Skip ('test_saemix_parent.R:143'): 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 [0.5s]
✔ | 11 | Processing of residue series
-✔ | 10 | Fitting the SFORB model [1.7s]
+✔ | 10 | Fitting the SFORB model [1.6s]
✔ | 1 | Summaries of old mkinfit objects
✔ | 5 | Summary
✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [0.8s]
-✔ | 9 | Hypothesis tests [3.0s]
+✔ | 9 | Hypothesis tests [2.9s]
✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [0.7s]
══ Results ═════════════════════════════════════════════════════════════════════
-Duration: 114.8 s
+Duration: 112.6 s
── Skipped tests ──────────────────────────────────────────────────────────────
• Fitting this ODE model with saemix takes about 15 minutes on my system (1)
diff --git a/man/summary.saem.mmkin.Rd b/man/summary.saem.mmkin.Rd
index 0845d4d2..41932547 100644
--- a/man/summary.saem.mmkin.Rd
+++ b/man/summary.saem.mmkin.Rd
@@ -5,7 +5,15 @@
\alias{print.summary.saem.mmkin}
\title{Summary method for class "saem.mmkin"}
\usage{
-\method{summary}{saem.mmkin}(object, data = FALSE, verbose = FALSE, distimes = TRUE, ...)
+\method{summary}{saem.mmkin}(
+ object,
+ data = FALSE,
+ verbose = FALSE,
+ covariates = NULL,
+ covariate_quantile = 0.5,
+ distimes = TRUE,
+ ...
+)
\method{print}{summary.saem.mmkin}(x, digits = max(3, getOption("digits") - 3), verbose = x$verbose, ...)
}
@@ -17,6 +25,13 @@ the summary.}
\item{verbose}{Should the summary be verbose?}
+\item{covariates}{Numeric vector with covariate values for all variables in
+any covariate models in the object. If given, it overrides 'covariate_quantile'.}
+
+\item{covariate_quantile}{This argument only has an effect if the fitted
+object has covariate models. If so, the default is to show endpoints
+for the median of the covariate values (50th percentile).}
+
\item{distimes}{logical, indicating whether DT50 and DT90 values should be
included.}

Contact - Imprint