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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 20 19:30:48 CET 2009


Author: ruckdeschel
Date: 2009-01-20 19:30:48 +0100 (Tue, 20 Jan 2009)
New Revision: 378

Modified:
   branches/distr-2.1/pkg/distr/R/DiscreteDistribution.R
   branches/distr-2.1/pkg/distr/R/SimplifyD.R
   branches/distr-2.1/pkg/distr/R/UnivarMixingDistribution.R
   branches/distr-2.1/pkg/distr/R/internalUtils.R
   branches/distr-2.1/pkg/distr/R/internalUtils_LCD.R
   branches/distr-2.1/pkg/distr/chm/Distr.chm
   branches/distr-2.1/pkg/distr/chm/UnivarMixingDistribution.html
   branches/distr-2.1/pkg/distr/man/UnivarMixingDistribution.Rd
   pkg/distr/R/DiscreteDistribution.R
   pkg/distr/R/UnivarMixingDistribution.R
   pkg/distr/R/internalUtils.R
   pkg/distr/R/internalUtils_LCD.R
   pkg/distr/man/UnivarMixingDistribution.Rd
Log:
fixed some errors / made some enhancements
for univariate mixing distributions acc. to
mail by Krunoslav Sever <sever at hsuhh.de>

Modified: branches/distr-2.1/pkg/distr/R/DiscreteDistribution.R
===================================================================
--- branches/distr-2.1/pkg/distr/R/DiscreteDistribution.R	2009-01-19 13:16:43 UTC (rev 377)
+++ branches/distr-2.1/pkg/distr/R/DiscreteDistribution.R	2009-01-20 18:30:48 UTC (rev 378)
@@ -5,7 +5,7 @@
 ## (c) Matthias Kohl: revised P.R. 030707
 
 DiscreteDistribution <- function(supp, prob, .withArith = FALSE,
-     .withSim = FALSE){
+     .withSim = FALSE, .lowerExact = TRUE, .logExact = FALSE){
     if(!is.numeric(supp))
         stop("'supp' is no numeric vector")
     if(any(!is.finite(supp)))   # admit +/- Inf?
@@ -54,7 +54,8 @@
                       .withSim, min(supp), max(supp), Cont = FALSE)
 
     object <- new("DiscreteDistribution", r = rfun, d = dfun, q = qfun, p=pfun,
-         support = supp, .withArith = .withArith, .withSim = .withSim)
+         support = supp, .withArith = .withArith, .withSim = .withSim,
+         .lowerExact = .lowerExact, .logExact = .logExact)
 }
 
 
@@ -202,15 +203,15 @@
 
 setMethod("+", c("DiscreteDistribution","DiscreteDistribution"),
 function(e1,e2){
-            e1 <- as(e1, "LatticeDistribution")
-            e2 <- as(e2, "LatticeDistribution")
-            if(is(e1, "LatticeDistribution") & is(e2, "LatticeDistribution"))
-                {w1 <- width(lattice(e1))
-                 w2 <- width(lattice(e2))
+            e1.L <- as(e1, "LatticeDistribution")
+            e2.L <- as(e2, "LatticeDistribution")
+            if(is(e1.L, "LatticeDistribution") & is(e2.L, "LatticeDistribution"))
+                {w1 <- width(lattice(e1.L))
+                 w2 <- width(lattice(e2.L))
                  W <- sort(abs(c(w1,w2)))
                  if (abs(abs(w1)-abs(w2))<getdistrOption("DistrResolution") ||
                      W[2] %% W[1] < getdistrOption("DistrResolution") )
-                     return(e1 + e2)
+                     return(e1.L + e2.L)
                 } 
             convolutedsupport <- rep(support(e1), each = length(support(e2))) +
                                  support(e2)
@@ -352,7 +353,8 @@
 
             object <- new("DiscreteDistribution", r = rnew, p = pnew,
                            q = qnew, d = dnew, support = supportnew, 
-                           .withSim = x at .withSim, .withArith = TRUE)
+                           .withSim = x at .withSim, .withArith = TRUE,
+                           .lowerExact = x at .lowerExact)
             object
           })
 
@@ -419,4 +421,3 @@
             function(x) x^0.5)
 
 }          
-

