[Distr-commits] r1252 - in branches/distr-2.8/pkg/distrMod: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Aug 6 04:10:36 CEST 2018


Author: ruckdeschel
Date: 2018-08-06 04:10:35 +0200 (Mon, 06 Aug 2018)
New Revision: 1252

Modified:
   branches/distr-2.8/pkg/distrMod/NAMESPACE
   branches/distr-2.8/pkg/distrMod/R/AllClass.R
   branches/distr-2.8/pkg/distrMod/R/MDEstimator.R
   branches/distr-2.8/pkg/distrMod/R/MLEstimator.R
   branches/distr-2.8/pkg/distrMod/R/internalMleCalc.R
   branches/distr-2.8/pkg/distrMod/inst/NEWS
   branches/distr-2.8/pkg/distrMod/man/MCEstimate-class.Rd
   branches/distr-2.8/pkg/distrMod/man/internalmleHelpers.Rd
Log:
[distrMod] branch 2.8
+ new subclasses "MLEstimate", "MDEstimate", "CvMMDEstimate" as return classes of the respective estimators for internal method dispatch  

Modified: branches/distr-2.8/pkg/distrMod/NAMESPACE
===================================================================
--- branches/distr-2.8/pkg/distrMod/NAMESPACE	2018-08-06 00:24:21 UTC (rev 1251)
+++ branches/distr-2.8/pkg/distrMod/NAMESPACE	2018-08-06 02:10:35 UTC (rev 1252)
@@ -39,7 +39,7 @@
        "LnormScaleFamily", "GammaFamily", "BetaFamily", "NormLocationScaleFamily",
        "CauchyLocationScaleFamily", "LogisticLocationScaleFamily")
 exportClasses("NormType", "QFNorm", "InfoNorm", "SelfNorm")
-exportClasses("Estimate", "MCEstimate")
+exportClasses("Estimate", "MCEstimate", "MLEstimate", "MDEstimate", "CvMMDEstimate")
 exportClasses("Confint")
 exportMethods("distrSymm")
 exportMethods("distribution", "props", "props<-", "addProp<-", "main", "main<-",

Modified: branches/distr-2.8/pkg/distrMod/R/AllClass.R
===================================================================
--- branches/distr-2.8/pkg/distrMod/R/AllClass.R	2018-08-06 00:24:21 UTC (rev 1251)
+++ branches/distr-2.8/pkg/distrMod/R/AllClass.R	2018-08-06 02:10:35 UTC (rev 1252)
@@ -488,6 +488,11 @@
                    ),
          contains = "Estimate")
 
+
+setClass("MLEstimate", contains="MCEstimate")
+setClass("MDEstimate", contains="MCEstimate")
+setClass("CvMMDEstimate", contains="MCEstimate")
+
 ## To Do: class MLEstimate which is compatible with class
 ## mle or maybe class summary.mle of package "stats4"
 

Modified: branches/distr-2.8/pkg/distrMod/R/MDEstimator.R
===================================================================
--- branches/distr-2.8/pkg/distrMod/R/MDEstimator.R	2018-08-06 00:24:21 UTC (rev 1251)
+++ branches/distr-2.8/pkg/distrMod/R/MDEstimator.R	2018-08-06 02:10:35 UTC (rev 1252)
@@ -46,6 +46,9 @@
        }
     }
 
+    toClass <- "MDEstimate"
+    if(distfc %in% c("CvMDist", "CvMDist2")) toClass <- "CvMMDEstimate"
+
     if(paramDepDist) dots$thetaPar <-NULL
 
     distanceFctWithoutVal <- function(e1,e2,check.validity=NULL,...)
@@ -79,6 +82,7 @@
        argList$validity.check <- TRUE
     argList <- c(argList, x = x)
     if(any(nmsffx!="")) argList <- c(argList, nmsffx = nmsffx)
+    argList$toClass <- toClass
 
     ## digesting the results of mceCalc
     res <- do.call(.process.meCalcRes, argList)

Modified: branches/distr-2.8/pkg/distrMod/R/MLEstimator.R
===================================================================
--- branches/distr-2.8/pkg/distrMod/R/MLEstimator.R	2018-08-06 00:24:21 UTC (rev 1251)
+++ branches/distr-2.8/pkg/distrMod/R/MLEstimator.R	2018-08-06 02:10:35 UTC (rev 1252)
@@ -51,6 +51,7 @@
     if(!is.null(dots))  argList <- c(argList, dots)
     argList <- c(argList, x = x)
     if(any(nmsffx!="")) argList <- c(argList, nmsffx = nmsffx)
+    argList$toClass <- "MLEstimate"
 
     ## digesting the results of mceCalc
     res <- do.call(what = ".process.meCalcRes", args = argList)

