diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2023-03-15 19:06:02 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2023-03-15 19:06:02 +0100 |
commit | dd525f49b852376f24851f23c36d6c50f23dbf82 (patch) | |
tree | eb0a6b5d41df3ea35f0f61269ca66957c80dcfd5 /R/endpoints.R | |
parent | 262d4de5fb2c6e98367793650607b3baa4268fcc (diff) |
Start parms and endpoints for covariates
Diffstat (limited to 'R/endpoints.R')
-rw-r--r-- | R/endpoints.R | 14 |
1 files changed, 11 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] |