Modified: branches/distr-2.1/pkg/distr/R/SimplifyD.R
===================================================================
--- branches/distr-2.1/pkg/distr/R/SimplifyD.R	2009-01-19 13:16:43 UTC (rev 377)
+++ branches/distr-2.1/pkg/distr/R/SimplifyD.R	2009-01-20 18:30:48 UTC (rev 378)
@@ -1,5 +1,7 @@
 setMethod("simplifyD", "UnivarMixingDistribution",
            function(object){
+                if(length(object at mixDistr)==1)
+                   return(object at mixDistr[[1]])
                 ep <- getdistrOption("TruncQuantile")
                 mixC.old <- mixCoeff(object)
                 if(any(mixC.old > (1 - ep)))

Modified: branches/distr-2.1/pkg/distr/R/UnivarMixingDistribution.R
===================================================================
--- branches/distr-2.1/pkg/distr/R/UnivarMixingDistribution.R	2009-01-19 13:16:43 UTC (rev 377)
+++ branches/distr-2.1/pkg/distr/R/UnivarMixingDistribution.R	2009-01-20 18:30:48 UTC (rev 378)
@@ -1,8 +1,16 @@
-UnivarMixingDistribution <- function(..., mixCoeff,
+UnivarMixingDistribution <- function(..., Dlist, mixCoeff,
                                      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)
+       }
+    l <- l + l0
+    mixDistr <- new("UnivarDistrList", ldots)
     ep <- .Machine$double.eps
     if(missing(mixCoeff))
        mixCoeff <- rep(1,l)/l
@@ -11,7 +19,6 @@
           if(any(mixCoeff < -ep) || sum(mixCoeff)>1+ep)
              stop("mixing coefficients are no probabilities")
         }
-    mixDistr <- new("UnivarDistrList", ldots)
     rnew <- .rmixfun(mixDistr = mixDistr, mixCoeff = mixCoeff)
 
     pnew <- .pmixfun(mixDistr = mixDistr, mixCoeff = mixCoeff)
@@ -48,4 +55,3 @@
 setMethod("mixDistr", "UnivarMixingDistribution", function(object)object at mixDistr)
 setReplaceMethod("mixDistr", "UnivarMixingDistribution", function(object,value){
    object at mixDistr<- value; object})
-

Modified: branches/distr-2.1/pkg/distr/R/internalUtils.R
===================================================================
--- branches/distr-2.1/pkg/distr/R/internalUtils.R	2009-01-19 13:16:43 UTC (rev 377)
+++ branches/distr-2.1/pkg/distr/R/internalUtils.R	2009-01-20 18:30:48 UTC (rev 378)
@@ -406,8 +406,7 @@
                               q = qnew, support = supportnew,
                               a = e1 at a, b = e1 at b + e2, X0 = e1 at X0,
                              .withSim = FALSE, .withArith = TRUE,
-                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1)
-                     )
+                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1))
                 rm(supportnew)
 
             }else if (Dclass == "DiscreteDistribution"){
@@ -416,8 +415,7 @@
                               q = qnew, support = supportnew,
                               a = 1, b = e2, X0 = e1,
                              .withSim = FALSE, .withArith = TRUE,
-                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1)
-                     )
+                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1))
                 rm(supportnew)
 
             }else if (Dclass == "AffLinAbscontDistribution"){
@@ -425,16 +423,14 @@
                               r = rnew, d = dnew, p = pnew, q = qnew, 
                               gaps = gapsnew, a = e1 at a, b = e1 at b + e2, 
                               X0 = e1 at X0, .withSim = FALSE, .withArith = TRUE,
-                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1)
-                     )
+                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1))
 
             }else if (Dclass == "AbscontDistribution"){  
                 object <- new("AffLinAbscontDistribution", r = rnew, 
                               d = dnew, p = pnew, q = qnew, gaps = gapsnew, 
                               a = 1, b = e2, X0 = e1, .withSim = FALSE, 
                               .withArith = TRUE,
-                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1)
-                     )
+                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1))
             }
             rm(pnew, qnew, dnew, rnew)
             object
@@ -466,7 +462,7 @@
                              if (!lower.tail) d0 <- -d0
                              p0 <- p0 + d0},
                              list(e2C = e2)
-                             )                            #
+                             )
 
                  dnew <- .makeD(substitute(e1, list(e1 = e1)),
                                 substitute(alist(x = x / e2), list(e2 = e2)))
@@ -480,8 +476,7 @@
                                q = qnew, support = supportnew,
                                a = e1 at a * e2, b = e2 * e1 at b, X0 = e1 at X0,                              
                               .withSim = FALSE, .withArith = TRUE,
