diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2014-07-14 18:25:53 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2014-07-14 18:25:53 +0200 |
commit | 759e693e9af8e794bbfa62b001117fabbdbc8bfa (patch) | |
tree | 2c4fb2232763595924090c76ae95e0b87dd76f40 /R/mkinfit.R | |
parent | a9a3b38a2ca5bc7223435f43814cfc6c7a1077bd (diff) |
Bugfix release version 0.9-31
Diffstat (limited to 'R/mkinfit.R')
-rw-r--r-- | R/mkinfit.R | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/R/mkinfit.R b/R/mkinfit.R index b7ca1d74..c6e13b97 100644 --- a/R/mkinfit.R +++ b/R/mkinfit.R @@ -105,26 +105,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
}
}
|