aboutsummaryrefslogtreecommitdiff
path: root/R/saem.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/saem.R')
-rw-r--r--R/saem.R27
1 files changed, 19 insertions, 8 deletions
diff --git a/R/saem.R b/R/saem.R
index 36997ad7..d2240ea5 100644
--- a/R/saem.R
+++ b/R/saem.R
@@ -252,7 +252,7 @@ saemix_model <- function(object, solution_type = "auto", transformations = c("mk
}
degparms_fixed <- object[[1]]$bparms.fixed
- # Transformations are done in the degradation function
+ # Transformations are done in the degradation function by default
transform.par = rep(0, length(degparms_optim))
odeini_optim_parm_names <- grep('_0$', names(degparms_optim), value = TRUE)
@@ -339,13 +339,24 @@ saemix_model <- function(object, solution_type = "auto", transformations = c("mk
}
}
if (parent_type == "HS") {
- model_function <- function(psi, id, xidep) {
- tb <- exp(psi[id, 4])
- t <- xidep[, "time"]
- k1 = exp(psi[id, 2])
- psi[id, 1] * ifelse(t <= tb,
- exp(- k1 * t),
- exp(- k1 * tb) * exp(- exp(psi[id, 3]) * (t - tb)))
+ if (transformations == "mkin") {
+ model_function <- function(psi, id, xidep) {
+ tb <- exp(psi[id, 4])
+ t <- xidep[, "time"]
+ k1 <- exp(psi[id, 2])
+ psi[id, 1] * ifelse(t <= tb,
+ exp(- k1 * t),
+ exp(- k1 * tb) * exp(- exp(psi[id, 3]) * (t - tb)))
+ }
+ } else {
+ model_function <- function(psi, id, xidep) {
+ tb <- exp(psi[id, 4])
+ t <- xidep[, "time"]
+ psi[id, 1] * ifelse(t <= tb,
+ exp(- psi[id, 2] * t),
+ exp(- psi[id, 2] * tb) * exp(- psi[id, 3] * (t - tb)))
+ }
+ transform.par = c(0, 1, 1, 1)
}
}
}

Contact - Imprint