-                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1)
-                     )
+                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1))
                  rm(supportnew)
 
             }else if (Dclass == "DiscreteDistribution"){
@@ -510,8 +505,7 @@
                                p = pnew, q = qnew, support = supportnew,
                                a = e2, b = 0, X0 = e1,                              
                               .withSim = FALSE, .withArith = TRUE,
-                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1)
-                     )
+                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1))
                  rm(supportnew)
 
             }else if (Dclass == "AffLinAbscontDistribution"){
@@ -533,8 +527,7 @@
                  object <- new(Dclass, r = rnew, d = dnew, p = pnew, q = qnew, 
                                gaps = gapsnew, a = e1 at a * e2, b = e2 * e1 at b, 
                                X0 = e1 at X0, .withSim = FALSE, .withArith = TRUE,
-                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1)
-                     )
+                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1))
  
             }else if (Dclass == "AbscontDistribution"){
                  if(is.null(e1 at gaps)) 
@@ -556,8 +549,7 @@
                                p = pnew, q = qnew, gaps = gapsnew, a = e2, 
                                b = 0, X0 = e1, .withSim = FALSE, 
                                .withArith = TRUE,
-                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1)
-                     )
+                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1))
             }
             rm(pnew, qnew, dnew, rnew)
             object
@@ -603,8 +595,6 @@
 }
 
 .makeQc <- function(x,y, yleft, yright){
-yl <- if(is.finite(yleft)) yleft  else y[1]
-yr <- if(is.finite(yright)) yright else y[length(y)]
 #f0 <- function(u) {
 #               q0 <- sapply(u, 
 #                       function(z) y[min(sum(x < z-.Machine$double.eps) + 1,
@@ -617,7 +607,17 @@
 #x0 <- x00[idx]               ### maximal x's
 #y0 <- y00[idx]
 #f1 <- approxfun(x = x0, y = y0, yleft = y0[1], yright = y0[length(y0)])
-f1 <- approxfun(x = x, y = y, yleft = yl, yright = yr)
+l0 <- length(unique(x[!.isEqual01(x)]))
+if(l0 > 1){
+   yl <- if(is.finite(yleft)) yleft  else y[1]
+   yr <- if(is.finite(yright)) yright else y[length(y)]
+
+   f1 <- approxfun(x = x, y = y, yleft = yl, yright = yr)
+}else{ 
+   i0 <- (1:length(x))[x==unique(x[!.isEqual01(x)])]
+   y0 <- if(l0 ==1) y[min(i0)] else yleft
+   f1 <- function(x) return(y0)
+}
 f <- function(x) 
    {y1 <- f1(x)
     y1[.isEqual(x,0)] <- yleft
@@ -765,9 +765,8 @@
                       Cont = TRUE){
   o.warn <- getOption("warn"); options(warn = -1)
   on.exit(options(warn=o.warn))
-  mfun <- if (Cont) .makeQc else
-          .makeQd
   ix <- .isEqual01(px.l)
+  mfun <- if (Cont) .makeQc else  .makeQd
   if(!is.finite(yR)||Cont)
      {xx <- px.l[!ix]; yy <- x[!ix]}
   else  
@@ -832,9 +831,8 @@
             object <- new("DiscreteDistribution",
                            r = rnew, d = dnew, p = pnew,
                            q = qnew, support = supportnew,
-                          .withSim = e1 at .withSim, .withArith = TRUE,
-                           .lowerExact = .lowerExact(e1),
-                           .logExact = .logExact(e1))
+                          .withSim = FALSE, .withArith = TRUE,
+                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1))
             rm(supportnew)
             rm(pnew, qnew, dnew, rnew)
             object
@@ -875,9 +873,8 @@
             object <- AbscontDistribution(
                            r = rnew, d = dnew, p = pnew,
                            q = qnew, gaps = gapsnew,
-                          .withSim = e1 at .withSim, .withArith = TRUE,
-                          .lowerExact = .lowerExact(e1),
-                          .logExact = .logExact(e1))
+                          .withSim = FALSE, .withArith = TRUE,
+                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1))
             rm(gapsnew)
             rm(pnew, qnew, dnew, rnew)
             object
