From 6fbb2341f998b322f21fe4e7cd655e0ca61cdbe4 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 1 Sep 2020 08:05:43 +0200 Subject: Back-calculated DT50 values for biphasic models --- NEWS.md | 2 ++ R/endpoints.R | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 8f99b2f9..822ac219 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,6 +18,8 @@ - 'mkinfit': Ignore components of state.ini that do not correspond to state variables in the model +- 'endpoints': Back-calculate DT50 value from DT90 also for the biphasic models DFOP, HS and SFORB + # mkin 0.9.50.2 (2020-05-12) - Increase tolerance for a platform specific test results on the Solaris test machine on CRAN diff --git a/R/endpoints.R b/R/endpoints.R index cccd2ff7..e4813db9 100644 --- a/R/endpoints.R +++ b/R/endpoints.R @@ -22,8 +22,10 @@ #' fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) #' endpoints(fit) #' \dontrun{ -#' fit_2 <- mkinfit("SFORB", FOCUS_2006_C, quiet = TRUE) +#' fit_2 <- mkinfit("DFOP", FOCUS_2006_C, quiet = TRUE) #' endpoints(fit_2) +#' fit_3 <- mkinfit("SFORB", FOCUS_2006_C, quiet = TRUE) +#' endpoints(fit_3) #' } #' #' @export @@ -135,7 +137,9 @@ endpoints <- function(fit) { silent = TRUE) if (inherits(DT50, "try-error")) DT50 = NA if (inherits(DT90, "try-error")) DT90 = NA + DT50_back = DT90 / (log(10)/log(2)) # Backcalculated DT50 as recommended in FOCUS 2011 + ep$distimes[obs_var, c("DT50back")] = DT50_back ep$distimes[obs_var, c("DT50_k1")] = DT50_k1 ep$distimes[obs_var, c("DT50_k2")] = DT50_k2 } @@ -152,8 +156,10 @@ endpoints <- function(fit) { } DT50 <- DTx(50) DT90 <- DTx(90) + DT50_back = DT90 / (log(10)/log(2)) # Backcalculated DT50 as recommended in FOCUS 2011 DT50_k1 = log(2)/k1 DT50_k2 = log(2)/k2 + ep$distimes[obs_var, c("DT50back")] = DT50_back ep$distimes[obs_var, c("DT50_k1")] = DT50_k1 ep$distimes[obs_var, c("DT50_k2")] = DT50_k2 } @@ -191,6 +197,8 @@ endpoints <- function(fit) { DT90 = if (inherits(log_DT90, "try-error")) NA else exp(log_DT90) + DT50_back = DT90 / (log(10)/log(2)) # Backcalculated DT50 as recommended in FOCUS 2011 + for (k_out_name in k_out_names) { ep$ff[[sub("k_", "", k_out_name)]] = parms.all[[k_out_name]] / k_1output @@ -200,6 +208,7 @@ endpoints <- function(fit) { ep$SFORB[[paste(obs_var, "b1", sep="_")]] = b1 ep$SFORB[[paste(obs_var, "b2", sep="_")]] = b2 + ep$distimes[obs_var, c("DT50back")] = DT50_back ep$distimes[obs_var, c(paste("DT50", obs_var, "b1", sep = "_"))] = DT50_b1 ep$distimes[obs_var, c(paste("DT50", obs_var, "b2", sep = "_"))] = DT50_b2 } -- cgit v1.2.1