aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-02-09 12:19:14 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2022-02-09 12:19:14 +0100
commitd8f31d1323998f33d07535f55c81be380d93ca45 (patch)
treeef0e614878397974bb4040e146fb116bb4ee40c5 /R
parent0fa8a770812775d697717ad723f7f61fb04b7fef (diff)
Adapt saemix interface to saemix 3.0 on CRAN
Diffstat (limited to 'R')
-rw-r--r--R/intervals.R2
-rw-r--r--R/plot.mixed.mmkin.R5
-rw-r--r--R/saem.R9
3 files changed, 13 insertions, 3 deletions
diff --git a/R/intervals.R b/R/intervals.R
index e2d342f0..8ab2b7ec 100644
--- a/R/intervals.R
+++ b/R/intervals.R
@@ -10,6 +10,7 @@ nlme::intervals
#' @param backtransform In case the model was fitted with mkin transformations,
#' should we backtransform the parameters where a one to one correlation
#' between transformed and backtransformed parameters exists?
+#' @param \dots For compatibility with the generic method
#' @return An object with 'intervals.saem.mmkin' and 'intervals.lme' in the
#' class attribute
#' @export
@@ -101,6 +102,7 @@ intervals.saem.mmkin <- function(object, level = 0.95, backtransform = TRUE, ...
#' @param level The confidence level.
#' @param backtransform Should we backtransform the parameters where a one to
#' one correlation between transformed and backtransformed parameters exists?
+#' @param \dots For compatibility with the generic method
#' @importFrom nlme intervals
#' @return An object with 'intervals.saem.mmkin' and 'intervals.lme' in the
#' class attribute
diff --git a/R/plot.mixed.mmkin.R b/R/plot.mixed.mmkin.R
index 1ac62b07..2903a05c 100644
--- a/R/plot.mixed.mmkin.R
+++ b/R/plot.mixed.mmkin.R
@@ -104,8 +104,9 @@ plot.mixed.mmkin <- function(x,
if (inherits(x, "saem.mmkin")) {
if (x$transformations == "saemix") backtransform = FALSE
- degparms_i <- saemix::psi(x$so)
- rownames(degparms_i) <- ds_names
+ psi <- saemix::psi(x$so)
+ rownames(psi) <- x$saemix_ds_order
+ degparms_i <- psi[ds_names, ]
degparms_i_names <- setdiff(x$so@results@name.fixed, names(fit_1$errparms))
colnames(degparms_i) <- degparms_i_names
residual_type = ifelse(standardized, "standardized", "residual")
diff --git a/R/saem.R b/R/saem.R
index 2c20f788..a8b9a67d 100644
--- a/R/saem.R
+++ b/R/saem.R
@@ -158,9 +158,14 @@ saem.mmkin <- function(object,
}
return_data <- nlme_data(object)
+ saemix_data_ds <- f_saemix@data@data$ds
+ mkin_ds_order <- as.character(unique(return_data$ds))
+ saemix_ds_order <- unique(saemix_data_ds)
+ psi <- saemix::psi(f_saemix)
+ rownames(psi) <- saemix_ds_order
return_data$predicted <- f_saemix@model@model(
- psi = saemix::psi(f_saemix),
+ psi = psi[mkin_ds_order, ],
id = as.numeric(return_data$ds),
xidep = return_data[c("time", "name")])
@@ -184,6 +189,8 @@ saem.mmkin <- function(object,
bparms.optim = bparms_optim,
bparms.fixed = object[[1]]$bparms.fixed,
data = return_data,
+ mkin_ds_order = mkin_ds_order,
+ saemix_ds_order = saemix_ds_order,
err_mod = object[[1]]$err_mod,
date.fit = date(),
saemixversion = as.character(utils::packageVersion("saemix")),

Contact - Imprint