[Depmix-commits] r608 - pkg/depmixS4/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Nov 6 13:31:10 CET 2013
Author: ingmarvisser
Date: 2013-11-06 13:31:09 +0100 (Wed, 06 Nov 2013)
New Revision: 608
Modified:
pkg/depmixS4/R/depmixfit.R
Log:
Added a conditional to set the log likelihood of a model to a value just above the starting value (ie the values before iterations start) when the logl functions returns Infinite (which may sometimes occur when parameters are set outside their boundaries).
Modified: pkg/depmixS4/R/depmixfit.R
===================================================================
--- pkg/depmixS4/R/depmixfit.R 2013-09-19 08:51:27 UTC (rev 607)
+++ pkg/depmixS4/R/depmixfit.R 2013-11-06 12:31:09 UTC (rev 608)
@@ -112,12 +112,15 @@
lin.l <- lin.l[-allzero]
}
+ startLogLik <- -logLik(object)*1.01
+
# make loglike function that only depends on pars
logl <- function(pars) {
allpars[!fixed] <- pars
object <- setpars(object,allpars)
ans = -as.numeric(logLik(object))
- if(is.na(ans)) ans = 100000 # remove magic number here!!!!!!!
+ if(is.na(ans)) ans <- startLogLik
+ if(is.infinite(ans)) ans <- startLogLik
ans
}
More information about the depmix-commits
mailing list