aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-05-07 08:43:12 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-05-07 08:43:12 +0200
commitc322a8102a399cbb1fe38c4c4ca4485cea8bc4e8 (patch)
tree892ba3d6db12d7f2c6af55beaa12cc8b43d40df3 /R
parent8a3475c59f3d91ce5ce7d980d6de09360617e7fe (diff)
Fix hessian calculations
Static documentation rebuilt by pkgdown
Diffstat (limited to 'R')
-rw-r--r--R/mkinfit.R15
1 files changed, 8 insertions, 7 deletions
diff --git a/R/mkinfit.R b/R/mkinfit.R
index 664419be..5e7b5bd3 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -343,14 +343,15 @@ mkinfit <- function(mkinmod, observed,
data_log_lik <- merge(observed[c("name", "time", "value", "std")], out_long,
by = c("name", "time"), suffixes = c(".observed", ".predicted"))
- # We only update likelihood and data during the optimisation, not during hessian calculations
+ if (OLS) {
+ nlogLik <- with(data_log_lik, sum((value.observed - value.predicted)^2))
+ } else {
+ nlogLik <- - with(data_log_lik,
+ sum(dnorm(x = value.observed, mean = value.predicted, sd = std, log = TRUE)))
+ }
+
+ # We update the current likelihood and data during the optimisation, not during hessian calculations
if (update_data) {
- if (OLS) {
- nlogLik <- with(data_log_lik, sum((value.observed - value.predicted)^2))
- } else {
- nlogLik <- - with(data_log_lik,
- sum(dnorm(x = value.observed, mean = value.predicted, sd = std, log = TRUE)))
- }
assign("out_predicted", out_long, inherits = TRUE)
assign("data_errmod", data_log_lik, inherits = TRUE)

Contact - Imprint