aboutsummaryrefslogtreecommitdiff
path: root/R/mkinfit.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2014-07-24 14:42:59 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2014-07-24 14:42:59 +0200
commit9b947f0358d3a1b1fc922bfd0187ca444ce5811d (patch)
tree1672f6a74661aa9eed0ee09e662030b84217cbd2 /R/mkinfit.R
parent4eb6682cf4e25cfe4d58a49c8632307a7cac1ca4 (diff)
Bump version, better default for state.ini
Diffstat (limited to 'R/mkinfit.R')
-rw-r--r--R/mkinfit.R10
1 files changed, 8 insertions, 2 deletions
diff --git a/R/mkinfit.R b/R/mkinfit.R
index 39d084cb..c98c7586 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -154,8 +154,14 @@ mkinfit <- function(mkinmod, observed,
# Set default for state.ini if appropriate
if (state.ini[1] == "auto") {
- state.ini = c(mean(subset(observed, time == 0 & name == presumed_parent_name)$value),
- rep(0, length(mkinmod$diffs) - 1))
+ presumed_parent_time_0 = subset(observed,
+ time == 0 & name == presumed_parent_name)$value
+ presumed_parent_time_0_mean = mean(presumed_parent_time_0, na.rm = TRUE)
+ if (is.na(presumed_parent_time_0_mean)) {
+ state.ini = c(100, rep(0, length(mkinmod$diffs) - 1))
+ } else {
+ state.ini = c(presumed_parent_time_0_mean, rep(0, length(mkinmod$diffs) - 1))
+ }
}
# Name the inital state variable values if they are not named yet

Contact - Imprint