aboutsummaryrefslogtreecommitdiff
path: root/R/mkinfit.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-04-22 16:09:53 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2020-04-22 18:01:26 +0200
commitae4ca17b89047052b35acee8e636ff8f31636c13 (patch)
tree8d44949bc8b2a2c23a2e2896e12ff438252a1fe5 /R/mkinfit.R
parentf6b6ecd0f925799aaced3fb5ceb9e5817a99d884 (diff)
Support SFORB with formation fractions
Diffstat (limited to 'R/mkinfit.R')
-rw-r--r--R/mkinfit.R9
1 files changed, 5 insertions, 4 deletions
diff --git a/R/mkinfit.R b/R/mkinfit.R
index 1c409569..5c092612 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -378,8 +378,9 @@ mkinfit <- function(mkinmod, observed,
if (parmname == "r") parms.ini[parmname] = 0.2
}
# Default values for formation fractions in case they are present
- for (box in mod_vars) {
- f_names <- mkinmod$parms[grep(paste0("^f_", box), mkinmod$parms)]
+ for (obs_var in obs_vars) {
+ origin <- mkinmod$map[[obs_var]][[1]]
+ f_names <- mkinmod$parms[grep(paste0("^f_", origin), mkinmod$parms)]
if (length(f_names) > 0) {
# We need to differentiate between default and specified fractions
# and set the unspecified to 1 - sum(specified)/n_unspecified
@@ -388,9 +389,9 @@ mkinfit <- function(mkinmod, observed,
sum_f_specified = sum(parms.ini[f_specified_names])
if (sum_f_specified > 1) {
stop("Starting values for the formation fractions originating from ",
- box, " sum up to more than 1.")
+ origin, " sum up to more than 1.")
}
- if (mkinmod$spec[[box]]$sink) n_unspecified = length(f_default_names) + 1
+ if (mkinmod$spec[[obs_var]]$sink) n_unspecified = length(f_default_names) + 1
else {
n_unspecified = length(f_default_names)
}

Contact - Imprint