diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2019-05-07 08:43:12 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2019-05-07 08:43:12 +0200 |
commit | c322a8102a399cbb1fe38c4c4ca4485cea8bc4e8 (patch) | |
tree | 892ba3d6db12d7f2c6af55beaa12cc8b43d40df3 /R/mkinfit.R | |
parent | 8a3475c59f3d91ce5ce7d980d6de09360617e7fe (diff) |
Fix hessian calculations
Static documentation rebuilt by pkgdown
Diffstat (limited to 'R/mkinfit.R')
-rw-r--r-- | R/mkinfit.R | 15 |
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)
|