[Distr-commits] r1256 - in branches/distr-2.8/pkg/distrEx: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 8 01:47:41 CEST 2018


Author: ruckdeschel
Date: 2018-08-08 01:47:40 +0200 (Wed, 08 Aug 2018)
New Revision: 1256

Modified:
   branches/distr-2.8/pkg/distrEx/R/AllClass.R
   branches/distr-2.8/pkg/distrEx/R/DiscreteMVDistribution.R
   branches/distr-2.8/pkg/distrEx/R/liesInSupport.R
   branches/distr-2.8/pkg/distrEx/inst/NEWS
   branches/distr-2.8/pkg/distrEx/man/DiscreteMVDistribution-class.Rd
   branches/distr-2.8/pkg/distrEx/man/liesInSupport.Rd
Log:
[distrEx] branch 2.8:
+ DiscreteMVDistribution gains a (matrix valued) slot .FinSupport in analogy to the 
  univariate DiscreteDistribution (idea: coordinatewise checking whether a multivariate 
   observation could, in principle, lie in the support -- the 1st row states
   whether the ith marginal distribution has a finite left endpoint, and the
   2nd row if it is has a finite right endpoint); not yet further used
+ for consistency to the univariate methods, the liesInSupport() method for
  DiscreteMVDistribution gains an argument checkFin, which is not yet used.
  


Modified: branches/distr-2.8/pkg/distrEx/R/AllClass.R
===================================================================
--- branches/distr-2.8/pkg/distrEx/R/AllClass.R	2018-08-07 23:19:25 UTC (rev 1255)
+++ branches/distr-2.8/pkg/distrEx/R/AllClass.R	2018-08-07 23:47:40 UTC (rev 1256)
@@ -50,11 +50,12 @@
             contains = "Distribution")
 
 # discrete mulitvariate distribution
-setClass("DiscreteMVDistribution", representation(support = "matrix"),
+setClass("DiscreteMVDistribution", representation(support = "matrix", .finSupport = "matrix"),
             prototype(r = function(n){ matrix(rep(c(0,0), n), ncol=2) }, 
                       d = NULL, p = NULL, q = NULL, param = NULL,
                       img = new("EuclideanSpace", dimension = 2),
-                      support = matrix(c(0,0), ncol = 2)),
+                      support = matrix(c(0,0), ncol = 2),
+                      .finSupport = matrix(TRUE, nrow=2, ncol = 2)),
             contains = "MultivariateDistribution")
 
 # condition

Modified: branches/distr-2.8/pkg/distrEx/R/DiscreteMVDistribution.R
===================================================================
--- branches/distr-2.8/pkg/distrEx/R/DiscreteMVDistribution.R	2018-08-07 23:19:25 UTC (rev 1255)
+++ branches/distr-2.8/pkg/distrEx/R/DiscreteMVDistribution.R	2018-08-07 23:47:40 UTC (rev 1256)
@@ -77,7 +77,10 @@
         ind <- ind1 & ind2
         sum(prob[ind])
     }
-        
+
+    lB <- apply(supp,2,function(x) all(x> (-Inf)))
+    uB <- apply(supp,2,function(x) all(x< Inf))
+
     MVD <- new("DiscreteMVDistribution")
     MVD at r <- rfun
     MVD at d <- dfun
@@ -91,7 +94,8 @@
     MVD at .logExact <- TRUE 
     MVD at .lowerExact <- FALSE
     MVD at Symmetry <- Symmetry
-    
+    MVD at .finSupport <- rbind(lB,uB)
+
     return(MVD)
 }
 