Modified: branches/distr-2.8/pkg/distrMod/R/internalMleCalc.R
===================================================================
--- branches/distr-2.8/pkg/distrMod/R/internalMleCalc.R	2018-08-06 00:24:21 UTC (rev 1251)
+++ branches/distr-2.8/pkg/distrMod/R/internalMleCalc.R	2018-08-06 02:10:35 UTC (rev 1252)
@@ -23,7 +23,7 @@
 #internal helper
 ##########################################################################
 .process.meCalcRes <- function(res, PFam, trafo, res.name, call,
-                               asvar.fct, check.validity, ...,
+                               asvar.fct, check.validity, ..., toClass = "",
                                .withEvalAsVar = TRUE, x = NULL, nmsffx = ""){
 
     lmx <- length(main(PFam))
@@ -139,7 +139,8 @@
     if(hasnodim.main & hasnodim.nuis)
         untransformed.estimate <- .deleteDim(untransformed.estimate)
 
-    res.me <- new("MCEstimate", name = est.name, estimate = estimate, 
+    if(missing(toClass)||toClass == "") toClass <- "MCEstimate"
+    res.me <- new(toClass, name = est.name, estimate = estimate,
                   criterion = crit, asvar = asvar, Infos = Infos, 
                   samplesize = res$samplesize, nuis.idx = nuis.idx, 
                   estimate.call = call, trafo = traf0,

Modified: branches/distr-2.8/pkg/distrMod/inst/NEWS
===================================================================
--- branches/distr-2.8/pkg/distrMod/inst/NEWS	2018-08-06 00:24:21 UTC (rev 1251)
+++ branches/distr-2.8/pkg/distrMod/inst/NEWS	2018-08-06 02:10:35 UTC (rev 1252)
@@ -81,7 +81,7 @@
   is appended to the default estimator name 
 + based on this tag "( mu = ... )" later on, in pkg RobAStBase, a (conditional) 
   coerce method produces the pIC of the MDE by means of .CvMMDCovariance[WithMux]
-  
++ new subclasses "MLEstimate", "MDEstimate", "CvMMDEstimate" for internal method dispatch  
 ##############
 v 2.7
 ##############

Modified: branches/distr-2.8/pkg/distrMod/man/MCEstimate-class.Rd
===================================================================
--- branches/distr-2.8/pkg/distrMod/man/MCEstimate-class.Rd	2018-08-06 00:24:21 UTC (rev 1251)
+++ branches/distr-2.8/pkg/distrMod/man/MCEstimate-class.Rd	2018-08-06 02:10:35 UTC (rev 1252)
@@ -1,6 +1,9 @@
 \name{MCEstimate-class}
 \docType{class}
 \alias{MCEstimate-class}
+\alias{MDEstimate-class}
+\alias{MLEstimate-class}
+\alias{CvMMDEstimate-class}
 \alias{criterion}
 \alias{criterion,MCEstimate-method}
 \alias{criterion.fct}
@@ -23,7 +26,12 @@
 \section{Objects from the Class}{
   Objects can be created by calls of the form \code{new("MCEstimate", ...)}.
   More frequently they are created via the generating functions
-  \code{MCEstimator}, \code{MDEstimator} or \code{MLEstimator}. 
+  \code{MCEstimator}, \code{MDEstimator} or \code{MLEstimator}.
+  More specifically, \code{MDEstimator}, \code{CvMMDEstimator},
+  and \code{MLEstimator} return objects of classes \code{MDEstimate},
+  \code{CvMMDEstimate}, and \code{MLEstimate} respectively, which each
+  are immediate subclasses of \code{MCEstimate} (without further slots,
+  for internal use in method dispatch).
 }
 \section{Slots}{
   \describe{

Modified: branches/distr-2.8/pkg/distrMod/man/internalmleHelpers.Rd
===================================================================
--- branches/distr-2.8/pkg/distrMod/man/internalmleHelpers.Rd	2018-08-06 00:24:21 UTC (rev 1251)
+++ branches/distr-2.8/pkg/distrMod/man/internalmleHelpers.Rd	2018-08-06 02:10:35 UTC (rev 1252)
@@ -15,7 +15,7 @@
 \usage{
 .negLoglikelihood(x, Distribution, ..., dropZeroDensity = TRUE)
 .process.meCalcRes(res, PFam, trafo, res.name, call, asvar.fct, check.validity,
-                   ..., .withEvalAsVar = TRUE, x = NULL, nmsffx = "")
+                   ..., toClass="", .withEvalAsVar = TRUE, x = NULL, nmsffx = "")
 .callParamFamParameter(PFam, theta, idx, nuis, fixed)
 }
 
@@ -48,6 +48,7 @@
      density zero be dropped? Optimizers like \code{optim} require finite
      values, so get problems when negative loglikelihood is evaluated. }
   \item{nmsffx}{character: a potential suffix to be appended to the estimator name.}
+  \item{toClass}{character: if not \code{""} the name of a more specific return class.}
 }
 
 \details{



More information about the Distr-commits mailing list