[Distr-commits] r512 - in branches/distr-2.2/pkg/distrMod: R chm man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 17 19:24:04 CEST 2009


Author: ruckdeschel
Date: 2009-07-17 19:24:03 +0200 (Fri, 17 Jul 2009)
New Revision: 512

Modified:
   branches/distr-2.2/pkg/distrMod/R/MCEstimator.R
   branches/distr-2.2/pkg/distrMod/R/MDEstimator.R
   branches/distr-2.2/pkg/distrMod/R/MLEstimator.R
   branches/distr-2.2/pkg/distrMod/R/mleCalc-methods.R
   branches/distr-2.2/pkg/distrMod/chm/MCEstimator.html
   branches/distr-2.2/pkg/distrMod/chm/MDEstimator.html
   branches/distr-2.2/pkg/distrMod/chm/MLEstimator.html
   branches/distr-2.2/pkg/distrMod/chm/asSemivar-class.html
   branches/distr-2.2/pkg/distrMod/chm/distrMod.chm
   branches/distr-2.2/pkg/distrMod/chm/distrMod.hhp
   branches/distr-2.2/pkg/distrMod/chm/mleCalc-methods.html
   branches/distr-2.2/pkg/distrMod/man/MCEstimator.Rd
   branches/distr-2.2/pkg/distrMod/man/MDEstimator.Rd
   branches/distr-2.2/pkg/distrMod/man/MLEstimator.Rd
   branches/distr-2.2/pkg/distrMod/man/mleCalc-methods.Rd
Log:
distrMod:::
changed behaviour of mceCalc() and consequently of MCEstimator(), MDEstimator(), MLEstimator():

Instead of mapping unallowed parameter values into allowed ones by makeOKPar(), thereby pretending
to optim/optimize that the unallowed parameters give reasonable criterion values, now always
a penalty is returned whenever the parameter is not valid. For profiling though, we still 
keep the old behavior, i.e. map to allowed parameters by makeOKPar() in the returned criterion
function.

