[Distr-commits] r996 - in branches/distr-2.6/pkg/distrMod: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 18 14:34:25 CET 2015


Author: ruckdeschel
Date: 2015-02-18 14:34:24 +0100 (Wed, 18 Feb 2015)
New Revision: 996

Modified:
   branches/distr-2.6/pkg/distrMod/R/0distrModUtils.R
   branches/distr-2.6/pkg/distrMod/R/qqplot.R
   branches/distr-2.6/pkg/distrMod/R/returnlevelplot.R
   branches/distr-2.6/pkg/distrMod/inst/NEWS
   branches/distr-2.6/pkg/distrMod/man/internals-qqplot.Rd
   branches/distr-2.6/pkg/distrMod/man/qqplot.Rd
   branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd
Log:
[distrMod] helper .isReplicated gains argument tol to be able to identify observations from a continuous distribution "too" close to each other, hence requiring jittering; jittering uses this tolerance now and is available for continuous distributions, too.

Modified: branches/distr-2.6/pkg/distrMod/R/0distrModUtils.R
===================================================================
--- branches/distr-2.6/pkg/distrMod/R/0distrModUtils.R	2015-02-18 13:22:31 UTC (rev 995)
+++ branches/distr-2.6/pkg/distrMod/R/0distrModUtils.R	2015-02-18 13:34:24 UTC (rev 996)
@@ -610,10 +610,10 @@
   sapply(x, function(y) length(which(fct(y,gapm)))>0)
 }
 
-.isReplicated <- function(x){
+.isReplicated <- function(x, tol=.Machine$double.eps){
   tx <- table(x)
   rx <- as.numeric(names(tx[tx>1]))
-  sapply(x, function(y) any(abs(y-rx)<.Machine$double.eps))
+  sapply(x, function(y) any(abs(y-rx)<tol))
 }
 
 .NotInSupport <- function(x,D){

Modified: branches/distr-2.6/pkg/distrMod/R/qqplot.R
===================================================================
--- branches/distr-2.6/pkg/distrMod/R/qqplot.R	2015-02-18 13:22:31 UTC (rev 995)
+++ branches/distr-2.6/pkg/distrMod/R/qqplot.R	2015-02-18 13:34:24 UTC (rev 996)
@@ -22,7 +22,7 @@
           oN <- oN0[which.Order]
       x0 <- xys[oN,1]
       y0 <- xys[oN,2]
-
+      
       col.lbl <- col.lbl[rx]
       lab.pts <- lab.pts[rx]
       cex.lbl <- cex.lbl[rx]
@@ -82,6 +82,8 @@
              adj.lbl = NULL,      ## adj parameter for the plotted observation labels
              alpha.trsp = NA,     ## alpha transparency to be added afterwards
              jit.fac = 0,         ## jittering factor used for discrete distributions
+             jit.tol = .Machine$double.eps, ## tolerance for jittering: if distance 
+                                 #is smaller than jit.tol, points are considered replicates
              check.NotInSupport = TRUE, ## shall we check if all x lie in support(y)
              col.NotInSupport = "red", ## if preceding check TRUE color of x if not in support(y)
              with.legend = TRUE,  ## shall a legend be plotted
@@ -113,8 +115,8 @@
                             xcc))
                }else function(inx)inx
     xj <- x
-    if(any(.isReplicated(x)))
-       xj[.isReplicated(x)] <- jitter(x[.isReplicated(x)], factor=jit.fac)
+    if(any(.isReplicated(x, jit.tol))&&jit.fac>0)
+       xj[.isReplicated(x, jit.tol)] <- jitter(x[.isReplicated(x, jit.tol)], factor=jit.fac)
 
     ord.x <- order(xj)
 

Modified: branches/distr-2.6/pkg/distrMod/R/returnlevelplot.R
===================================================================
--- branches/distr-2.6/pkg/distrMod/R/returnlevelplot.R	2015-02-18 13:22:31 UTC (rev 995)
+++ branches/distr-2.6/pkg/distrMod/R/returnlevelplot.R	2015-02-18 13:34:24 UTC (rev 996)
@@ -57,6 +57,8 @@
              adj.lbl = NULL,      ## adj parameter for the plotted observation labels
              alpha.trsp = NA,     ## alpha transparency to be added afterwards
              jit.fac = 0,         ## jittering factor used for discrete distributions
