diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2022-08-08 11:03:32 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2022-08-08 11:03:32 +0200 |
commit | 051268e3b1680792fbe3c5fccaecc09e74660d0f (patch) | |
tree | 8971d16737c15d78d33e1bc305291641bd2bbc82 /R/saem.R | |
parent | 22d21cf5efcfb52c59c969d393bb0be077e982dd (diff) |
Error on unsupported saemix transformations
Also, support FOMC with saemix transformations
Diffstat (limited to 'R/saem.R')
-rw-r--r-- | R/saem.R | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -253,6 +253,7 @@ saemix_model <- function(object, solution_type = "auto", transformations = c("mk degparms_fixed <- object[[1]]$bparms.fixed # Transformations are done in the degradation function by default + # (transformations = "mkin") transform.par = rep(0, length(degparms_optim)) odeini_optim_parm_names <- grep('_0$', names(degparms_optim), value = TRUE) @@ -276,6 +277,9 @@ saemix_model <- function(object, solution_type = "auto", transformations = c("mk if (length(mkin_model$spec) == 1) { parent_type <- mkin_model$spec[[1]]$type if (length(odeini_fixed) == 1) { + if (transformations == "saemix") { + stop("saemix transformations are not supported for parent fits with fixed initial parent value") + } if (parent_type == "SFO") { stop("saemix needs at least two parameters to work on.") } @@ -316,8 +320,15 @@ saemix_model <- function(object, solution_type = "auto", transformations = c("mk } } if (parent_type == "FOMC") { - model_function <- function(psi, id, xidep) { - psi[id, 1] / (xidep[, "time"]/exp(psi[id, 3]) + 1)^exp(psi[id, 2]) + if (transformations == "mkin") { + model_function <- function(psi, id, xidep) { + psi[id, 1] / (xidep[, "time"]/exp(psi[id, 3]) + 1)^exp(psi[id, 2]) + } + } else { + model_function <- function(psi, id, xidep) { + psi[id, 1] / (xidep[, "time"]/psi[id, 3] + 1)^psi[id, 2] + } + transform.par = c(0, 1, 1) } } if (parent_type == "DFOP") { |