aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2023-03-15 19:06:02 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2023-03-15 19:06:02 +0100
commitdd525f49b852376f24851f23c36d6c50f23dbf82 (patch)
treeeb0a6b5d41df3ea35f0f61269ca66957c80dcfd5 /R
parent262d4de5fb2c6e98367793650607b3baa4268fcc (diff)
Start parms and endpoints for covariates
Diffstat (limited to 'R')
-rw-r--r--R/endpoints.R14
-rw-r--r--R/saem.R2
2 files changed, 13 insertions, 3 deletions
diff --git a/R/endpoints.R b/R/endpoints.R
index 4aec8aa8..0c26ffae 100644
--- a/R/endpoints.R
+++ b/R/endpoints.R
@@ -14,6 +14,10 @@
#' another object that has list components mkinmod containing an [mkinmod]
#' degradation model, and two numeric vectors, bparms.optim and bparms.fixed,
#' that contain parameter values for that model.
+#' @param \dots Possibility to specify values for the covariates in the model.
+#' In case more than one vector is given, they either have to be of the same
+#' length, or of length one, in which case the respective covariate values are
+#' recycled.
#' @importFrom stats optimize
#' @return A list with a matrix of dissipation times named distimes, and, if
#' applicable, a vector of formation fractions named ff and, if the SFORB model
@@ -34,17 +38,21 @@
#' }
#'
#' @export
-endpoints <- function(fit) {
- ep <- list()
+endpoints <- function(fit, ...) {
mkinmod <- fit$mkinmod
- degparms <- c(fit$bparms.optim, fit$bparms.fixed)
obs_vars <- names(mkinmod$spec)
+
+ degparms <- c(fit$bparms.optim, fit$bparms.fixed)
+
+ # Set up object to return
+ ep <- list()
ep$ff <- vector()
ep$SFORB <- vector()
ep$distimes <- data.frame(
DT50 = rep(NA, length(obs_vars)),
DT90 = rep(NA, length(obs_vars)),
row.names = obs_vars)
+
for (obs_var in obs_vars) {
type = names(mkinmod$map[[obs_var]])[1]
diff --git a/R/saem.R b/R/saem.R
index 7eeec2bb..bddd3bfe 100644
--- a/R/saem.R
+++ b/R/saem.R
@@ -226,6 +226,8 @@ saem.mmkin <- function(object,
transformations = transformations,
transform_rates = object[[1]]$transform_rates,
transform_fractions = object[[1]]$transform_fractions,
+ covariates = covariates,
+ covariate_models = covariate_models,
sm = m_saemix,
so = f_saemix,
call = call,

Contact - Imprint