[Distr-commits] r943 - in branches/distr-2.6/pkg/distr: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 24 18:24:27 CEST 2014


Author: ruckdeschel
Date: 2014-07-24 18:24:26 +0200 (Thu, 24 Jul 2014)
New Revision: 943

Modified:
   branches/distr-2.6/pkg/distr/R/qqbounds.R
   branches/distr-2.6/pkg/distr/R/setIsRelations.R
   branches/distr-2.6/pkg/distr/man/DiscreteDistribution-class.Rd
Log:
[distr] fixed an issue with casting AffLinDiscreteDistributions to LatticeDistributions (discovered by Kostas Oikonomou, ko at research.att.com )

Modified: branches/distr-2.6/pkg/distr/R/qqbounds.R
===================================================================
--- branches/distr-2.6/pkg/distr/R/qqbounds.R	2014-07-24 12:22:35 UTC (rev 942)
+++ branches/distr-2.6/pkg/distr/R/qqbounds.R	2014-07-24 16:24:26 UTC (rev 943)
@@ -26,7 +26,7 @@
      print(c(alpha,n,exact.sCI))
    }
    c.crit <- if(withConf.sim) try(.q2kolmogorov(alpha,n,exact.sCI), silent=TRUE) else NULL
-   c.crit.i <- if(withConf.pw) try(distr:::.q2pw(x.in,p.r,D,n,alpha,exact.pCI,nosym.pCI),silent=TRUE) else NULL
+   c.crit.i <- if(withConf.pw) try(.q2pw(x.in,p.r,D,n,alpha,exact.pCI,nosym.pCI),silent=TRUE) else NULL
    #print(cbind(c.crit,c.crit.i))
    if(debug){
       print(str(c.crit))

Modified: branches/distr-2.6/pkg/distr/R/setIsRelations.R
===================================================================
--- branches/distr-2.6/pkg/distr/R/setIsRelations.R	2014-07-24 12:22:35 UTC (rev 942)
+++ branches/distr-2.6/pkg/distr/R/setIsRelations.R	2014-07-24 16:24:26 UTC (rev 943)
@@ -55,6 +55,22 @@
                    slot(to, name = names(lst)[i]) <- lst[[i]]
               return(to)}
       })
+
+## if support is affine linear, a DiscreteDistribution is a LatticeDistribution
+setAs("AffLinDiscreteDistribution", "LatticeDistribution",
+      function(from){
+        if(!.is.vector.lattice(from at support))
+            return(from)
+        else{ to <- new("AffLinLatticeDistribution")
+              slotNames <- slotNames(from)
+              lst <- sapply(slotNames, function(x) slot(from,x))
+              names(lst) <- slotNames
+              lst$lattice <- .make.lattice.es.vector(from at support)
+              for (i in 1: length(lst))
+                   slot(to, name = names(lst)[i]) <- lst[[i]]
+              return(to)}
+      })
+
 #setIs("DiscreteDistribution", "LatticeDistribution",
 #      test = function(object) .is.vector.lattice(support(object)),
 #      coerce = function(from) 

Modified: branches/distr-2.6/pkg/distr/man/DiscreteDistribution-class.Rd
===================================================================
--- branches/distr-2.6/pkg/distr/man/DiscreteDistribution-class.Rd	2014-07-24 12:22:35 UTC (rev 942)
+++ branches/distr-2.6/pkg/distr/man/DiscreteDistribution-class.Rd	2014-07-24 16:24:26 UTC (rev 943)
@@ -6,6 +6,7 @@
 \alias{initialize,AffLinDiscreteDistribution-method}
 \alias{sqrt,DiscreteDistribution-method}
 \alias{coerce,DiscreteDistribution,LatticeDistribution-method}
+\alias{coerce,AffLinDiscreteDistribution,LatticeDistribution-method}
 
 \title{Class "DiscreteDistribution"}
 \description{The \code{DiscreteDistribution}-class is the mother-class of the class \code{LatticeDistribution}.}



More information about the Distr-commits mailing list