From e5c955f82adf6139d76f842a0b85e5d383685793 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 25 Jul 2014 09:36:15 +0200 Subject: Fix internal naming of g for transform_fractions=FALSE --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ R/transform_odeparms.R | 15 +++++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bf0fa09a..02480e56 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,7 @@ Type: Package Title: Routines for fitting kinetic models with one or more state variables to chemical degradation data Version: 0.9-33 -Date: 2014-07-24 +Date: 2014-07-25 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "jranke@uni-bremen.de"), person("Katrin", "Lindenberger", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index 4c45a0d1..d3c43d60 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,10 @@ - The initial value (state.ini) for the observed variable with the highest observed residue is set to 100 in case it has no time zero observation and `state.ini = "auto"` +## BUG FIXES + +- `mkinfit()`: The internally fitted parameter for `g` was named `g_ilr` even when `transform_fractions=FALSE` + # CHANGES in mkin VERSION 0.9-32 ## NEW FEATURES diff --git a/R/transform_odeparms.R b/R/transform_odeparms.R index f518ae32..e64bac59 100644 --- a/R/transform_odeparms.R +++ b/R/transform_odeparms.R @@ -76,9 +76,15 @@ transform_odeparms <- function(parms, mkinmod, } } } + + # DFOP parameter g is treated as a fraction if (!is.na(parms["g"])) { g <- parms["g"] - transparms["g_ilr"] <- ifelse(transform_fractions, ilr(c(g, 1 - g)), g) + if (transform_fractions) { + transparms["g_ilr"] <- ilr(c(g, 1 - g)) + } else { + transparms["g"] <- g + } } return(transparms) @@ -145,9 +151,14 @@ backtransform_odeparms <- function(transparms, mkinmod, } } } + + # DFOP parameter g is treated as a fraction if (!is.na(transparms["g_ilr"])) { g_ilr <- transparms["g_ilr"] - parms["g"] <- ifelse(transform_fractions, invilr(g_ilr)[1], g_ilr) + parms["g"] <- invilr(g_ilr)[1] + } + if (!is.na(transparms["g"])) { + parms["g"] <- transparms["g"] } return(parms) -- cgit v1.2.1