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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 10 17:04:38 CEST 2014


Author: ruckdeschel
Date: 2014-08-10 17:04:38 +0200 (Sun, 10 Aug 2014)
New Revision: 953

Added:
   branches/distr-2.6/pkg/distrMod/R/checkEstClassForParamFamilyMethods.R
   branches/distr-2.6/pkg/distrMod/man/internal-methods.Rd
Modified:
   branches/distr-2.6/pkg/distrMod/NAMESPACE
   branches/distr-2.6/pkg/distrMod/R/AllGeneric.R
   branches/distr-2.6/pkg/distrMod/R/Estimator.R
   branches/distr-2.6/pkg/distrMod/R/MCEstimator.R
   branches/distr-2.6/pkg/distrMod/R/MDEstimator.R
   branches/distr-2.6/pkg/distrMod/R/MLEstimator.R
   branches/distr-2.6/pkg/distrMod/inst/NEWS
Log:
[distrMod] new internal method  .checkEstClassForParamFamily-method to be called 
  immediately before returning an Estimate object (in functions Estimator(), 
  MCEstimator(), MDEstimator(), MLEstimator()); this allows to return an
  object of S4 class specific to the resp. parametric family (by means of
  S4 method dispatch); this is used in pkg 'RobExtremes' to produce, e.g., 
  objects of class "GEVMCEstimate", i.e. which inherit from both "MCEstimate" 
  and "GEVEstimate", so that a diag-method for "GEVEstimate" becomes available 
  for this class.

... note: for some reason, when only an ANY, ANY-method is provided and this
is to be documented in an .Rd-File of docType "methods", we also need an alias
for ANY (i.e., with only one argument) --- do not understand this, but ...

Modified: branches/distr-2.6/pkg/distrMod/NAMESPACE
===================================================================
--- branches/distr-2.6/pkg/distrMod/NAMESPACE	2014-08-10 14:10:08 UTC (rev 952)
+++ branches/distr-2.6/pkg/distrMod/NAMESPACE	2014-08-10 15:04:38 UTC (rev 953)
@@ -60,7 +60,7 @@
 exportMethods("scaleshapename", "scalename", "LogDeriv")
 exportMethods("coerce", "profile", "locscalename", "scaleshapename<-")
 exportMethods("mleCalc", "mceCalc")
-exportMethods("qqplot", "returnlevelplot")
+exportMethods("qqplot", "returnlevelplot", ".checkEstClassForParamFamily")
 export("distrModMASK")
 export("trafoEst")
 export("distrModOptions", "distrModoptions", "getdistrModOption",

Modified: branches/distr-2.6/pkg/distrMod/R/AllGeneric.R
===================================================================
--- branches/distr-2.6/pkg/distrMod/R/AllGeneric.R	2014-08-10 14:10:08 UTC (rev 952)
+++ branches/distr-2.6/pkg/distrMod/R/AllGeneric.R	2014-08-10 15:04:38 UTC (rev 953)
@@ -290,3 +290,7 @@
 if(!isGeneric("returnlevelplot")){
     setGeneric("returnlevelplot", function(x, y, ...) standardGeneric("returnlevelplot"))
 }
+if(!isGeneric(".checkEstClassForParamFamily")){
+   setGeneric(".checkEstClassForParamFamily", function(PFam, estimator)
+               standardGeneric(".checkEstClassForParamFamily"))
+}
\ No newline at end of file

Modified: branches/distr-2.6/pkg/distrMod/R/Estimator.R
===================================================================
--- branches/distr-2.6/pkg/distrMod/R/Estimator.R	2014-08-10 14:10:08 UTC (rev 952)
+++ branches/distr-2.6/pkg/distrMod/R/Estimator.R	2014-08-10 15:04:38 UTC (rev 953)
@@ -144,5 +144,7 @@
   estimator at asvar <- asvar
   estimator at trafo <- list(fct = fct, mat = fctv$mat)
 
-  return(estimator)
+  return(.checkEstClassForParamFamily(ParamFamily,estimator))
 }
+
+

Modified: branches/distr-2.6/pkg/distrMod/R/MCEstimator.R
===================================================================
--- branches/distr-2.6/pkg/distrMod/R/MCEstimator.R	2014-08-10 14:10:08 UTC (rev 952)
+++ branches/distr-2.6/pkg/distrMod/R/MCEstimator.R	2014-08-10 15:04:38 UTC (rev 953)
@@ -58,5 +58,5 @@
     res <- do.call(.process.meCalcRes, argList)
     res at completecases <- completecases
     
-    return(res)
+    return(.checkEstClassForParamFamily(ParamFamily,res))
 }

