[Distr-commits] r1306 - branches/distr-2.9/pkg/distrEx/R branches/distr-2.9/pkg/distrEx/inst pkg/distrEx/R pkg/distrEx/inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 2 16:32:36 CET 2019


Author: ruckdeschel
Date: 2019-03-02 16:32:36 +0100 (Sat, 02 Mar 2019)
New Revision: 1306

Modified:
   branches/distr-2.9/pkg/distrEx/R/Expectation.R
   branches/distr-2.9/pkg/distrEx/R/GammaWeibullExpectation.R
   branches/distr-2.9/pkg/distrEx/inst/NEWS
   pkg/distrEx/R/Expectation.R
   pkg/distrEx/R/GammaWeibullExpectation.R
   pkg/distrEx/inst/NEWS
Log:
[distrEx] trunk and branch 2.9: fixed a (hard-to-detect) bug in .qtlIntegrate

Modified: branches/distr-2.9/pkg/distrEx/R/Expectation.R
===================================================================
--- branches/distr-2.9/pkg/distrEx/R/Expectation.R	2019-03-02 15:25:54 UTC (rev 1305)
+++ branches/distr-2.9/pkg/distrEx/R/Expectation.R	2019-03-02 15:32:36 UTC (rev 1306)
@@ -393,11 +393,7 @@
                          cond = "numeric"),
     function(object, fun, cond, withCond = FALSE, useApply = TRUE, 
              low = NULL, upp = NULL, Nsim = getdistrExOption("MCIterations"), ...){
-
-        dots <- list(...)
-        dotsFun <- .filterFunargs(dots, fun, neg=FALSE)
-        if("f1"%in% names(dots)) dotsFun[["f1"]] <- dots[["f1"]]
-
+        dotsFun <- .filterFunargs(list(...), fun, neg=FALSE)
         funwD <- function(x) do.call(fun,c(list(x),dotsFun))
         xsim <- r(object)(Nsim, cond)
         if(is.null(low)) low <- -Inf
@@ -427,11 +423,8 @@
              IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE){
 
         mc <- match.call()
+        dotsFun <- .filterFunargs(list(...), fun, neg=FALSE)
 
-        dots <- list(...)
-        dotsFun <- .filterFunargs(dots, fun, neg=FALSE)
-        if("f1"%in% names(dots)) dotsFun[["f1"]] <- dots[["f1"]]
-
         CondArg <- if(withCond) list(cond=cond) else NULL
         funwD <- function(x) do.call(fun,c(list(x), CondArg,dotsFun))
 
@@ -467,9 +460,7 @@
                          cond = "numeric"),
     function(object, fun, cond, withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL, ...){
 
-        dots <- list(...)
-        dotsFun <- .filterFunargs(dots, fun, neg=FALSE)
-        if("f1"%in% names(dots)) dotsFun[["f1"]] <- dots[["f1"]]
+        dotsFun <- .filterFunargs(list(...), fun, neg=FALSE)
 
         CondArg <- if(withCond) list(cond=cond) else NULL
         funwD <- function(x) do.call(fun,c(list(x), CondArg,dotsFun))

Modified: branches/distr-2.9/pkg/distrEx/R/GammaWeibullExpectation.R
===================================================================
--- branches/distr-2.9/pkg/distrEx/R/GammaWeibullExpectation.R	2019-03-02 15:25:54 UTC (rev 1305)
+++ branches/distr-2.9/pkg/distrEx/R/GammaWeibullExpectation.R	2019-03-02 15:32:36 UTC (rev 1306)
@@ -25,9 +25,8 @@
                                   if(useApply){
                                      funy <- sapply(y,funwD)
                                      dim(funy) <- dim(x)
-                                  }else funy <- fun(y)
+                                  }else funy <- funwD(y)
                                   return(funy) }
-         mc <- match.call()
 
          if(is.null(low)) low <- -Inf
          if(is.null(upp)) upp <- Inf

Modified: branches/distr-2.9/pkg/distrEx/inst/NEWS
===================================================================
--- branches/distr-2.9/pkg/distrEx/inst/NEWS	2019-03-02 15:25:54 UTC (rev 1305)
+++ branches/distr-2.9/pkg/distrEx/inst/NEWS	2019-03-02 15:32:36 UTC (rev 1306)
@@ -8,6 +8,13 @@
  information)
 
 ##############
+v 2.9
+##############
+
+user-visible CHANGES:
+under the hood:
+
+##############
 v 2.8
 ##############
 
@@ -62,8 +69,6 @@
 		i.e., in case of random variables, argument "cond" is suitably attached 
 		to argument "x" of the Map of the random variable -- something like c(x,cond)
 		
-       in expectation for signature(object = "...Distribution", fun = "function",  
-	            cond = "numeric"), we explicitely push through argument f1 through filtering
 
 + .qtlIntegrate now uses smaller values for args subdivisions and order 
    in case partitioning into left/middle/right is used: they are multiplied
