[Distr-commits] r1277 - in branches/distr-2.8/pkg/distrEllipse: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 15 16:08:10 CEST 2018


Author: ruckdeschel
Date: 2018-08-15 16:08:10 +0200 (Wed, 15 Aug 2018)
New Revision: 1277

Modified:
   branches/distr-2.8/pkg/distrEllipse/R/MVMixingDistribution.R
   branches/distr-2.8/pkg/distrEllipse/inst/NEWS
Log:
[distrEllipse] branch 2.8
+ E methods for MultivarMixingDistribution gain argument diagnostic
  (like E()-methods in distrEx v 2.8.0)
+ E methods for MultivarMixingDistribution use filtering of dots arguments
  (like E()-methods in distrEx v 2.8.0)


Modified: branches/distr-2.8/pkg/distrEllipse/R/MVMixingDistribution.R
===================================================================
--- branches/distr-2.8/pkg/distrEllipse/R/MVMixingDistribution.R	2018-08-15 13:49:37 UTC (rev 1276)
+++ branches/distr-2.8/pkg/distrEllipse/R/MVMixingDistribution.R	2018-08-15 14:08:10 UTC (rev 1277)
@@ -125,26 +125,46 @@
 
 
 setMethod("E", signature(object = "MultivarMixingDistribution",
-                        fun = "missing", cond = "missing"), function(object, ...) {
+                        fun = "missing", cond = "missing"),
+                        function(object, ..., diagnostic=FALSE) {
              l <- length(object at mixCoeff)
-             res <- object at mixCoeff[1]*E(object=object at mixDistr[[1]], ...)
+             dotsI <- .filterEargs(list(...))
+             diagn <- vector("list",l)
+             res0 <- do.call(E, c(list(object=object at mixDistr[[1]], diagnostic=diagnostic), dotsI))
+             diagn[[1]] <- attr(res0,"diagnostic")
+             res <- object at mixCoeff[1]*res0
+             diagn[["call"]] <- match.call()
+             if(diagnostic) attr(res,"diagnostic") <- diagn
              if(l==1) return(res)
              for(i in 2:l){
-                 res0 <-  object at mixCoeff[i]*E(object=object at mixDistr[[i]], ...)
-                 res <- res + res0
+                 res0 <-  do.call(E, c(list(object=object at mixDistr[[i]], diagnostic=diagnostic), dotsI))
+                 diagn[[i]] <- attr(res0,"diagnostic")
+                 res <- res + object at mixCoeff[i]*res0
              }
+             if(diagnostic) attr(res,"diagnostic") <- diagn
              return(res)
            })
 setMethod("E", signature(object = "MultivarMixingDistribution",
                         fun = "function", cond = "missing"), 
-                        function(object, fun, ...) {
+                        function(object, fun, ..., diagnostic=FALSE) {
              l <- length(object at mixCoeff)
-             res <- object at mixCoeff[1]*E(object=object at mixDistr[[1]], fun=fun,...)
+             dots <- list(...)
+             dotsI <- .filterEargs(dots)
+             dotsFun <- .filterFunargs(dots,fun)
+             funwD <- function(x) do.call(fun, c(list(x), dotsFun))
+             diagn <- vector("list",l)
+             res0 <-  do.call(E, c(list(object=object at mixDistr[[1]], fun = funwD, diagnostic=diagnostic), dotsI))
+             diagn[[1]] <- attr(res0,"diagnostic")
+             res <- object at mixCoeff[1]*res0
+             diagn[["call"]] <- match.call()
+             if(diagnostic) attr(res,"diagnostic") <- diagn
              if(l==1) return(res)
              for(i in 2:l){
-                 res0 <-  object at mixCoeff[i]*E(object=object at mixDistr[[i]], fun=fun, ...)
-                 res <- res + res0
+                 res0 <-  do.call(E, c(list(object=object at mixDistr[[i]], fun = funwD, diagnostic=diagnostic), dotsI))
+                 diagn[[i]] <- attr(res0,"diagnostic")
+                 res <- res + object at mixCoeff[i]*res0
              }
+             if(diagnostic) attr(res,"diagnostic") <- diagn
              return(res)
            })
 

Modified: branches/distr-2.8/pkg/distrEllipse/inst/NEWS
===================================================================
--- branches/distr-2.8/pkg/distrEllipse/inst/NEWS	2018-08-15 13:49:37 UTC (rev 1276)
+++ branches/distr-2.8/pkg/distrEllipse/inst/NEWS	2018-08-15 14:08:10 UTC (rev 1277)
@@ -13,9 +13,13 @@
 
 user-visible CHANGES:
 + DESCRIPTION tag SVNRevision changed to VCS/SVNRevision
++ E methods for MultivarMixingDistribution gain argument diagnostic
+  (like E()-methods in distrEx v 2.8.0)
 
 under the hood:
 + now specified that we want to use distr::solve
++ E methods for MultivarMixingDistribution use filtering of dots arguments
+  (like E()-methods in distrEx v 2.8.0)
 
 ##############
 v 2.7



More information about the Distr-commits mailing list