[Distr-commits] r210 - branches/distr-2.0/pkg/distrMod/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jul 28 22:09:58 CEST 2008


Author: ruckdeschel
Date: 2008-07-28 22:09:58 +0200 (Mon, 28 Jul 2008)
New Revision: 210

Modified:
   branches/distr-2.0/pkg/distrMod/R/MLEstimator.R
Log:
a minor change: use log-argument of d-slot where possible in Log-Likelihood

Modified: branches/distr-2.0/pkg/distrMod/R/MLEstimator.R
===================================================================
--- branches/distr-2.0/pkg/distrMod/R/MLEstimator.R	2008-07-28 12:25:06 UTC (rev 209)
+++ branches/distr-2.0/pkg/distrMod/R/MLEstimator.R	2008-07-28 20:09:58 UTC (rev 210)
@@ -23,10 +23,17 @@
 #    return(res)
 #}
 
+## caching to speed up things:
+.inArgs <- distr:::.inArgs
+
 ## Maximum-Likelihood estimator
 MLEstimator <- function(x, ParamFamily, interval, par, Infos, ...){
     negLoglikelihood <- function(x, Distribution, ...){
-        res <- -sum(log(Distribution at d(x, ...)))
+### increase accuracy:
+        if(Distribution at .withSim||!.inArgs("log",d(Distribution)))
+           res <- -sum(log(Distribution at d(x, ...)))
+        else  
+           res <- -sum(Distribution at d(x, log = TRUE, ...))
         return(res)
     }
 



More information about the Distr-commits mailing list