[Distr-commits] r156 - branches/distr-2.0/pkg/distrEx/R branches/distr-2.0/pkg/distrEx/man pkg/distrEx/R pkg/distrEx/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue May 20 13:49:45 CEST 2008


Author: ruckdeschel
Date: 2008-05-20 13:49:45 +0200 (Tue, 20 May 2008)
New Revision: 156

Modified:
   branches/distr-2.0/pkg/distrEx/R/ConvexContamination.R
   branches/distr-2.0/pkg/distrEx/man/ConvexContamination.Rd
   pkg/distrEx/R/ConvexContamination.R
   pkg/distrEx/man/ConvexContamination.Rd
Log:
in trunc & branches/distr-2.0:

distrEx: new ConvexContamination() for AcDcLcDistribution

Modified: branches/distr-2.0/pkg/distrEx/R/ConvexContamination.R
===================================================================
--- branches/distr-2.0/pkg/distrEx/R/ConvexContamination.R	2008-05-19 11:44:23 UTC (rev 155)
+++ branches/distr-2.0/pkg/distrEx/R/ConvexContamination.R	2008-05-20 11:49:45 UTC (rev 156)
@@ -210,3 +210,20 @@
         return(new("UnivariateDistribution", img = img(e1), r = rfun, d = NULL, 
                     p = pfun, q = qfun, .withSim = FALSE, .withArith = FALSE))
     })
+
+
+setMethod("ConvexContamination", signature(e1 = "AcDcLcDistribution",
+                                           e2 = "AcDcLcDistribution",
+                                           size = "numeric"),
+    function(e1, e2, size){
+        e1 <- as(e1, "UnivarLebDecDistribution")
+        e2 <- as(e2, "UnivarLebDecDistribution")
+
+        if(length(size) != 1)
+            stop("length of 'size' has to be 1")
+        if((size < 0)|(size > 1))
+            stop("'size' has to be in [0,1]")
+        
+        return(flat.mix(UnivarMixingDistribution(e1, e2, 
+                                    mixCoeff = c(1-size,size))))
+    })

Modified: branches/distr-2.0/pkg/distrEx/man/ConvexContamination.Rd
===================================================================
--- branches/distr-2.0/pkg/distrEx/man/ConvexContamination.Rd	2008-05-19 11:44:23 UTC (rev 155)
+++ branches/distr-2.0/pkg/distrEx/man/ConvexContamination.Rd	2008-05-20 11:49:45 UTC (rev 156)
@@ -5,6 +5,7 @@
 \alias{ConvexContamination,AbscontDistribution,AbscontDistribution,numeric-method}
 \alias{ConvexContamination,AbscontDistribution,UnivariateDistribution,numeric-method}
 \alias{ConvexContamination,DiscreteDistribution,DiscreteDistribution,numeric-method}
+\alias{ConvexContamination,AcDcLcDistribution,AcDcLcDistribution,numeric-method}
 
 \title{Generic Function for Generating Convex Contaminations}
 \description{Generic function for generating convex contaminations. This is also 
@@ -32,6 +33,10 @@
 
   \item{e1 = "DiscreteDistribution", e2 = "DiscreteDistribution", size = "numeric":}{
     convex combination of two discrete univariate distributions }
+
+  \item{e1 = "AcDcLcDistribution", e2 = "AcDcLcDistribution", size = "numeric":}{
+    convex combination of two univariate distributions which may be coerced to
+    \code{"UnivarLebDecDistribution"}.}
 }}
 \references{Huber, P.J. (1981) \emph{Robust Statistics}. New York: Wiley.}
 \author{Matthias Kohl \email{Matthias.Kohl at stamats.de}}

Modified: pkg/distrEx/R/ConvexContamination.R
===================================================================
--- pkg/distrEx/R/ConvexContamination.R	2008-05-19 11:44:23 UTC (rev 155)
+++ pkg/distrEx/R/ConvexContamination.R	2008-05-20 11:49:45 UTC (rev 156)
@@ -210,3 +210,20 @@
         return(new("UnivariateDistribution", img = img(e1), r = rfun, d = NULL, 
                     p = pfun, q = qfun, .withSim = FALSE, .withArith = FALSE))
     })
+
+
+setMethod("ConvexContamination", signature(e1 = "AcDcLcDistribution",
+                                           e2 = "AcDcLcDistribution",
+                                           size = "numeric"),
+    function(e1, e2, size){
+        e1 <- as(e1, "UnivarLebDecDistribution")
+        e2 <- as(e2, "UnivarLebDecDistribution")
+
+        if(length(size) != 1)
+            stop("length of 'size' has to be 1")
+        if((size < 0)|(size > 1))
+            stop("'size' has to be in [0,1]")
+        
+        return(flat.mix(UnivarMixingDistribution(e1, e2, 
+                                    mixCoeff = c(1-size,size))))
+    })

Modified: pkg/distrEx/man/ConvexContamination.Rd
===================================================================
--- pkg/distrEx/man/ConvexContamination.Rd	2008-05-19 11:44:23 UTC (rev 155)
+++ pkg/distrEx/man/ConvexContamination.Rd	2008-05-20 11:49:45 UTC (rev 156)
@@ -5,6 +5,7 @@
 \alias{ConvexContamination,AbscontDistribution,AbscontDistribution,numeric-method}
 \alias{ConvexContamination,AbscontDistribution,UnivariateDistribution,numeric-method}
 \alias{ConvexContamination,DiscreteDistribution,DiscreteDistribution,numeric-method}
+\alias{ConvexContamination,AcDcLcDistribution,AcDcLcDistribution,numeric-method}
 
 \title{Generic Function for Generating Convex Contaminations}
 \description{Generic function for generating convex contaminations. This is also 
@@ -32,6 +33,10 @@
 
   \item{e1 = "DiscreteDistribution", e2 = "DiscreteDistribution", size = "numeric":}{
     convex combination of two discrete univariate distributions }
+
+  \item{e1 = "AcDcLcDistribution", e2 = "AcDcLcDistribution", size = "numeric":}{
+    convex combination of two univariate distributions which may be coerced to
+    \code{"UnivarLebDecDistribution"}.}
 }}
 \references{Huber, P.J. (1981) \emph{Robust Statistics}. New York: Wiley.}
 \author{Matthias Kohl \email{Matthias.Kohl at stamats.de}}



More information about the Distr-commits mailing list