aboutsummaryrefslogtreecommitdiff
path: root/R/mkinfit.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-06-04 21:10:58 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-06-04 21:10:58 +0200
commit307a317666b8a1cdfe2293371ad8671403680a36 (patch)
treeacb43d723a70065625d8e16e856a4034f04e40a9 /R/mkinfit.R
parent2bc4adb7080e5893ab423768fe2e24777b292f19 (diff)
Fix a bug introduced in the last commit
Diffstat (limited to 'R/mkinfit.R')
-rw-r--r--R/mkinfit.R6
1 files changed, 4 insertions, 2 deletions
diff --git a/R/mkinfit.R b/R/mkinfit.R
index 13c7aa90..60697cb1 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -505,13 +505,15 @@ mkinfit <- function(mkinmod, observed,
upper = upper[names(parms.start)],
control = control, ...)
fit$logLik <- - nlogLik.current
+
if (error_model_algorithm == "d_3") {
- if (abs((fit_direct$logLik - fit$logLik))/mean(c(fit_direct$logLik, fit$logLik)) < 0.001) {
+ rel_diff <- abs((fit_direct$logLik - fit$logLik))/-mean(c(fit_direct$logLik, fit$logLik))
+ if (rel_diff < 0.0001) {
if (!quiet) {
message("Direct fitting and three-step fitting yield approximately the same likelihood")
}
} else {
- if (fit_direct$logLik < fit$logLik) {
+ if (fit$logLik > fit_direct$logLik) {
if (!quiet) message("Three-step fitting yielded a higher likelihood than direct fitting")
} else {
if (!quiet) message("Direct fitting yielded a higher likelihood than three-step fitting")

Contact - Imprint