+             jit.tol = .Machine$double.eps, ## tolerance for jittering: if distance 
+                                 #is smaller than jit.tol, points are considered replicates
              check.NotInSupport = TRUE, ## shall we check if all x lie in support(y)
              col.NotInSupport = "red", ## if preceding check TRUE color of x if not in support(y)
              with.legend = TRUE,  ## shall a legend be plotted
@@ -106,8 +108,8 @@
     }              
 
     xj <- sort(x)
-    if(any(.isReplicated(x))&&jit.fac>0)
-       xj[.isReplicated(x)] <- jitter(x[.isReplicated(x)], factor=jit.fac)
+    if(any(.isReplicated(x, jit.tol))&&jit.fac>0)
+       xj[.isReplicated(x, jit.tol)] <- jitter(x[.isReplicated(x, jit.tol)], factor=jit.fac)
 
     xj <- sort(xj)
     ord.x <- order(xj)

Modified: branches/distr-2.6/pkg/distrMod/inst/NEWS
===================================================================
--- branches/distr-2.6/pkg/distrMod/inst/NEWS	2015-02-18 13:22:31 UTC (rev 995)
+++ branches/distr-2.6/pkg/distrMod/inst/NEWS	2015-02-18 13:34:24 UTC (rev 996)
@@ -41,11 +41,15 @@
    * now by default has datax = TRUE
    * fixed issue with labeling
    * issues with datax fixed
+   * gains argument jit.tol to allow jittering to take place also for
+     continuous observations, if observations are "too" close to each other
 + returnlevelplot
    * similar as qqplot as to additional methods
    * returnlevelplot now gains an argument threshold for POT
    * set datax argument in case it is missing in returnlevelplot ...	  
    * issues with datax fixed
+   * gains argument jit.tol to allow jittering to take place also for
+     continuous observations, if observations are "too" close to each other
 + new internal method  .checkEstClassForParamFamily-method to be called 
   immediately before returning an Estimate object (in functions Estimator(), 
   MCEstimator(), MDEstimator(), MLEstimator()); this allows to return an
@@ -55,6 +59,7 @@
   "MCEstimate" and "GEVEstimate", so that a diag-method for 
   "GEVEstimate" becomes available for this class.
 + enhanced imports in DESCRIPTION by explicating second order imports
++ helper function .isReplicated gains an optional argument tol
 
   BUGFIXES:
 

Modified: branches/distr-2.6/pkg/distrMod/man/internals-qqplot.Rd
===================================================================
--- branches/distr-2.6/pkg/distrMod/man/internals-qqplot.Rd	2015-02-18 13:22:31 UTC (rev 995)
+++ branches/distr-2.6/pkg/distrMod/man/internals-qqplot.Rd	2015-02-18 13:34:24 UTC (rev 996)
@@ -26,8 +26,9 @@
 
 \details{
 \code{.labelprep} prepares the labels for later output:
-first we (optionally) select some indices among \code{x} according
-to \code{which.lbs}, then orders both \code{x} and \code{y} according to the
+first some indices among \code{x} according
+to \code{which.lbs} are (optionally) selected, 
+then orders both \code{x} and \code{y} according to the
 order of the remaining (optionally transformed by \code{order.traf}) values of
 \code{x} (decreasing); finally only the order statistics (w.r.t. the preceding
 ordering) as specified in \code{which.Order} are returned;

Modified: branches/distr-2.6/pkg/distrMod/man/qqplot.Rd
===================================================================
--- branches/distr-2.6/pkg/distrMod/man/qqplot.Rd	2015-02-18 13:22:31 UTC (rev 995)
+++ branches/distr-2.6/pkg/distrMod/man/qqplot.Rd	2015-02-18 13:34:24 UTC (rev 996)
@@ -10,7 +10,7 @@
     ylab = deparse(substitute(y)),
     ..., width = 10, height = 5.5, withSweave = getdistrOption("withSweave"),
     mfColRow = TRUE, n.CI = n, withLab = FALSE, lab.pts = NULL, which.lbs = NULL,
-    which.Order = NULL, order.traf = NULL,
+    which.Order = NULL, order.traf = NULL, 
     col.IdL = "red", lty.IdL = 2, lwd.IdL = 2, alpha.CI = .95,
     exact.pCI = (n<100), exact.sCI = (n<100), nosym.pCI = FALSE,
     col.pCI = "orange", lty.pCI = 3, lwd.pCI = 2, pch.pCI = par("pch"),
@@ -19,7 +19,7 @@
     cex.sCI = par("cex"), added.points.CI = TRUE,
     cex.pch = par("cex"), col.pch = par("col"),
     cex.lbl = par("cex"), col.lbl = par("col"), adj.lbl = NULL,
-    alpha.trsp = NA, jit.fac = 0,
+    alpha.trsp = NA, jit.fac = 0, jit.tol = .Machine$double.eps,
     check.NotInSupport = TRUE, col.NotInSupport = "red",
     with.legend = TRUE, legend.bg = "white",
     legend.pos = "topleft", legend.cex = 0.8, 
@@ -107,7 +107,9 @@
         while for the remaining ones, the alpha channel in rgb space is set
         to the respective coordinate value of \code{alpha.trsp}. The non-NA
         entries must be integers in [0,255] (0 invisible, 255 opaque).}
