aboutsummaryrefslogtreecommitdiff
path: root/R/mkinerrmin.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2014-08-25 10:39:40 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2014-08-25 10:39:40 +0200
commitf30472ecd2afea6bd2153b8ad2bb2f663f3a2742 (patch)
treefbd42a39c77528592b1776b709dbc07ce57b0bca /R/mkinerrmin.R
parentf4d9b1d8fc3baa668112ae2a31f5d91e8b7df9d7 (diff)
Bug fix and unit tests for mkinerrmin
See NEWS.md for details
Diffstat (limited to 'R/mkinerrmin.R')
-rw-r--r--R/mkinerrmin.R9
1 files changed, 5 insertions, 4 deletions
diff --git a/R/mkinerrmin.R b/R/mkinerrmin.R
index 09724730..2697d0a0 100644
--- a/R/mkinerrmin.R
+++ b/R/mkinerrmin.R
@@ -36,10 +36,11 @@ mkinerrmin <- function(fit, alpha = 0.05)
suffixes = c("_mean", "_pred"))
errdata <- errdata[order(errdata$time, errdata$name), ]
- # Any value that is set to exactly zero is not really an observed value
- # Remove those at time 0 - those are caused by the FOCUS recommendation
- # to set metabolites occurring at time 0 to 0
- errdata <- subset(errdata, !(time == 0 & value_mean == 0))
+ # Remove values at time zero for variables whose value for state.ini is fixed,
+ # as these will not have any effect in the optimization and should therefore not
+ # be counted as degrees of freedom.
+ fixed_initials = gsub("_0$", "", rownames(subset(fit$fixed, type = "state")))
+ errdata <- subset(errdata, !(time == 0 & name %in% fixed_initials))
n.optim.overall <- length(parms.optim)

Contact - Imprint