aboutsummaryrefslogtreecommitdiff
path: root/R/mkinfit.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2014-07-14 20:18:53 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2014-07-14 20:18:53 +0200
commite0a3413892c7330d496b448a561e87d2bdd67aa9 (patch)
tree20227b52969496a03daf1fe01588783e4a112501 /R/mkinfit.R
parenta69bf39427ff4f93eebdc8bceacb8174ff13c085 (diff)
parent759e693e9af8e794bbfa62b001117fabbdbc8bfa (diff)
Merge bugfix branch 'master' into iore
Add IORE support to mkinerrmin
Diffstat (limited to 'R/mkinfit.R')
-rw-r--r--R/mkinfit.R36
1 files changed, 17 insertions, 19 deletions
diff --git a/R/mkinfit.R b/R/mkinfit.R
index 26fc0e6b..46121c6d 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -107,26 +107,24 @@ mkinfit <- function(mkinmod, observed,
if (parmname == "tb") parms.ini[parmname] = 5
if (parmname == "g") parms.ini[parmname] = 0.5
}
- # Default values for formation fractions in case they are used
- if (mkinmod$use_of_ff == "max") {
- for (box in mod_vars) {
- f_names <- mkinmod$parms[grep(paste0("^f_", box), 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
- f_default_names <- intersect(f_names, defaultpar.names)
- f_specified_names <- setdiff(f_names, defaultpar.names)
- 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.")
- }
- if (mkinmod$spec[[box]]$sink) n_unspecified = length(f_default_names) + 1
- else {
- n_unspecified = length(f_default_names)
- }
- parms.ini[f_default_names] <- (1 - sum_f_specified) / n_unspecified
+ # 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)]
+ if (length(f_names) > 0) {
+ # We need to differentiate between default and specified fractions
+ # and set the unspecified to 1 - sum(specified)/n_unspecified
+ f_default_names <- intersect(f_names, defaultpar.names)
+ f_specified_names <- setdiff(f_names, defaultpar.names)
+ 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.")
+ }
+ if (mkinmod$spec[[box]]$sink) n_unspecified = length(f_default_names) + 1
+ else {
+ n_unspecified = length(f_default_names)
}
+ parms.ini[f_default_names] <- (1 - sum_f_specified) / n_unspecified
}
}

Contact - Imprint