@@ -74,6 +79,8 @@
          if(!.withRightTail && !.withLeftTail){fac.M <- 1.0}
    => so at order 5000 we come up with orders in L/M/R of 500 / 4000  / 500 
       instead of 5000 / 5000 / 5000    
++ fixed a bug in .qtlIntegrate: forgot to call funwD (instead of fun) in case useApply = FALSE
+
 + additional .AW-grid values into sysdata.rda for orders 
       50, 400, 800, 4000, 8000, 40000, 80000
   as these grid values are needed in the partitioned integration in 

Modified: pkg/distrEx/R/Expectation.R
===================================================================
--- pkg/distrEx/R/Expectation.R	2019-03-02 15:25:54 UTC (rev 1305)
+++ pkg/distrEx/R/Expectation.R	2019-03-02 15:32:36 UTC (rev 1306)
@@ -393,11 +393,7 @@
                          cond = "numeric"),
     function(object, fun, cond, withCond = FALSE, useApply = TRUE, 
              low = NULL, upp = NULL, Nsim = getdistrExOption("MCIterations"), ...){
-
-        dots <- list(...)
-        dotsFun <- .filterFunargs(dots, fun, neg=FALSE)
-        if("f1"%in% names(dots)) dotsFun[["f1"]] <- dots[["f1"]]
-
+        dotsFun <- .filterFunargs(list(...), fun, neg=FALSE)
         funwD <- function(x) do.call(fun,c(list(x),dotsFun))
         xsim <- r(object)(Nsim, cond)
         if(is.null(low)) low <- -Inf
@@ -427,11 +423,8 @@
              IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE){
 
         mc <- match.call()
+        dotsFun <- .filterFunargs(list(...), fun, neg=FALSE)
 
-        dots <- list(...)
-        dotsFun <- .filterFunargs(dots, fun, neg=FALSE)
-        if("f1"%in% names(dots)) dotsFun[["f1"]] <- dots[["f1"]]
-
         CondArg <- if(withCond) list(cond=cond) else NULL
         funwD <- function(x) do.call(fun,c(list(x), CondArg,dotsFun))
 
@@ -467,9 +460,7 @@
                          cond = "numeric"),
     function(object, fun, cond, withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL, ...){
 
-        dots <- list(...)
-        dotsFun <- .filterFunargs(dots, fun, neg=FALSE)
-        if("f1"%in% names(dots)) dotsFun[["f1"]] <- dots[["f1"]]
+        dotsFun <- .filterFunargs(list(...), fun, neg=FALSE)
 
         CondArg <- if(withCond) list(cond=cond) else NULL
         funwD <- function(x) do.call(fun,c(list(x), CondArg,dotsFun))

Modified: pkg/distrEx/R/GammaWeibullExpectation.R
===================================================================
--- pkg/distrEx/R/GammaWeibullExpectation.R	2019-03-02 15:25:54 UTC (rev 1305)
+++ pkg/distrEx/R/GammaWeibullExpectation.R	2019-03-02 15:32:36 UTC (rev 1306)
@@ -25,9 +25,8 @@
                                   if(useApply){
                                      funy <- sapply(y,funwD)
                                      dim(funy) <- dim(x)
-                                  }else funy <- fun(y)
+                                  }else funy <- funwD(y)
                                   return(funy) }
-         mc <- match.call()
 
          if(is.null(low)) low <- -Inf
          if(is.null(upp)) upp <- Inf

Modified: pkg/distrEx/inst/NEWS
===================================================================
--- pkg/distrEx/inst/NEWS	2019-03-02 15:25:54 UTC (rev 1305)
+++ pkg/distrEx/inst/NEWS	2019-03-02 15:32:36 UTC (rev 1306)
@@ -62,9 +62,6 @@
 		i.e., in case of random variables, argument "cond" is suitably attached 
 		to argument "x" of the Map of the random variable -- something like c(x,cond)
 		
-       in expectation for signature(object = "...Distribution", fun = "function",  
-	            cond = "numeric"), we explicitely push through argument f1 through filtering
-
 + .qtlIntegrate now uses smaller values for args subdivisions and order 
    in case partitioning into left/middle/right is used: they are multiplied
    by factors fac.L/fac.R/fac.M according to
@@ -73,7 +70,8 @@
          if(!.withRightTail &&  .withLeftTail){fac.L <- 0.2; fac.M <- 0.8}
          if(!.withRightTail && !.withLeftTail){fac.M <- 1.0}
    => so at order 5000 we come up with orders in L/M/R of 500 / 4000  / 500 
-      instead of 5000 / 5000 / 5000    
+      instead of 5000 / 5000 / 5000	  
++ fixed a bug in .qtlIntegrate: forgot to call funwD (instead of fun) in case useApply = FALSE
 + additional .AW-grid values into sysdata.rda for orders 
       50, 400, 800, 4000, 8000, 40000, 80000
   as these grid values are needed in the partitioned integration in 



More information about the Distr-commits mailing list