Modified: branches/distr-2.2/pkg/distrMod/R/MCEstimator.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/R/MCEstimator.R	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/R/MCEstimator.R	2009-07-17 17:24:03 UTC (rev 512)
@@ -3,7 +3,7 @@
 ###############################################################################
 MCEstimator <- function(x, ParamFamily, criterion, crit.name, 
                         startPar = NULL, 
-                        Infos, trafo = NULL, penalty = 0, validity.check = TRUE,
+                        Infos, trafo = NULL, penalty = 1e20, validity.check = TRUE,
                         asvar.fct, ...){
 
     ## preparation: getting the matched call

Modified: branches/distr-2.2/pkg/distrMod/R/MDEstimator.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/R/MDEstimator.R	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/R/MDEstimator.R	2009-07-17 17:24:03 UTC (rev 512)
@@ -3,7 +3,7 @@
 ###############################################################################
 MDEstimator <- function(x, ParamFamily, distance = KolmogorovDist, dist.name, 
                         startPar = NULL,  Infos, 
-                        trafo = NULL, penalty = 0, asvar.fct, ...){
+                        trafo = NULL, penalty = 1e20, asvar.fct, ...){
 
     ## preparation: getting the matched call
     es.call <- match.call()

Modified: branches/distr-2.2/pkg/distrMod/R/MLEstimator.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/R/MLEstimator.R	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/R/MLEstimator.R	2009-07-17 17:24:03 UTC (rev 512)
@@ -5,7 +5,7 @@
 
 ## Maximum-Likelihood estimator
 MLEstimator <- function(x, ParamFamily, startPar = NULL, 
-                        Infos, trafo = NULL, penalty = 0, ...){
+                        Infos, trafo = NULL, penalty = 1e20, ...){
 
     ## preparation: getting the matched call
     es.call <- match.call()

Modified: branches/distr-2.2/pkg/distrMod/R/mleCalc-methods.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/R/mleCalc-methods.R	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/R/mleCalc-methods.R	2009-07-17 17:24:03 UTC (rev 512)
@@ -62,7 +62,7 @@
 
 
 setMethod("mleCalc", signature(x = "numeric", PFam = "ParamFamily"),
-           function(x, PFam, startPar = NULL, penalty = 0, Infos  = NULL, ...){
+           function(x, PFam, startPar = NULL, penalty = 1e20, Infos  = NULL, ...){
 
            res <- mceCalc(x = x, PFam = PFam, 
                           criterion = .negLoglikelihood, startPar = startPar, 
@@ -77,7 +77,7 @@
 ################################################################################
 
 setMethod("mceCalc", signature(x = "numeric", PFam = "ParamFamily"),
-           function(x, PFam, criterion, startPar = NULL, penalty = 0, 
+           function(x, PFam, criterion, startPar = NULL, penalty = 1e20,
            crit.name = "", Infos = NULL, ...){
 
        if(is.null(startPar)) startPar <- startPar(PFam)(x,...)
@@ -89,12 +89,19 @@
    
        fun <- function(theta, Data, ParamFamily, criterion, ...){
                vP <- validParameter(ParamFamily, theta)
-               if(!vP) theta <- makeOKPar(ParamFamily)(theta)
-               if(lnx)
-                  names(theta) <- c(names(main(ParamFamily)),
-                                    names(nuisance(ParamFamily)))
-               else  names(theta) <- names(main(ParamFamily))
-               crit <- criterion(Data, ParamFamily at modifyParam(theta), ...)
+               if(!vP) crit <- penalty
+               else{
+                  if(lnx)
+                     names(theta) <- c(names(main(ParamFamily)),
+                                       names(nuisance(ParamFamily)))
+                  else  names(theta) <- names(main(ParamFamily))
+                  distr.new <- try(ParamFamily at modifyParam(theta),silent = TRUE)
+                  if(is(distr.new,"try.error")) crit <- penalty
+                  else{ crit <- try(criterion(Data, distr.new, ...),
+                                silent = TRUE)
+                        if(is(crit, "try-error")) crit <- penalty
+                  }
+               }
                critP <- crit + penalty * (1-vP)
                return(critP)}
 
@@ -115,6 +122,9 @@
         crit <- res$value
     }
 
+    vP <- validParameter(PFam, theta)
+    if(!vP) theta <- makeOKPar(PFam)(theta)
+
     idx <-      if(lnx) lmx + 1:lnx else 1:(lmx+lnx)
     nuis.idx <- if(lnx) idx else NULL
     nuis <- if(lnx) theta[-idx] else NULL
@@ -123,8 +133,19 @@
                                nuisance = nuis,
                                fixed = fixed)    
 
+    fun2 <- function(theta, Data, ParamFamily, criterion, ...){
+               vP <- validParameter(ParamFamily, theta)
+               if(!vP) theta <- makeOKPar(ParamFamily)(theta)
+               if(lnx)
+                     names(theta) <- c(names(main(ParamFamily)),
+                                       names(nuisance(ParamFamily)))
+               else  names(theta) <- names(main(ParamFamily))
+               distr.new <- ParamFamily at modifyParam(theta)
+               crit <- criterion(Data, distr.new, ...)
+               return(crit)}
+
     crit.fct <- get.criterion.fct(theta, Data = x, ParamFam = PFam, 
-                                   criterion, fun, ...)
+                                   criterion, fun2, ...)
     
     return(meRes(x, theta, crit, param, crit.fct, method = method,
                  crit.name = crit.name, Infos = Infos)) 

Modified: branches/distr-2.2/pkg/distrMod/chm/MCEstimator.html
===================================================================
--- branches/distr-2.2/pkg/distrMod/chm/MCEstimator.html	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/chm/MCEstimator.html	2009-07-17 17:24:03 UTC (rev 512)
@@ -30,7 +30,7 @@
 <pre>
 MCEstimator(x, ParamFamily, criterion, crit.name, 
             startPar = NULL, Infos, trafo = NULL, 
-            penalty = 0, validity.check = TRUE, asvar.fct, ...)
+            penalty = 1e20, validity.check = TRUE, asvar.fct, ...)
 </pre>
 
 

Modified: branches/distr-2.2/pkg/distrMod/chm/MDEstimator.html
===================================================================
--- branches/distr-2.2/pkg/distrMod/chm/MDEstimator.html	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/chm/MDEstimator.html	2009-07-17 17:24:03 UTC (rev 512)
@@ -26,7 +26,7 @@
 <pre>
 MDEstimator(x, ParamFamily, distance = KolmogorovDist, dist.name, 
             startPar = NULL,  Infos, trafo = NULL, 
-            penalty = 0, asvar.fct, ...)
+            penalty = 1e20, asvar.fct, ...)
 </pre>
 
 

Modified: branches/distr-2.2/pkg/distrMod/chm/MLEstimator.html
===================================================================
--- branches/distr-2.2/pkg/distrMod/chm/MLEstimator.html	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/chm/MLEstimator.html	2009-07-17 17:24:03 UTC (rev 512)
@@ -27,7 +27,7 @@
 
 <pre>
 MLEstimator(x, ParamFamily, startPar = NULL, 
-            Infos, trafo = NULL, penalty = 0, ...)
+            Infos, trafo = NULL, penalty = 1e20, ...)
 </pre>
 
 

Modified: branches/distr-2.2/pkg/distrMod/chm/asSemivar-class.html
===================================================================
--- branches/distr-2.2/pkg/distrMod/chm/asSemivar-class.html	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/chm/asSemivar-class.html	2009-07-17 17:24:03 UTC (rev 512)
@@ -42,6 +42,15 @@
 norm in which a multivariate parameter is considered</dd>
 </dl>
 
+<h3>Methods</h3>
+
+<dl>
+<dt>sign</dt><dd><code>signature(object = "asSemivar")</code>:
+accessor function for slot <code>sign</code>. </dd>
+<dt>sign&lt;-</dt><dd><code>signature(object = "asSemivar", value = "numeric")</code>:
+replacement function for slot <code>sign</code>. </dd>
+</dl>
+
 <h3>Extends</h3>
 
 <p>
@@ -52,13 +61,6 @@
 </p>
 
 
-<h3>Methods</h3>
-
-<p>
-No methods defined with class "asSemivar" in the signature.
-</p>
-
-
 <h3>Author(s)</h3>
 
 <p>

Modified: branches/distr-2.2/pkg/distrMod/chm/distrMod.chm
===================================================================
(Binary files differ)

Modified: branches/distr-2.2/pkg/distrMod/chm/distrMod.hhp
===================================================================
--- branches/distr-2.2/pkg/distrMod/chm/distrMod.hhp	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/chm/distrMod.hhp	2009-07-17 17:24:03 UTC (rev 512)
@@ -18,11 +18,6 @@
 BinomFamily.html
 CauchyLocationScaleFamily.html
 Confint-class.html
-DistrSymmList-class.html
-DistrSymmList.html
-DistributionSymmetry-class.html
-EllipticalSymmetry-class.html
-EllipticalSymmetry.html
 Estimate-class.html
 Estimator.html
 EvenSymmetric-class.html
@@ -51,8 +46,6 @@
 MCEstimator.html
 MDEstimator.html
 MLEstimator.html
-NoSymmetry-class.html
-NoSymmetry.html
 NonSymmetric-class.html
 NonSymmetric.html
 NormLocationFamily.html
@@ -69,16 +62,11 @@
 ParamFamily-class.html
 ParamFamily.html
 PoisFamily.html
-PosDefSymmMatrix-class.html
-PosDefSymmMatrix.html
 ProbFamily-class.html
 QFNorm.html
 QFnorm-class.html
 RiskType-class.html
 SelfNorm.html
-SphericalSymmetry-class.html
-SphericalSymmetry.html
-Symmetry-class.html
 asBias-class.html
 asBias.html
 asCov-class.html
@@ -124,8 +112,6 @@
 onesidedBias-class.html
 positiveBias.html
 print-methods.html
-solve-methods.html
-sqrt-methods.html
 symmetricBias-class.html
 symmetricBias.html
 trAsCov-class.html

Modified: branches/distr-2.2/pkg/distrMod/chm/mleCalc-methods.html
===================================================================
--- branches/distr-2.2/pkg/distrMod/chm/mleCalc-methods.html	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/chm/mleCalc-methods.html	2009-07-17 17:24:03 UTC (rev 512)
@@ -37,11 +37,11 @@
 mleCalc(x, PFam, ...)
 ## S4 method for signature 'numeric, ParamFamily':
 mceCalc(x, PFam, criterion, 
-                   startPar = NULL, penalty = 0, crit.name,
+                   startPar = NULL, penalty = 1e20, crit.name,
                    Infos = NULL, ...)
 ## S4 method for signature 'numeric, ParamFamily':
 mleCalc(x, PFam, startPar = NULL, 
-                   penalty = 0, Infos = NULL, ...)
+                   penalty = 1e20, Infos = NULL, ...)
 ## S4 method for signature 'numeric, BinomFamily':
 mleCalc(x, PFam, ...)
 ## S4 method for signature 'numeric, PoisFamily':

Modified: branches/distr-2.2/pkg/distrMod/man/MCEstimator.Rd
===================================================================
--- branches/distr-2.2/pkg/distrMod/man/MCEstimator.Rd	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/man/MCEstimator.Rd	2009-07-17 17:24:03 UTC (rev 512)
@@ -13,7 +13,7 @@
 \usage{
 MCEstimator(x, ParamFamily, criterion, crit.name, 
             startPar = NULL, Infos, trafo = NULL, 
-            penalty = 0, validity.check = TRUE, asvar.fct, ...)
+            penalty = 1e20, validity.check = TRUE, asvar.fct, ...)
 }
 \arguments{
   \item{x}{ (empirical) data }

Modified: branches/distr-2.2/pkg/distrMod/man/MDEstimator.Rd
===================================================================
--- branches/distr-2.2/pkg/distrMod/man/MDEstimator.Rd	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/man/MDEstimator.Rd	2009-07-17 17:24:03 UTC (rev 512)
@@ -9,7 +9,7 @@
 \usage{
 MDEstimator(x, ParamFamily, distance = KolmogorovDist, dist.name, 
             startPar = NULL,  Infos, trafo = NULL, 
-            penalty = 0, asvar.fct, ...)
+            penalty = 1e20, asvar.fct, ...)
 }
 %- maybe also 'usage' for other objects documented here.
 \arguments{

Modified: branches/distr-2.2/pkg/distrMod/man/MLEstimator.Rd
===================================================================
--- branches/distr-2.2/pkg/distrMod/man/MLEstimator.Rd	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/man/MLEstimator.Rd	2009-07-17 17:24:03 UTC (rev 512)
@@ -10,7 +10,7 @@
 }
 \usage{
 MLEstimator(x, ParamFamily, startPar = NULL, 
-            Infos, trafo = NULL, penalty = 0, ...)
+            Infos, trafo = NULL, penalty = 1e20, ...)
 }
 %- maybe also 'usage' for other objects documented here.
 \arguments{

Modified: branches/distr-2.2/pkg/distrMod/man/mleCalc-methods.Rd
===================================================================
--- branches/distr-2.2/pkg/distrMod/man/mleCalc-methods.Rd	2009-07-16 13:45:42 UTC (rev 511)
+++ branches/distr-2.2/pkg/distrMod/man/mleCalc-methods.Rd	2009-07-17 17:24:03 UTC (rev 512)
@@ -19,10 +19,10 @@
 mceCalc(x, PFam, ...)
 mleCalc(x, PFam, ...)
 \S4method{mceCalc}{numeric,ParamFamily}(x, PFam, criterion, 
-                   startPar = NULL, penalty = 0, crit.name,
+                   startPar = NULL, penalty = 1e20, crit.name,
                    Infos = NULL, \dots)
 \S4method{mleCalc}{numeric,ParamFamily}(x, PFam, startPar = NULL, 
-                   penalty = 0, Infos = NULL, \dots)
+                   penalty = 1e20, Infos = NULL, \dots)
 \S4method{mleCalc}{numeric,BinomFamily}(x, PFam, \dots)
 \S4method{mleCalc}{numeric,PoisFamily}(x, PFam, \dots)
 \S4method{mleCalc}{numeric,NormLocationFamily}(x, PFam, \dots)



More information about the Distr-commits mailing list