-\item{jit.fac}{jittering factor used for discrete distributions}
+\item{jit.fac}{jittering factor used for discrete distributions.}
+\item{jit.tol}{threshold for jittering: if distance between points is smaller
+               than \code{jit.tol}, points are considered replicates.}
 \item{check.NotInSupport}{logical; shall we check if all \code{x}-quantiles lie
 in \code{support(y)}?}
 \item{col.NotInSupport}{logical; if preceding check \code{TRUE} color of

Modified: branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd
===================================================================
--- branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd	2015-02-18 13:22:31 UTC (rev 995)
+++ branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd	2015-02-18 13:34:24 UTC (rev 996)
@@ -13,7 +13,7 @@
     main = "",
     ..., width = 10, height = 5.5, withSweave = getdistrOption("withSweave"),
     mfColRow = TRUE, n.CI = n, withLab = FALSE, lab.pts = NULL, which.lbs = NULL,
-    which.Order = NULL, order.traf = NULL,
+    which.Order = NULL, order.traf = NULL, 
     col.IdL = "red", lty.IdL = 2, lwd.IdL = 2, alpha.CI = .95,
     exact.pCI = (n<100), exact.sCI = (n<100), nosym.pCI = FALSE,
     col.pCI = "orange", lty.pCI = 3, lwd.pCI = 2, pch.pCI = par("pch"),
@@ -22,7 +22,7 @@
     cex.sCI = par("cex"), added.points.CI = TRUE,
     cex.pch = par("cex"), col.pch = par("col"),
     cex.lbl = par("cex"), col.lbl = par("col"), adj.lbl = NULL,
-    alpha.trsp = NA, jit.fac = 0,
+    alpha.trsp = NA, jit.fac = 0,  jit.tol = .Machine$double.eps,
     check.NotInSupport = TRUE, col.NotInSupport = "red",
     with.legend = TRUE, legend.bg = "white",
     legend.pos = "topleft", legend.cex = 0.8,
@@ -120,7 +120,9 @@
         while for the remaining ones, the alpha channel in rgb space is set
         to the respective coordinate value of \code{alpha.trsp}. The non-NA
         entries must be integers in [0,255] (0 invisible, 255 opaque).}
-\item{jit.fac}{jittering factor used for discrete distributions}
+\item{jit.fac}{jittering factor used for discrete distributions.}
+\item{jit.tol}{threshold for jittering: if distance between points is smaller
+               than \code{jit.tol}, points are considered replicates.}
 \item{check.NotInSupport}{logical; shall we check if all \code{x}-quantiles lie
 in \code{support(y)}?}
 \item{col.NotInSupport}{logical; if preceding check \code{TRUE} color of



More information about the Distr-commits mailing list