aboutsummaryrefslogtreecommitdiff
path: root/R/mkinpredict.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-12-09 21:29:18 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2020-12-09 21:35:02 +0100
commitb8b60ef92c605e862294fd29c51e20e31e0ded81 (patch)
tree2b759482d42119fe66fa8ccfd23a1f015884bb42 /R/mkinpredict.R
parenta5746dcc0e5a018548bf977f4ac61f0ad2a4dd2d (diff)
Make saem using mkinpredict work again
I threw out mclapply as it did not play well with the linear algebra routines used in the saemix code. Most of the change is actually indentation in the code creating the model function. But there is an important fix in mkinpredict which I had broken.
Diffstat (limited to 'R/mkinpredict.R')
-rw-r--r--R/mkinpredict.R4
1 files changed, 3 insertions, 1 deletions
diff --git a/R/mkinpredict.R b/R/mkinpredict.R
index 4b618490..3402a7ba 100644
--- a/R/mkinpredict.R
+++ b/R/mkinpredict.R
@@ -134,6 +134,8 @@ mkinpredict.mkinmod <- function(x,
dimnames = list(as.character(outtimes), c("time", obs_vars)))
out_obs[, "time"] <- outtimes
+ n_out_na <- 0 # to check if we get NA values with deSolve
+
if (solution_type == "analytical") {
# This is clumsy, as we wanted fast analytical predictions for mkinfit,
# which bypasses mkinpredict in the case of analytical solutions
@@ -222,7 +224,7 @@ mkinpredict.mkinmod <- function(x,
if (map_output) {
# Output transformation for models with unobserved compartments like SFORB
# if not already mapped in analytical solution
- if (!na_stop) {
+ if (n_out_na > 0 & !na_stop) {
available <- c(TRUE, rep(FALSE, length(outtimes) - 1))
} else {
available <- rep(TRUE, length(outtimes))

Contact - Imprint