Modified: branches/distr-2.8/pkg/distrEx/R/liesInSupport.R
===================================================================
--- branches/distr-2.8/pkg/distrEx/R/liesInSupport.R	2018-08-07 23:19:25 UTC (rev 1255)
+++ branches/distr-2.8/pkg/distrEx/R/liesInSupport.R	2018-08-07 23:47:40 UTC (rev 1256)
@@ -1,6 +1,6 @@
 setMethod("liesInSupport", signature(object = "DiscreteMVDistribution",
                                      x = "numeric"),
-    function(object, x){
+    function(object, x, checkFin = FALSE){
         k <- dimension(img(object))
         if(length(x) != k)
             stop("'x' has wrong dimension") 
@@ -11,12 +11,12 @@
     })
 setMethod("liesInSupport", signature(object = "DiscreteMVDistribution",
                                      x = "matrix"),
-    function(object, x){ 
+    function(object, x, checkFin = FALSE){
         if(ncol(x) != dimension(img(object)))
             stop("'x' has wrong dimension") 
 
         res <- logical(nrow(x))
-        for(i in 1:nrow(x)) res[i] <- liesInSupport(object, x[i,])
+        for(i in 1:nrow(x)) res[i] <- liesInSupport(object, x[i,], checkFin)
 
         return(res)
     })

Modified: branches/distr-2.8/pkg/distrEx/inst/NEWS
===================================================================
--- branches/distr-2.8/pkg/distrEx/inst/NEWS	2018-08-07 23:19:25 UTC (rev 1255)
+++ branches/distr-2.8/pkg/distrEx/inst/NEWS	2018-08-07 23:47:40 UTC (rev 1256)
@@ -22,6 +22,13 @@
 + cleaned .Rd file E.Rd: It contained still some references to methods
   for extreme value distributions which are now in RobExtremes
   and some old mail reference peter.ruckdeschel at uni-bayreuth.de
++ DiscreteMVDistribution gains a (matrix valued) slot .FinSupport in analogy to the 
+  univariate DiscreteDistribution (idea: coordinatewise checking whether a multivariate 
+   observation could, in principle, lie in the support -- the 1st row states
+   whether the ith marginal distribution has a finite left endpoint, and the
+   2nd row if it is has a finite right endpoint); not yet further used
++ for consistency to the univariate methods, the liesInSupport() method for
+  DiscreteMVDistribution gains an argument checkFin, which is not yet used.
   
 ##############
 v 2.7

Modified: branches/distr-2.8/pkg/distrEx/man/DiscreteMVDistribution-class.Rd
===================================================================
--- branches/distr-2.8/pkg/distrEx/man/DiscreteMVDistribution-class.Rd	2018-08-07 23:19:25 UTC (rev 1255)
+++ branches/distr-2.8/pkg/distrEx/man/DiscreteMVDistribution-class.Rd	2018-08-07 23:47:40 UTC (rev 1256)
@@ -27,6 +27,11 @@
       optional quantile function }
     \item{\code{support}}{ numeric matrix whose rows form the
       support of the distribution}
+    \item{\code{.finSupport}}{logical: (later on to be) used internally to check
+     whether the true support is finite; the element in the 1st row and ith column
+     indicates whether the ith marginal distribution has a finite left endpoint,
+     and the element in the  2nd row and ith column if it is has a finite right
+     endpoint); not yet further used.}
     \item{\code{.withArith}}{logical: used internally to issue warnings as to interpretation of arithmetics}
     \item{\code{.withSim}}{logical: used internally to issue warnings as to accuracy}
     \item{\code{.logExact}}{logical: used internally to flag the case where there are explicit formulae for the

Modified: branches/distr-2.8/pkg/distrEx/man/liesInSupport.Rd
===================================================================
--- branches/distr-2.8/pkg/distrEx/man/liesInSupport.Rd	2018-08-07 23:19:25 UTC (rev 1255)
+++ branches/distr-2.8/pkg/distrEx/man/liesInSupport.Rd	2018-08-07 23:47:40 UTC (rev 1256)
@@ -8,12 +8,16 @@
   distribution \code{object}.
 }
 \usage{
-\S4method{liesInSupport}{DiscreteMVDistribution,numeric}(object, x)
-\S4method{liesInSupport}{DiscreteMVDistribution,matrix}(object, x)
+\S4method{liesInSupport}{DiscreteMVDistribution,numeric}(object, x, checkFin = FALSE)
+\S4method{liesInSupport}{DiscreteMVDistribution,matrix}(object, x, checkFin = FALSE)
 }
 \arguments{
   \item{object}{ object of class \code{"Distribution"} }
   \item{x}{ numeric vector or matrix }
+  \item{checkFin}{ logical: in case \code{FALSE}, we simply check whether
+  \code{x} lies exactly in the \emph{numerical} support (of finitely many
+  support points); later on we might try to mimick the univariate case
+  more closely in case \code{TRUE}, but so far this is not yet used.}
 }
 %\details{}
 \value{logical vector}



More information about the Distr-commits mailing list