@@ -899,9 +896,8 @@
             object <- new("DiscreteDistribution",
                            r = rnew, d = dnew, p = pnew,
                            q = qnew, support = supportnew,
-                          .withSim = e1 at .withSim, .withArith = TRUE,
-                          .lowerExact = .lowerExact(e1),
-                          .logExact = .logExact(e1))
+                          .withSim = FALSE, .withArith = TRUE,
+                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1))
             rm(supportnew)
             rm(pnew, qnew, dnew, rnew)
             object
@@ -923,11 +919,10 @@
             object <- AbscontDistribution(
                            r = rnew, d = dnew, p = pnew,
                            q = qnew, gaps = gapsnew,
-                           .withSim = e1 at .withSim, .withArith = TRUE,
-                           .lowerExact = .lowerExact(e1),
-                           .logExact = .logExact(e1))
-           if(exists("gapsnew")) rm(gapsnew)
-           rm(pnew, qnew, dnew, rnew)
+                          .withSim = FALSE, .withArith = TRUE,
+                    .logExact = .logExact(e1), .lowerExact = .lowerExact(e1))
+            if(exists("gapsnew")) rm(gapsnew)
+            rm(pnew, qnew, dnew, rnew)
             object
           }
 

Modified: branches/distr-2.1/pkg/distr/R/internalUtils_LCD.R
===================================================================
--- branches/distr-2.1/pkg/distr/R/internalUtils_LCD.R	2009-01-19 13:16:43 UTC (rev 377)
+++ branches/distr-2.1/pkg/distr/R/internalUtils_LCD.R	2009-01-20 18:30:48 UTC (rev 378)
@@ -130,14 +130,23 @@
   n <- getdistrOption("DefaultNrGridPoints")
   up <- min(loup$qu,1000)#getdistrOption("LARGE")
   lo <- max(loup$ql,-1000)#getdistrOption("LARGE")
+
   h <- (up-lo)/n
+  suppsA <- NULL
+  for (i in 1:l){
+    if(!is(try(su0 <- support(mixDistr[[i]]), silent=TRUE),"try-error"))
+       suppsA <- c(suppsA,su0)
+    }
 
-  xseq <- seq(from = lo, to = up, by = h)
+  xseq <- c(seq(from = lo, to = up, by = h),
+            suppsA,
+            suppsA-getdistrOption("DistrResolution"))
+  xseq <- sort(unique(xseq))          
 
   px.l <- pnew(xseq, lower.tail = TRUE)
   px.u <- pnew(xseq, lower.tail = FALSE)
 
-  return(.makeQNew(xseq, px.l, px.u, TRUE, loup$qL, loup$qU, Cont = Cont))
+  return(.makeQNew(xseq, px.l, px.u, TRUE, lo, up, Cont = Cont))
 }
 
 

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

Modified: branches/distr-2.1/pkg/distr/chm/UnivarMixingDistribution.html
===================================================================
--- branches/distr-2.1/pkg/distr/chm/UnivarMixingDistribution.html	2009-01-19 13:16:43 UTC (rev 377)
+++ branches/distr-2.1/pkg/distr/chm/UnivarMixingDistribution.html	2009-01-20 18:30:48 UTC (rev 378)
@@ -22,7 +22,7 @@
 
 <h3>Usage</h3>
 
