[Dream-commits] r40 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 18 10:45:43 CEST 2015


Author: josephguillaume
Date: 2015-05-18 10:45:42 +0200 (Mon, 18 May 2015)
New Revision: 40

Modified:
   pkg/R/dream.R
   pkg/R/handleBounds.R
Log:
Fix handleBounds rand

Modified: pkg/R/dream.R
===================================================================
--- pkg/R/dream.R	2012-09-13 01:35:17 UTC (rev 39)
+++ pkg/R/dream.R	2015-05-18 08:45:42 UTC (rev 40)
@@ -51,7 +51,7 @@
          eps = 5e-2,             ## Random error for ergodicity
          outlierTest = 'IQR_test', ## What kind of test to detect outlier chains?
          pCR.Update = TRUE,      ## Adaptive tuning of crossover values
-         boundHandling = 'reflect', ## Boundary handling: "reflect", "bound", "fold", "none"
+         boundHandling = 'reflect', ## Boundary handling: "reflect", "bound", "fold", "none","rand"
          burnin.length=0.1, ## Proportion of iterations considered to be burnin. 0 to turn off.
 ### Termination criteria. TODO: are the 2nd two valid, given that ndraw is used in adaptive pcr
          ndraw = 1e5,            ## maximum number of function evaluations
@@ -200,7 +200,7 @@
   ## Check validity of settings
   if (control$DEpairs==0) stop("control$DEpairs set to 0. Increase nseq?")
   stopifnot(control$DEpairs<=(control$nseq-1)/2) ## Requirement of offde
-  stopifnot(control$boundHandling %in% c("reflect", "bound", "fold", "none"))
+  stopifnot(control$boundHandling %in% c("reflect", "bound", "fold", "none","rand"))
   if (control$boundHandling == 'none') warning("No bound handling in use, parameters may cause errors elsewhere")
   stopifnot(control$REPORT>=0)
   if (control$parallel=="snow.chains"){

Modified: pkg/R/handleBounds.R
===================================================================
--- pkg/R/handleBounds.R	2012-09-13 01:35:17 UTC (rev 39)
+++ pkg/R/handleBounds.R	2015-05-18 08:45:42 UTC (rev 40)
@@ -34,7 +34,7 @@
            },
            none = x,
            rand = {
-             x[c(too.low,too.high),p] <- lower[p] +  runif(1)*(upper[p]-lower[p])
+             x[c(too.low,too.high),p] <- lower[p] +  runif(length(too.low)+length(too.high))*(upper[p]-lower[p])
            },
            stop("Unrecognised value of 'bound.handling'")
            )#switch



More information about the Dream-commits mailing list