[Distr-commits] r380 - branches/distr-2.1/pkg/distr/R branches/distr-2.1/pkg/distr/chm pkg/distr/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 20 20:20:10 CET 2009


Author: ruckdeschel
Date: 2009-01-20 20:20:10 +0100 (Tue, 20 Jan 2009)
New Revision: 380

Modified:
   branches/distr-2.1/pkg/distr/R/UnivarMixingDistribution.R
   branches/distr-2.1/pkg/distr/chm/Distr.chm
   pkg/distr/R/UnivarMixingDistribution.R
Log:
fixed a bug in UnivarMixingDistribution.R (with new argument Dlist)

Modified: branches/distr-2.1/pkg/distr/R/UnivarMixingDistribution.R
===================================================================
--- branches/distr-2.1/pkg/distr/R/UnivarMixingDistribution.R	2009-01-20 18:45:20 UTC (rev 379)
+++ branches/distr-2.1/pkg/distr/R/UnivarMixingDistribution.R	2009-01-20 19:20:10 UTC (rev 380)
@@ -2,15 +2,13 @@
                                      withSimplify = getdistrOption("simplifyD"))
    {
     ldots <- list(...)
-    l <- length(ldots)
-    l0 <- 0
     if(!missing(Dlist)){
-        Dlist <- as(Dlist, "list")
-        if(!is(try(do.call(UnivarDistrList,args = Dlist),"try-error")))
-            ldots <- c(ldots, Dlist)
+        Dlist.L <- as(Dlist, "list")
+        if(!is(try(do.call(UnivarDistrList,args=Dlist.L),silent=TRUE),"try-error"))
+            ldots <- c(ldots, Dlist.L)
        }
-    l <- l + l0
-    mixDistr <- new("UnivarDistrList", ldots)
+    l <- length(ldots)
+    mixDistr <- do.call(UnivarDistrList,args=ldots)
     ep <- .Machine$double.eps
     if(missing(mixCoeff))
        mixCoeff <- rep(1,l)/l

Modified: branches/distr-2.1/pkg/distr/chm/Distr.chm
===================================================================
(Binary files differ)

Modified: pkg/distr/R/UnivarMixingDistribution.R
===================================================================
--- pkg/distr/R/UnivarMixingDistribution.R	2009-01-20 18:45:20 UTC (rev 379)
+++ pkg/distr/R/UnivarMixingDistribution.R	2009-01-20 19:20:10 UTC (rev 380)
@@ -2,14 +2,13 @@
                                      withSimplify = getdistrOption("simplifyD"))
    {
     ldots <- list(...)
-    l <- length(ldots)
-    l0 <- 0
     if(!missing(Dlist)){
-        Dlist <- as(Dlist, "list")
-        if(!is(try(do.call(UnivarDistrList,args = Dlist),"try-error")))
-            ldots <- c(ldots, Dlist)
+        Dlist.L <- as(Dlist, "list")
+        if(!is(try(do.call(UnivarDistrList,args=Dlist.L),silent=TRUE),"try-error"))
+            ldots <- c(ldots, Dlist.L)
        }
-    l <- l + l0
+    l <- length(ldots)
+    mixDistr <- do.call(UnivarDistrList,args=ldots)
     if(missing(mixCoeff))
        mixCoeff <- rep(1,l)/l
     else{ if (l!=length(mixCoeff))
@@ -26,6 +25,7 @@
     .withArith <- any(as.logical(lapply(mixDistr, function(x) x@".withArith")))
     .withSim   <- any(as.logical(lapply(mixDistr, function(x) x@".withSim")))
 
+    dnew <- NULL
     if (all( as.logical(lapply(mixDistr, function(x) is(x,"AbscontDistribution")))) ||
         all( as.logical(lapply(mixDistr, function(x) is(x,"DiscreteDistribution")))))
         dnew <- .dmixfun(mixDistr = mixDistr, mixCoeff = mixCoeff)
@@ -34,7 +34,7 @@
     qnew <- .qmixfun(mixDistr = mixDistr, mixCoeff = mixCoeff,
                      Cont = TRUE, pnew = pnew)
 
-    obj <- new("UnivarMixingDistribution", p = pnew, r = rnew, d = NULL, q = qnew,
+    obj <- new("UnivarMixingDistribution", p = pnew, r = rnew, d = dnew, q = qnew,
          mixCoeff = mixCoeff, mixDistr = mixDistr, .withSim = .withSim,
          .withArith = .withArith)
 



More information about the Distr-commits mailing list