-<pre>UnivarMixingDistribution(..., mixCoeff, 
+<pre>UnivarMixingDistribution(..., Dlist, mixCoeff, 
                                 withSimplify = getdistrOption("simplifyD"))</pre>
 
 
@@ -32,6 +32,13 @@
 <tr valign="top"><td><code>...</code></td>
 <td>
 Objects of class <code>"UnivariateDistribution"</code> (or subclasses)</td></tr>
+<tr valign="top"><td><code>Dlist</code></td>
+<td>
+an optional list or object of class <code>"UnivarDistrList"</code>;
+if not missing it is appended to argument <code>...</code>; this way 
+<code>UnivarMixingDistribution</code> may also be called with a list (or 
+<code>"UnivarDistrList"</code>-object) as argument as suggested in an e-mail
+by Krunoslav Sever (thank you!)</td></tr>
 <tr valign="top"><td><code>mixCoeff</code></td>
 <td>
 Objects of class <code>"numeric"</code> : a vector of 
@@ -83,6 +90,6 @@
 
 
 
-<hr><div align="center">[Package <em>distr</em> version 2.1 <a href="00Index.html">Index]</a></div>
+<hr><div align="center">[Package <em>distr</em> version 2.1 <a href="00Index.html">Index</a>]</div>
 
 </body></html>

Modified: branches/distr-2.1/pkg/distr/man/UnivarMixingDistribution.Rd
===================================================================
--- branches/distr-2.1/pkg/distr/man/UnivarMixingDistribution.Rd	2009-01-19 13:16:43 UTC (rev 377)
+++ branches/distr-2.1/pkg/distr/man/UnivarMixingDistribution.Rd	2009-01-20 18:30:48 UTC (rev 378)
@@ -3,10 +3,15 @@
 
 \title{Generating function for Class "UnivarMixingDistribution"}
 \description{Generates an object of class \code{"UnivarMixingDistribution"}.}
-\usage{UnivarMixingDistribution(..., mixCoeff, 
+\usage{UnivarMixingDistribution(..., Dlist, mixCoeff, 
                                 withSimplify = getdistrOption("simplifyD"))}
 \arguments{
   \item{\dots}{Objects of class \code{"UnivariateDistribution"} (or subclasses)}
+  \item{Dlist}{an optional list or object of class \code{"UnivarDistrList"};
+  if not missing it is appended to argument \code{\dots}; this way 
+  \code{UnivarMixingDistribution} may also be called with a list (or 
+  \code{"UnivarDistrList"}-object) as argument as suggested in an e-mail
+  by Krunoslav Sever (thank you!)}
   \item{mixCoeff}{Objects of class \code{"numeric"} : a vector of 
             probabilities for the mixing components (must be of same length as
             arguments in \dots).}

Modified: pkg/distr/R/DiscreteDistribution.R
===================================================================
--- pkg/distr/R/DiscreteDistribution.R	2009-01-19 13:16:43 UTC (rev 377)
+++ pkg/distr/R/DiscreteDistribution.R	2009-01-20 18:30:48 UTC (rev 378)
@@ -202,15 +202,15 @@
 
 setMethod("+", c("DiscreteDistribution","DiscreteDistribution"),
 function(e1,e2){
-            e1 <- as(e1, "LatticeDistribution")
-            e2 <- as(e2, "LatticeDistribution")
-            if(is(e1, "LatticeDistribution") & is(e2, "LatticeDistribution"))
-                {w1 <- width(lattice(e1))
-                 w2 <- width(lattice(e2))
+            e1.L <- as(e1, "LatticeDistribution")
+            e2.L <- as(e2, "LatticeDistribution")
+            if(is(e1.L, "LatticeDistribution") & is(e2.L, "LatticeDistribution"))
+                {w1 <- width(lattice(e1.L))
+                 w2 <- width(lattice(e2.L))
                  W <- sort(abs(c(w1,w2)))
                  if (abs(abs(w1)-abs(w2))<getdistrOption("DistrResolution") ||
                      W[2] %% W[1] < getdistrOption("DistrResolution") )
-                     return(e1 + e2)
+                     return(e1.L + e2.L)
                 } 
             convolutedsupport <- rep(support(e1), each = length(support(e2))) +
                                  support(e2)

Modified: pkg/distr/R/UnivarMixingDistribution.R
===================================================================
--- pkg/distr/R/UnivarMixingDistribution.R	2009-01-19 13:16:43 UTC (rev 377)
+++ pkg/distr/R/UnivarMixingDistribution.R	2009-01-20 18:30:48 UTC (rev 378)
@@ -1,8 +1,15 @@
-UnivarMixingDistribution <- function(..., mixCoeff,
+UnivarMixingDistribution <- function(..., Dlist, mixCoeff,
                                      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)
+       }
+    l <- l + l0
     if(missing(mixCoeff))
        mixCoeff <- rep(1,l)/l
     else{ if (l!=length(mixCoeff))

Modified: pkg/distr/R/internalUtils.R
===================================================================
--- pkg/distr/R/internalUtils.R	2009-01-19 13:16:43 UTC (rev 377)
+++ pkg/distr/R/internalUtils.R	2009-01-20 18:30:48 UTC (rev 378)
@@ -568,8 +568,6 @@
 }
 
 .makeQc <- function(x,y, yleft, yright){
-yl <- if(is.finite(yleft)) yleft  else y[1]
-yr <- if(is.finite(yright)) yright else y[length(y)]
 #f0 <- function(u) {
 #               q0 <- sapply(u, 
 #                       function(z) y[min(sum(x < z-.Machine$double.eps) + 1,
@@ -582,7 +580,17 @@
 #x0 <- x00[idx]               ### maximal x's
 #y0 <- y00[idx]
 #f1 <- approxfun(x = x0, y = y0, yleft = y0[1], yright = y0[length(y0)])
-f1 <- approxfun(x = x, y = y, yleft = yl, yright = yr)
+l0 <- length(unique(x[!.isEqual01(x)]))
+if(l0 > 1){
+   yl <- if(is.finite(yleft)) yleft  else y[1]
+   yr <- if(is.finite(yright)) yright else y[length(y)]
+
+   f1 <- approxfun(x = x, y = y, yleft = yl, yright = yr)
+}else{ 
+   i0 <- (1:length(x))[x==unique(x[!.isEqual01(x)])]
+   y0 <- if(l0 ==1) y[min(i0)] else yleft
+   f1 <- function(x) return(y0)
+}
 f <- function(x) 
    {y1 <- f1(x)
     y1[.isEqual(x,0)] <- yleft
@@ -730,9 +738,8 @@
                       Cont = TRUE){
   o.warn <- getOption("warn"); options(warn = -1)
   on.exit(options(warn=o.warn))
-  mfun <- if (Cont) .makeQc else
-          .makeQd
   ix <- .isEqual01(px.l)
+  mfun <- if (Cont) .makeQc else  .makeQd
   if(!is.finite(yR)||Cont)
      {xx <- px.l[!ix]; yy <- x[!ix]}
   else  

Modified: pkg/distr/R/internalUtils_LCD.R
===================================================================
--- pkg/distr/R/internalUtils_LCD.R	2009-01-19 13:16:43 UTC (rev 377)
+++ pkg/distr/R/internalUtils_LCD.R	2009-01-20 18:30:48 UTC (rev 378)
@@ -130,14 +130,25 @@
   n <- getdistrOption("DefaultNrGridPoints")
   up <- min(loup$qu,1000)#getdistrOption("LARGE")
   lo <- max(loup$ql,-1000)#getdistrOption("LARGE")
+
   h <- (up-lo)/n
+  suppsA <- NULL
+  for (i in 1:l){
+    if(!is(try(su0 <- support(mixDistr[[i]]), silent=TRUE),"try-error"))
+       suppsA <- c(suppsA,su0)
+    }
 
-  xseq <- seq(from = lo, to = up, by = h)
+  xseq <- c(lo-1,
+            seq(from = lo, to = up, by = h),
+            suppsA,
+            suppsA-getdistrOption("DistrResolution"),
+            up+1)
+  xseq <- sort(unique(xseq))          
 
   px.l <- pnew(xseq, lower.tail = TRUE)
   px.u <- pnew(xseq, lower.tail = FALSE)
 
-  return(.makeQNew(xseq, px.l, px.u, TRUE, loup$qL, loup$qU, Cont = Cont))
+  return(.makeQNew(xseq, px.l, px.u, TRUE, lo, up, Cont = Cont))
 }
 
 

Modified: pkg/distr/man/UnivarMixingDistribution.Rd
===================================================================
--- pkg/distr/man/UnivarMixingDistribution.Rd	2009-01-19 13:16:43 UTC (rev 377)
+++ pkg/distr/man/UnivarMixingDistribution.Rd	2009-01-20 18:30:48 UTC (rev 378)
@@ -3,10 +3,15 @@
 
 \title{Generating function for Class "UnivarMixingDistribution"}
 \description{Generates an object of class \code{"UnivarMixingDistribution"}.}
-\usage{UnivarMixingDistribution(..., mixCoeff, 
+\usage{UnivarMixingDistribution(..., Dlist, mixCoeff, 
                                 withSimplify = getdistrOption("simplifyD"))}
 \arguments{
   \item{\dots}{Objects of class \code{"UnivariateDistribution"} (or subclasses)}
+  \item{Dlist}{an optional list or object of class \code{"UnivarDistrList"};
+  if not missing it is appended to argument \code{\dots}; this way 
+  \code{UnivarMixingDistribution} may also be called with a list (or 
+  \code{"UnivarDistrList"}-object) as argument as suggested in an e-mail
+  by Krunoslav Sever (thank you!)}
   \item{mixCoeff}{Objects of class \code{"numeric"} : a vector of 
             probabilities for the mixing components (must be of same length as
             arguments in \dots).}



More information about the Distr-commits mailing list