Modified: branches/distr-2.6/pkg/distrMod/R/MDEstimator.R
===================================================================
--- branches/distr-2.6/pkg/distrMod/R/MDEstimator.R	2014-08-10 14:10:08 UTC (rev 952)
+++ branches/distr-2.6/pkg/distrMod/R/MDEstimator.R	2014-08-10 15:04:38 UTC (rev 953)
@@ -56,6 +56,6 @@
     res <- do.call(.process.meCalcRes, argList)
 
     res at completecases <- completecases
-    return(res)
+    return(.checkEstClassForParamFamily(ParamFamily,res))
 }
 

Modified: branches/distr-2.6/pkg/distrMod/R/MLEstimator.R
===================================================================
--- branches/distr-2.6/pkg/distrMod/R/MLEstimator.R	2014-08-10 14:10:08 UTC (rev 952)
+++ branches/distr-2.6/pkg/distrMod/R/MLEstimator.R	2014-08-10 15:04:38 UTC (rev 953)
@@ -57,5 +57,5 @@
     res at name <- "Maximum likelihood estimate"
     res at completecases <- completecases
     
-    return(res)
+    return(.checkEstClassForParamFamily(ParamFamily,res))
 }

Added: branches/distr-2.6/pkg/distrMod/R/checkEstClassForParamFamilyMethods.R
===================================================================
--- branches/distr-2.6/pkg/distrMod/R/checkEstClassForParamFamilyMethods.R	                        (rev 0)
+++ branches/distr-2.6/pkg/distrMod/R/checkEstClassForParamFamilyMethods.R	2014-08-10 15:04:38 UTC (rev 953)
@@ -0,0 +1,3 @@
+setMethod(".checkEstClassForParamFamily",
+              signature=signature(PFam="ANY",estimator="ANY"),
+              function(PFam, estimator) estimator)

Modified: branches/distr-2.6/pkg/distrMod/inst/NEWS
===================================================================
--- branches/distr-2.6/pkg/distrMod/inst/NEWS	2014-08-10 14:10:08 UTC (rev 952)
+++ branches/distr-2.6/pkg/distrMod/inst/NEWS	2014-08-10 15:04:38 UTC (rev 953)
@@ -30,9 +30,15 @@
      seen as "fitted" objects...)
 + returnlevelplot
    * similar 
-+ new  .checkEstClassForParamFamily-method to be able to cast an estimator
-  to a return class specific to the resp. parametric famil  
-  
++ new internal method  .checkEstClassForParamFamily-method to be called 
+  immediately before returning an Estimate object (in functions Estimator(), 
+  MCEstimator(), MDEstimator(), MLEstimator()); this allows to return an
+  object of S4 class specific to the resp. parametric family (by means of
+  S4 method dispatch); this is used in pkg 'RobExtremes' to produce, e.g., 
+  objects of class "GEVMCEstimate", i.e. which inherit from both 
+  "MCEstimate" and "GEVEstimate", so that a diag-method for 
+  "GEVEstimate" becomes available for this class.
+
   BUGFIXES:
 
 + fixed issue with slot withPosRestr in ParamFamParameter.R 

Added: branches/distr-2.6/pkg/distrMod/man/internal-methods.Rd
===================================================================
--- branches/distr-2.6/pkg/distrMod/man/internal-methods.Rd	                        (rev 0)
+++ branches/distr-2.6/pkg/distrMod/man/internal-methods.Rd	2014-08-10 15:04:38 UTC (rev 953)
@@ -0,0 +1,34 @@
+\name{.checkEstClassForParamFamily-methods}
+\docType{methods}
+\alias{.checkEstClassForParamFamily}
+\alias{.checkEstClassForParamFamily-methods}
+\alias{.checkEstClassForParamFamily,ANY-method}
+\alias{.checkEstClassForParamFamily,ANY,ANY-method}
+\title{ Methods for Function .checkEstClassForParamFamily in Package `distrMod' }
+
+\description{.checkEstClassForParamFamily-methods}
+
+\usage{
+.checkEstClassForParamFamily(PFam, estimator)
+\S4method{.checkEstClassForParamFamily}{ANY,ANY}(PFam, estimator)
+}
+
+\arguments{
+  \item{PFam}{a parametric family. }
+  \item{estimator}{an estimator. }
+  }
+
+\details{
+The respective methods can be used to cast an estimator to
+a model-specific subclass with particular methods.
+}
+
+\value{
+The (default) \code{ANY,ANY}-method returns the estimator unchanged.
+}
+\author{
+  Peter Ruckdeschel \email{Peter.Ruckdeschel at itwm.fraunhofer.de}
+  }
+
+\keyword{methods}
+



More information about the Distr-commits mailing list