|
From: <gg...@us...> - 2008-09-16 07:45:38
|
Revision: 86
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=86&view=rev
Author: ggorjan
Date: 2008-09-16 07:45:46 +0000 (Tue, 16 Sep 2008)
Log Message:
-----------
temporary copy of model.file to a working.directory if it does not have txt extension; removing script.txt at the end of run if clearWD=TRUE
Modified Paths:
--------------
trunk/R2WinBUGS/R/bugs.R
trunk/R2WinBUGS/inst/NEWS
Modified: trunk/R2WinBUGS/R/bugs.R
===================================================================
--- trunk/R2WinBUGS/R/bugs.R 2008-02-01 09:42:28 UTC (rev 85)
+++ trunk/R2WinBUGS/R/bugs.R 2008-09-16 07:45:46 UTC (rev 86)
@@ -82,11 +82,11 @@
bugs.inits.files <- bugs.inits(inits, n.chains, digits)
}
-
if(DIC) parameters.to.save <- c(parameters.to.save, "deviance")
## Model files with extension ".bug" need to be renamed to ".txt"
- if(length(grep("[.]bug$", model.file))) {
- new.model.file <- sub("[.]bug$", ".txt", model.file)
+ if(!length(grep("\\.txt$", tolower(model.file)))) {
+ new.model.file <- paste(basename(model.file), ".txt", sep="")
+ if(!is.null(working.directory)) new.model.file <- file.path(working.directory, new.model.file)
file.copy(model.file, new.model.file, overwrite=TRUE)
on.exit(try(file.remove(new.model.file)), add=TRUE)
} else {
@@ -112,7 +112,7 @@
model.file=model.file, program=program)
if(clearWD) {
file.remove(c(bugs.data.file, "log.odc", "log.txt", "codaIndex.txt",
- bugs.inits.files,
+ bugs.inits.files, "script.txt",
paste("coda", 1:n.chains, ".txt", sep="")))
}
class(sims) <- "bugs"
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2008-02-01 09:42:28 UTC (rev 85)
+++ trunk/R2WinBUGS/inst/NEWS 2008-09-16 07:45:46 UTC (rev 86)
@@ -1,6 +1,13 @@
Changes to R2WinBUGS:
=====================
+Update 2.1-8?
+- File script.txt is also removed when clearWD=TRUE.
+
+- If model.file does not have a "txt" extension, then it is temporarily
+ copied to a file with "txt" extension in the working directory and
+ removed at the end of WinBUGS run.
+
Update 2.1-7
- this file is now available as NEWS file in top folder of installed package
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gg...@us...> - 2008-09-16 09:04:04
|
Revision: 87
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=87&view=rev
Author: ggorjan
Date: 2008-09-16 09:04:14 +0000 (Tue, 16 Sep 2008)
Log Message:
-----------
using temporary directory when working.directory=NULL
Modified Paths:
--------------
trunk/R2WinBUGS/R/bugs.R
trunk/R2WinBUGS/R/openbugs.R
trunk/R2WinBUGS/inst/NEWS
trunk/R2WinBUGS/man/bugs.Rd
Modified: trunk/R2WinBUGS/R/bugs.R
===================================================================
--- trunk/R2WinBUGS/R/bugs.R 2008-09-16 07:45:46 UTC (rev 86)
+++ trunk/R2WinBUGS/R/bugs.R 2008-09-16 09:04:14 UTC (rev 87)
@@ -11,6 +11,11 @@
newWINE=TRUE, WINEPATH=NULL, bugs.seed=NULL, summary.only=FALSE,
save.history=!summary.only)
{
+ if(!is.null(working.directory)) {
+ savedWD <- getwd()
+ setwd(working.directory)
+ on.exit(setwd(savedWD))
+ }
program <- match.arg(program)
if (missing(bugs.directory) &&
!is.null(bugs.dir <- getOption("R2WinBUGS.bugs.directory"))) { # requested by Jouni Kerman
@@ -23,7 +28,7 @@
n.chains, n.iter, n.burnin, n.thin, n.sims, DIC=DIC,
bugs.directory, working.directory, digits))
}
- ## Checking number of inits, which is NOT save here:
+ ## Checking number of inits, which is NOT saved here:
if(!missing(inits) && !is.function(inits) && !is.null(inits) && (length(inits) != n.chains))
stop("Number of initialized chains (length(inits)) != n.chains")
@@ -36,11 +41,15 @@
if(is.null(WINEPATH)) WINEPATH <- findUnixBinary(x="winepath")
}
- if(!is.null(working.directory)) {
- savedWD <- getwd()
- setwd(working.directory)
- on.exit(setwd(savedWD))
+ ## Move to working drirectory or temporary directory when NULL
+ if(is.null(working.directory)) {
+ working.directory <- tempdir()
}
+ savedWD <- getwd()
+ setwd(working.directory)
+ on.exit(setwd(savedWD))
+
+ ## model.file is not a file name but a model function
if(is.function(model.file)){
temp <- tempfile("model")
temp <-
Modified: trunk/R2WinBUGS/R/openbugs.R
===================================================================
--- trunk/R2WinBUGS/R/openbugs.R 2008-09-16 07:45:46 UTC (rev 86)
+++ trunk/R2WinBUGS/R/openbugs.R 2008-09-16 09:04:14 UTC (rev 87)
@@ -17,11 +17,15 @@
nThin <- n.thin
if(DIC) parameters.to.save <- c(parameters.to.save, "deviance")
parametersToSave <- parameters.to.save
- if(!is.null(working.directory)) {
- savedWD <- getwd()
- setwd(working.directory)
- on.exit(setwd(savedWD))
+
+ ## Move to working drirectory or temporary directory when NULL
+ if(is.null(working.directory)) {
+ working.directory <- tempdir()
}
+ savedWD <- getwd()
+ setwd(working.directory)
+ on.exit(setwd(savedWD))
+
if(!file.exists(modelFile)) {
stop(modelFile, " does not exist")
}
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2008-09-16 07:45:46 UTC (rev 86)
+++ trunk/R2WinBUGS/inst/NEWS 2008-09-16 09:04:14 UTC (rev 87)
@@ -2,13 +2,15 @@
=====================
Update 2.1-8?
+- If working.directory=NULL (the default setting), then a temporary
+ directory is used as a working directory to prevent overwriting/removing
+ the existing files.
- File script.txt is also removed when clearWD=TRUE.
-
- If model.file does not have a "txt" extension, then it is temporarily
- copied to a file with "txt" extension in the working directory and
- removed at the end of WinBUGS run.
+ copied to a file with "txt" extension in the working directory and
+ removed at the end of WinBUGS run.
-Update 2.1-7
+Update 2.1-7
- this file is now available as NEWS file in top folder of installed package
Update 2.1-6 (23 August 2007):
Modified: trunk/R2WinBUGS/man/bugs.Rd
===================================================================
--- trunk/R2WinBUGS/man/bugs.Rd 2008-09-16 07:45:46 UTC (rev 86)
+++ trunk/R2WinBUGS/man/bugs.Rd 2008-09-16 09:04:14 UTC (rev 87)
@@ -82,7 +82,8 @@
choice is not available in S-PLUS.}
\item{working.directory}{sets working directory during execution of
this function; \pkg{WinBUGS}' in- and output will be stored in this
- directory; if \code{NULL}, the current working directory is chosen.}
+ directory; if \code{NULL}, a temporary working directory via
+ \code{\link{tempdir}} is used.}
\item{clearWD}{logical; indicating whether the files \file{data.txt},
\file{inits[1:n.chains].txt}, \file{log.odc}, \file{codaIndex.txt},
and \file{coda[1:nchains].txt} should be removed after \pkg{WinBUGS} has
@@ -243,8 +244,7 @@
## also you need write access in the working directory:
schools.sim <- bugs(data, inits, parameters, model.file,
n.chains=3, n.iter=5000,
- bugs.directory="c:/Program Files/WinBUGS14/",
- working.directory=NULL, clearWD=TRUE)
+ bugs.directory="c:/Program Files/WinBUGS14/")
print(schools.sim)
plot(schools.sim)
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <li...@us...> - 2009-02-12 11:17:36
|
Revision: 100
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=100&view=rev
Author: ligges
Date: 2009-02-12 11:17:21 +0000 (Thu, 12 Feb 2009)
Log Message:
-----------
- bugfix: plot.bugs() did not reset par(mfrow)
- bugfix: adaptive phase stuff cannot be read anymore by openbugs(), files are no longer shipped, feature has been removed
- openbugs now displays messages before starting the sampling (essentially using flush.console())
Modified Paths:
--------------
trunk/R2WinBUGS/DESCRIPTION
trunk/R2WinBUGS/R/openbugs.R
trunk/R2WinBUGS/R/plot.bugs.R
trunk/R2WinBUGS/inst/NEWS
Modified: trunk/R2WinBUGS/DESCRIPTION
===================================================================
--- trunk/R2WinBUGS/DESCRIPTION 2009-02-02 14:30:50 UTC (rev 99)
+++ trunk/R2WinBUGS/DESCRIPTION 2009-02-12 11:17:21 UTC (rev 100)
@@ -1,7 +1,7 @@
Package: R2WinBUGS
Title: Running WinBUGS and OpenBUGS from R / S-PLUS
-Date: 2009-02-02
-Version: 2.1-11
+Date: 2009-02-11
+Version: 2.1-12
Author: originally written by Andrew Gelman <ge...@st...>;
changes and packaged by Sibylle Sturtz <st...@st...>
and Uwe Ligges <li...@st...>.
Modified: trunk/R2WinBUGS/R/openbugs.R
===================================================================
--- trunk/R2WinBUGS/R/openbugs.R 2009-02-02 14:30:50 UTC (rev 99)
+++ trunk/R2WinBUGS/R/openbugs.R 2009-02-12 11:17:21 UTC (rev 100)
@@ -57,13 +57,18 @@
}
BRugs::samplesSetThin(nThin)
## set the adaptive phases
- adaptivelines <- scan(system.file("OpenBUGS", "Bugs", "Rsrc",
- "Registry.txt", package="BRugs"),
- what="character", quiet = TRUE)
- factories <- sub(".adaptivePhase", "",
- adaptivelines[grep("adaptivePhase",adaptivelines)])
- sapply(factories, BRugs::modelSetAP, max(0, nBurnin-1))
+## We do no longer have any Registry.txt file availabe,
+## hence not resetting the adaptive phase any more.
+## People should move to BRugs directly.
+# adaptivelines <- scan(system.file("OpenBUGS", "Bugs", "Rsrc",
+# "Registry.txt", package="BRugs"),
+# what="character", quiet = TRUE)
+# factories <- sub(".adaptivePhase", "",
+# adaptivelines[grep("adaptivePhase",adaptivelines)])
+# sapply(factories, BRugs::modelSetAP, max(0, nBurnin-1))
+ cat("Start to sample ...\n")
+ flush.console()
BRugs::modelUpdate(nBurnin)
## BRugs::samplesSetThin(nThin)
if(DIC) {
Modified: trunk/R2WinBUGS/R/plot.bugs.R
===================================================================
--- trunk/R2WinBUGS/R/plot.bugs.R 2009-02-02 14:30:50 UTC (rev 99)
+++ trunk/R2WinBUGS/R/plot.bugs.R 2009-02-12 11:17:21 UTC (rev 100)
@@ -1,11 +1,12 @@
plot.bugs <- function (x, display.parallel = FALSE, ...){
mar.old <- par("mar")
pty.old <- par(pty = "m")
+ mfrow.old <- par("mfrow")
if (is.R())
- layout(matrix(c(1,2),1,2))
+ layout(matrix(c(1,2),1,2))
else
- par(mfrow = c(1,2))
-
+ par(mfrow = c(1,2))
+
bugs.plot.summary (x, ...)
bugs.plot.inferences (x, display.parallel, ...)
header <- ""
@@ -16,8 +17,8 @@
header <- paste(header, x$n.chains, " chains, each with ",
x$n.iter, " iterations (first ", x$n.burnin, " discarded)", sep = "")
mtext(header, outer = TRUE, line = -1, cex = 0.7)
- if (is.R()) par(pty = pty.old[[1]], mar = mar.old)
- else invisible(par(pty = pty.old[[1]], mar = mar.old))
+ if (is.R()) par(pty = pty.old[[1]], mar = mar.old, mfrow = mfrow.old)
+ else invisible(par(pty = pty.old[[1]], mar = mar.old, mfrow = mfrow.old))
}
if (!is.R()) {
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2009-02-02 14:30:50 UTC (rev 99)
+++ trunk/R2WinBUGS/inst/NEWS 2009-02-12 11:17:21 UTC (rev 100)
@@ -1,6 +1,14 @@
Changes to R2WinBUGS:
=====================
+Update 2.1-12
+- bugfix: plot.bugs() did not reset par(mfrow)
+- bugfix: adaptive phase stuff cannot read from files anymore by openbugs(),
+ feature has been removed
+- openbugs now displays messages before starting the sampling
+ (essentially using flush.console())
+
+
Update 2.1-11
- bugfix: if working.directory was unset and files are assumed to be in R's
former wd, these are copied to the tempdir that is set as new working
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <li...@us...> - 2009-02-12 12:26:25
|
Revision: 101
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=101&view=rev
Author: ligges
Date: 2009-02-12 12:26:22 +0000 (Thu, 12 Feb 2009)
Log Message:
-----------
as.mcmc.list.bugs method implemented (contributed by Mike Meredith)
Modified Paths:
--------------
trunk/R2WinBUGS/NAMESPACE
trunk/R2WinBUGS/R/bugs.sims.R
trunk/R2WinBUGS/man/bugs.Rd
Added Paths:
-----------
trunk/R2WinBUGS/R/as.mcmc.list.bugs.R
Modified: trunk/R2WinBUGS/NAMESPACE
===================================================================
--- trunk/R2WinBUGS/NAMESPACE 2009-02-12 11:17:21 UTC (rev 100)
+++ trunk/R2WinBUGS/NAMESPACE 2009-02-12 12:26:22 UTC (rev 101)
@@ -15,4 +15,4 @@
S3method(print, bugs)
S3method(plot, bugs)
-
+S3method(as.mcmc.list, bugs)
Added: trunk/R2WinBUGS/R/as.mcmc.list.bugs.R
===================================================================
--- trunk/R2WinBUGS/R/as.mcmc.list.bugs.R (rev 0)
+++ trunk/R2WinBUGS/R/as.mcmc.list.bugs.R 2009-02-12 12:26:22 UTC (rev 101)
@@ -0,0 +1,18 @@
+## Function as.mcmc.list.bugs contributed by Mike Meredith, 12 Feb 2009:
+as.mcmc.list.bugs <- function(x, ...) {
+ if(!inherits(x, "bugs"))
+ stop("Method as.mcmc.list.bugs() is only intended for bugs objects.")
+ if(dim(x$sims.array)[2] != x$n.chains)
+ stop("Inconsistancy in bug object regarding the number of chains.")
+ mclis <- vector("list", x$n.chains)
+ strt <- x$n.burnin%/%x$n.thin + 1
+ end <- x$n.iter%/%x$n.thin
+ ord <- order(dimnames(x$sims.array)[[3]])
+ if(end - strt + 1 < nrow(x$sims.array[,1,ord])) end <- end + 1
+ for(i in 1:x$n.chains) {
+ tmp1 <- x$sims.array[,i,ord]
+ rownames(tmp1) <- strt:end
+ mclis[[i]] <- mcmc(tmp1, strt, end, 1)
+ }
+ as.mcmc.list(mclis)
+}
Modified: trunk/R2WinBUGS/R/bugs.sims.R
===================================================================
--- trunk/R2WinBUGS/R/bugs.sims.R 2009-02-12 11:17:21 UTC (rev 100)
+++ trunk/R2WinBUGS/R/bugs.sims.R 2009-02-12 12:26:22 UTC (rev 101)
@@ -123,7 +123,7 @@
if(DIC) {
## Read DIC from BUGS log
LOG <- bugs.log("log.txt")$DIC
- if(any(is.na(LOG))) { ## Something went wrong --> Use Gelmans tweak
+ if(any(is.na(LOG))) { ## Something went wrong --> Use Gelman's tweak
deviance <- all$sims.array[, , dim(sims.array)[3], drop = FALSE]
if(!is.R()) dimnames(deviance) <- NULL
dim(deviance) <- dim(deviance)[1:2]
Modified: trunk/R2WinBUGS/man/bugs.Rd
===================================================================
--- trunk/R2WinBUGS/man/bugs.Rd 2009-02-12 11:17:21 UTC (rev 100)
+++ trunk/R2WinBUGS/man/bugs.Rd 2009-02-12 12:26:22 UTC (rev 101)
@@ -71,7 +71,10 @@
\item{codaPkg}{logical; if \code{FALSE} (default) a \code{bugs} object
is returned, if \code{TRUE} file names of \pkg{WinBUGS} output are
returned for easy access by the \pkg{coda} package through function
- \code{\link{read.bugs}} (not used if \code{program="OpenBUGS"}).}
+ \code{\link{read.bugs}} (not used if \code{program="OpenBUGS"}).
+ A \code{bugs} object can be converted to an \code{mcmc.list} object as
+ used by the \pkg{coda} package with the method \code{\link[coda]{as.mcmc.list}}
+ (for which a method is provided by R2WinBUGS).}
\item{bugs.directory}{directory that contains the \pkg{WinBUGS} executable.
If the global option \code{R2WinBUGS.bugs.directory} is not \code{NULL},
it will be used as the default.}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <li...@us...> - 2009-02-12 18:51:55
|
Revision: 103
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=103&view=rev
Author: ligges
Date: 2009-02-12 18:51:52 +0000 (Thu, 12 Feb 2009)
Log Message:
-----------
let openbugs work in the temporary directory as well, and update the docs
Modified Paths:
--------------
trunk/R2WinBUGS/R/bugs.R
trunk/R2WinBUGS/R/openbugs.R
trunk/R2WinBUGS/man/openbugs.Rd
Modified: trunk/R2WinBUGS/R/bugs.R
===================================================================
--- trunk/R2WinBUGS/R/bugs.R 2009-02-12 12:28:59 UTC (rev 102)
+++ trunk/R2WinBUGS/R/bugs.R 2009-02-12 18:51:52 UTC (rev 103)
@@ -80,7 +80,7 @@
(regexpr("\\.txt$", data) > 0))) {
bugs.data.file <- bugs.data(data, dir = getwd(), digits)
} else {
- if(inTempDir && basename(data) == data)
+ if(inTempDir && all(basename(data) == data))
try(file.copy(file.path(savedWD, data), data, overwrite = TRUE))
if(!file.exists(data))
stop("File", data, "does not exist.")
Modified: trunk/R2WinBUGS/R/openbugs.R
===================================================================
--- trunk/R2WinBUGS/R/openbugs.R 2009-02-12 12:28:59 UTC (rev 102)
+++ trunk/R2WinBUGS/R/openbugs.R 2009-02-12 18:51:52 UTC (rev 103)
@@ -21,11 +21,14 @@
## Move to working drirectory or temporary directory when NULL
if(is.null(working.directory)) {
working.directory <- tempdir()
+ inTempDir <- TRUE
}
savedWD <- getwd()
setwd(working.directory)
on.exit(setwd(savedWD))
+ if(inTempDir && basename(model.file) == model.file)
+ try(file.copy(file.path(savedWD, model.file), model.file, overwrite = TRUE))
if(!file.exists(modelFile)) {
stop(modelFile, " does not exist")
}
@@ -42,6 +45,8 @@
if(!(is.vector(data) && is.character(data) && all(file.exists(data)))) {
data <- BRugs::bugsData(data, digits = digits)
}
+ if(inTempDir && all(basename(data) == data))
+ try(file.copy(file.path(savedWD, data), data, overwrite = TRUE))
BRugs::modelData(data)
BRugs::modelCompile(numChains)
if(missing(inits) || is.null(inits)) {
@@ -52,6 +57,8 @@
inits <- BRugs::bugsInits(inits = inits, numChains = numChains,
digits = digits)
}
+ if(inTempDir && all(basename(inits) == inits))
+ try(file.copy(file.path(savedWD, inits), inits, overwrite = TRUE))
BRugs::modelInits(inits)
BRugs::modelGenInits()
}
@@ -67,8 +74,10 @@
# factories <- sub(".adaptivePhase", "",
# adaptivelines[grep("adaptivePhase",adaptivelines)])
# sapply(factories, BRugs::modelSetAP, max(0, nBurnin-1))
- cat("Start to sample ...\n")
- flush.console()
+ if(getOption("BRugsVerbose")){
+ cat("Sampling has been started ...\n")
+ flush.console()
+ }
BRugs::modelUpdate(nBurnin)
## BRugs::samplesSetThin(nThin)
if(DIC) {
Modified: trunk/R2WinBUGS/man/openbugs.Rd
===================================================================
--- trunk/R2WinBUGS/man/openbugs.Rd 2009-02-12 12:28:59 UTC (rev 102)
+++ trunk/R2WinBUGS/man/openbugs.Rd 2009-02-12 18:51:52 UTC (rev 103)
@@ -55,7 +55,8 @@
- currently unused}
\item{working.directory}{sets working directory during execution of
this function; \pkg{WinBUGS} in- and output will be stored in this
- directory; if \code{NULL}, the current working directory is chosen.}
+ directory; if \code{NULL}, a temporary working directory via
+ \code{\link{tempdir}} is used.}
}
@@ -68,7 +69,7 @@
}
\note{By default, BRugs (and hence \code{openbugs()}) is quite verbose.
- This can be controlled for the whole BRugs package by by the option \sQuote{BRugsVerbose} (see \code{\link{options}})
+ This can be controlled for the whole BRugs package by the option \sQuote{BRugsVerbose} (see \code{\link{options}})
which is set to \code{TRUE} by default.
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gg...@us...> - 2009-07-13 11:14:22
|
Revision: 116
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=116&view=rev
Author: ggorjan
Date: 2009-07-13 11:14:17 +0000 (Mon, 13 Jul 2009)
Log Message:
-----------
Added seed argument to openbugs()
Modified Paths:
--------------
trunk/R2WinBUGS/DESCRIPTION
trunk/R2WinBUGS/R/bugs.R
trunk/R2WinBUGS/R/openbugs.R
trunk/R2WinBUGS/inst/NEWS
trunk/R2WinBUGS/man/openbugs.Rd
Modified: trunk/R2WinBUGS/DESCRIPTION
===================================================================
--- trunk/R2WinBUGS/DESCRIPTION 2009-07-13 10:16:15 UTC (rev 115)
+++ trunk/R2WinBUGS/DESCRIPTION 2009-07-13 11:14:17 UTC (rev 116)
@@ -1,7 +1,7 @@
Package: R2WinBUGS
Title: Running WinBUGS and OpenBUGS from R / S-PLUS
Date: 2009-04-05
-Version: 2.1-14
+Version: 2.1-15
Author: originally written by Andrew Gelman <ge...@st...>;
changes and packaged by Sibylle Sturtz <st...@st...>
and Uwe Ligges <li...@st...>.
Modified: trunk/R2WinBUGS/R/bugs.R
===================================================================
--- trunk/R2WinBUGS/R/bugs.R 2009-07-13 10:16:15 UTC (rev 115)
+++ trunk/R2WinBUGS/R/bugs.R 2009-07-13 11:14:17 UTC (rev 116)
@@ -26,7 +26,7 @@
## If OpenBUGS, we only call openbugs() and exit...
return(openbugs(data, inits, parameters.to.save, model.file,
n.chains, n.iter, n.burnin, n.thin, n.sims, DIC=DIC,
- bugs.directory, working.directory, digits, over.relax = over.relax))
+ bugs.directory, working.directory, digits, over.relax = over.relax, seed=bugs.seed))
}
## Checking number of inits, which is NOT saved here:
if(!missing(inits) && !is.function(inits) && !is.null(inits) && (length(inits) != n.chains))
Modified: trunk/R2WinBUGS/R/openbugs.R
===================================================================
--- trunk/R2WinBUGS/R/openbugs.R 2009-07-13 10:16:15 UTC (rev 115)
+++ trunk/R2WinBUGS/R/openbugs.R 2009-07-13 11:14:17 UTC (rev 116)
@@ -2,7 +2,7 @@
n.chains = 3, n.iter = 2000, n.burnin = floor(n.iter/2),
n.thin = max(1, floor(n.chains *(n.iter - n.burnin) / n.sims)), n.sims = 1000,
DIC = TRUE, bugs.directory = "c:/Program Files/OpenBUGS/",
- working.directory=NULL, digits = 5, over.relax = FALSE)
+ working.directory=NULL, digits = 5, over.relax = FALSE, seed=NULL)
{
if(!is.R())
stop("OpenBUGS is not yet available in S-PLUS")
@@ -49,6 +49,7 @@
try(file.copy(file.path(savedWD, data), data, overwrite = TRUE))
BRugs::modelData(data)
BRugs::modelCompile(numChains)
+ if(!is.null(seed)) BRugs::modelSetSeed(newSeed=seed)
if(missing(inits) || is.null(inits)) {
BRugs::modelGenInits()
} else {
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2009-07-13 10:16:15 UTC (rev 115)
+++ trunk/R2WinBUGS/inst/NEWS 2009-07-13 11:14:17 UTC (rev 116)
@@ -1,6 +1,9 @@
Changes to R2WinBUGS:
=====================
+Update 2.1-15
+- added seed argument to openbugs()
+
Update 2.1-14
- new argument over.relax=FALSE
Modified: trunk/R2WinBUGS/man/openbugs.Rd
===================================================================
--- trunk/R2WinBUGS/man/openbugs.Rd 2009-07-13 10:16:15 UTC (rev 115)
+++ trunk/R2WinBUGS/man/openbugs.Rd 2009-07-13 11:14:17 UTC (rev 116)
@@ -13,7 +13,7 @@
n.thin = max(1, floor(n.chains * (n.iter - n.burnin) / n.sims)),
n.sims = 1000, DIC = TRUE,
bugs.directory = "c:/Program Files/OpenBUGS/",
- working.directory = NULL, digits = 5, over.relax = FALSE)
+ working.directory = NULL, digits = 5, over.relax = FALSE, seed=NULL)
}
\arguments{
@@ -58,6 +58,7 @@
directory; if \code{NULL}, a temporary working directory via
\code{\link{tempdir}} is used.}
\item{over.relax}{If \code{TRUE}, over-relaxed form of MCMC is used if available from OpenBUGS.}
+ \item{seed}{random seed (default is no seed)}
}
\value{A \code{\link{bugs}} object.}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gg...@us...> - 2009-10-20 12:42:28
|
Revision: 119
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=119&view=rev
Author: ggorjan
Date: 2009-10-20 12:42:09 +0000 (Tue, 20 Oct 2009)
Log Message:
-----------
bugs() now saves model in working.directory, if the later is not NULL
some minor code cleanup at the end of bugs()
Modified Paths:
--------------
trunk/R2WinBUGS/R/bugs.R
trunk/R2WinBUGS/inst/NEWS
Modified: trunk/R2WinBUGS/R/bugs.R
===================================================================
--- trunk/R2WinBUGS/R/bugs.R 2009-07-14 22:07:35 UTC (rev 118)
+++ trunk/R2WinBUGS/R/bugs.R 2009-10-20 12:42:09 UTC (rev 119)
@@ -12,6 +12,7 @@
save.history=!summary.only, over.relax = FALSE)
{
if(!is.null(working.directory)) {
+ working.directory <- path.expand(working.directory)
savedWD <- getwd()
setwd(working.directory)
on.exit(setwd(savedWD))
@@ -59,6 +60,9 @@
## model.file is not a file name but a model function
if(is.function(model.file)){
+ if(!is.null(working.directory)) {
+ temp <- file.path(working.directory, "model.txt")
+ } else {
temp <- tempfile("model")
temp <-
if(is.R() || .Platform$OS.type != "windows"){
@@ -66,9 +70,10 @@
} else {
gsub("\\.tmp$", ".txt", temp)
}
- write.model(model.file, con=temp)
- model.file <- gsub("\\\\", "/", temp)
- if(!is.R()) on.exit(file.remove(model.file), add=TRUE)
+ on.exit(file.remove(model.file), add=TRUE)
+ }
+ write.model(model.file, con=temp)
+ model.file <- gsub("\\\\", "/", temp)
}
if(inTempDir && basename(model.file) == model.file)
try(file.copy(file.path(savedWD, model.file), model.file, overwrite = TRUE))
@@ -127,20 +132,21 @@
bugs.inits.files = bugs.inits.files, over.relax = over.relax)
bugs.run(n.burnin, bugs.directory, WINE=WINE, useWINE=useWINE,
newWINE=newWINE, WINEPATH=WINEPATH)
- if(codaPkg)
- return(file.path(getwd(), paste("coda", 1:n.chains, ".txt", sep="")))
- if (summary.only) {
- return(bugs.log("log.txt"))
+
+ ## After BUGS run
+
+ if(codaPkg) ret <- file.path(getwd(), paste("coda", 1:n.chains, ".txt", sep=""))
+ if(summary.only) ret <- bugs.log("log.txt")
+ if(!codaPkg & !summary.only) {
+ ret <- c(bugs.sims(parameters.to.save, n.chains, n.iter, n.burnin, n.thin, DIC),
+ model.file=model.file, program=program)
+ class(ret) <- "bugs"
}
-
- sims <- c(bugs.sims(parameters.to.save, n.chains, n.iter, n.burnin,
- n.thin, DIC),
- model.file=model.file, program=program)
if(clearWD) {
file.remove(c(bugs.data.file, "log.odc", "log.txt", "codaIndex.txt",
- bugs.inits.files, "script.txt",
+ bugs.inits.files, "script.txt", model.file,
paste("coda", 1:n.chains, ".txt", sep="")))
}
- class(sims) <- "bugs"
- sims
+
+ ret
}
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2009-07-14 22:07:35 UTC (rev 118)
+++ trunk/R2WinBUGS/inst/NEWS 2009-10-20 12:42:09 UTC (rev 119)
@@ -2,6 +2,7 @@
=====================
Update 2.1-15
+- bugs() now saves model in working.directory, if the later is not NULL
- added seed argument to openbugs()
Update 2.1-14
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Uwe L. <li...@st...> - 2009-10-20 14:25:46
|
Dear Gregor, some comments on your recent changes: 1. Brian and I tried hard (in January-February 2009, see the svn logs) to make BRugs and R2WinBUGS not write into the working.directory unless a file with full path is given explicitly. A software should not write files into the current directory without being explicitly specified. The working.directory shopuld be used to read files from, not to write intermediate files to. If you want files to be created there: Can we have an additional argument that tells it? 2. Does path.expand() work on S-PLUS? Best wishes, Uwe gg...@us... wrote: > Revision: 119 > http://bugs-r.svn.sourceforge.net/bugs-r/?rev=119&view=rev > Author: ggorjan > Date: 2009-10-20 12:42:09 +0000 (Tue, 20 Oct 2009) > > Log Message: > ----------- > bugs() now saves model in working.directory, if the later is not NULL > > some minor code cleanup at the end of bugs() > > Modified Paths: > -------------- > trunk/R2WinBUGS/R/bugs.R > trunk/R2WinBUGS/inst/NEWS > > Modified: trunk/R2WinBUGS/R/bugs.R > =================================================================== > --- trunk/R2WinBUGS/R/bugs.R 2009-07-14 22:07:35 UTC (rev 118) > +++ trunk/R2WinBUGS/R/bugs.R 2009-10-20 12:42:09 UTC (rev 119) > @@ -12,6 +12,7 @@ > save.history=!summary.only, over.relax = FALSE) > { > if(!is.null(working.directory)) { > + working.directory <- path.expand(working.directory) > savedWD <- getwd() > setwd(working.directory) > on.exit(setwd(savedWD)) > @@ -59,6 +60,9 @@ > > ## model.file is not a file name but a model function > if(is.function(model.file)){ > + if(!is.null(working.directory)) { > + temp <- file.path(working.directory, "model.txt") > + } else { > temp <- tempfile("model") > temp <- > if(is.R() || .Platform$OS.type != "windows"){ > @@ -66,9 +70,10 @@ > } else { > gsub("\\.tmp$", ".txt", temp) > } > - write.model(model.file, con=temp) > - model.file <- gsub("\\\\", "/", temp) > - if(!is.R()) on.exit(file.remove(model.file), add=TRUE) > + on.exit(file.remove(model.file), add=TRUE) > + } > + write.model(model.file, con=temp) > + model.file <- gsub("\\\\", "/", temp) > } > if(inTempDir && basename(model.file) == model.file) > try(file.copy(file.path(savedWD, model.file), model.file, overwrite = TRUE)) > @@ -127,20 +132,21 @@ > bugs.inits.files = bugs.inits.files, over.relax = over.relax) > bugs.run(n.burnin, bugs.directory, WINE=WINE, useWINE=useWINE, > newWINE=newWINE, WINEPATH=WINEPATH) > - if(codaPkg) > - return(file.path(getwd(), paste("coda", 1:n.chains, ".txt", sep=""))) > - if (summary.only) { > - return(bugs.log("log.txt")) > + > + ## After BUGS run > + > + if(codaPkg) ret <- file.path(getwd(), paste("coda", 1:n.chains, ".txt", sep="")) > + if(summary.only) ret <- bugs.log("log.txt") > + if(!codaPkg & !summary.only) { > + ret <- c(bugs.sims(parameters.to.save, n.chains, n.iter, n.burnin, n.thin, DIC), > + model.file=model.file, program=program) > + class(ret) <- "bugs" > } > - > - sims <- c(bugs.sims(parameters.to.save, n.chains, n.iter, n.burnin, > - n.thin, DIC), > - model.file=model.file, program=program) > if(clearWD) { > file.remove(c(bugs.data.file, "log.odc", "log.txt", "codaIndex.txt", > - bugs.inits.files, "script.txt", > + bugs.inits.files, "script.txt", model.file, > paste("coda", 1:n.chains, ".txt", sep=""))) > } > - class(sims) <- "bugs" > - sims > + > + ret > } > > Modified: trunk/R2WinBUGS/inst/NEWS > =================================================================== > --- trunk/R2WinBUGS/inst/NEWS 2009-07-14 22:07:35 UTC (rev 118) > +++ trunk/R2WinBUGS/inst/NEWS 2009-10-20 12:42:09 UTC (rev 119) > @@ -2,6 +2,7 @@ > ===================== > > Update 2.1-15 > +- bugs() now saves model in working.directory, if the later is not NULL > - added seed argument to openbugs() > > Update 2.1-14 > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
|
From: Gorjanc G. <Gre...@bf...> - 2009-10-20 15:33:56
|
> 1. Brian and I tried hard (in January-February 2009, see the svn logs) > to make BRugs and R2WinBUGS not write into the working.directory unless > a file with full path is given explicitly. A software should not write > files into the current directory without being explicitly specified. > The working.directory shopuld be used to read files from, not to write > intermediate files to. If you want files to be created there: Can we > have an additional argument that tells it? Ups. I was not aware of this efforts. I agree that messing up with "temporary files" is not nice. However, one does not specify working.directory in such cases. Let me clarify my intention. If we define working.directory argument in bugs(), then this function saves data and inits file in that place, while the model file is saved in some temporary place. This surely is not consistent. And if you need to do some testing it is hard to find a model file in the temp. folders. I often prepair data, inits and model files using bugs() function, because it is handy. This way one can create a complete set of files for someone that would like to try to run BUGS, but does not use R, say AT ;) Therefore, I thought that consistency could not do any harm. Anyway, the model file is being removed by deafult leaving the working.directory clean at the end. > 2. Does path.expand() work on S-PLUS? Good point! Do we have contact with S-PLUS developer (Brian?) to check this out? gg |
|
From: Uwe L. <li...@st...> - 2009-10-26 22:46:16
|
Gorjanc Gregor wrote: >> 1. Brian and I tried hard (in January-February 2009, see the svn logs) >> to make BRugs and R2WinBUGS not write into the working.directory unless >> a file with full path is given explicitly. A software should not write >> files into the current directory without being explicitly specified. >> The working.directory shopuld be used to read files from, not to write >> intermediate files to. If you want files to be created there: Can we >> have an additional argument that tells it? > > Ups. I was not aware of this efforts. I agree that messing up with "temporary > files" is not nice. However, one does not specify working.directory in such > cases. > > Let me clarify my intention. If we define working.directory argument in bugs(), > then this function saves data and inits file in that place, while the model file is > saved in some temporary place. This surely is not consistent. And if you need > to do some testing it is hard to find a model file in the temp. folders. I often prepair > data, inits and model files using bugs() function, because it is handy. This way one can > create a complete set of files for someone that would like to try to run BUGS, but does > not use R, say AT ;) Therefore, I thought that consistency could not do any harm. > Anyway, the model file is being removed by deafult leaving the working.directory clean > at the end. Gregor, thanks, I see. I need to inspect the new behavior more closely in roughly 1.5 weeks when back from another conference. Particularly, I have to remember why we thought the last behavior was good (and I cannot remember since I have not used R2WinBUGS/BRugs since half a year now, except for testing bugfixes, making reviews, or answering questions on lists). >> 2. Does path.expand() work on S-PLUS? > > Good point! Do we have contact with S-PLUS developer (Brian?) to check this out? Which Brian? If you mean Brian Ripley, please do not bother him with this unimportant stuff. It would be handy to have a recent version of S-PLUS, but I think it is dying much quicker than I expected. Even Tibco is rather concentrating on R - given all the patches that we see coming in from Bill Dunlap. Hence probably not worth to invest too many efforts given Dawn Woodard is not listening to this list anymore. Dawn are you with Tibco nowadays? I will respond again, but it will take some time (at least 1.5 weeks), unfortunately. Best wishes, Uwe > gg > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
|
From: Uwe L. <li...@st...> - 2009-11-04 17:12:54
|
Dear Gregor, I have reviewed your code, and I really think people who want to generate inits, data and model files in their working directory should do it another way, either by a separate argument (which I still dislike) or by calling a corresponding function explicitly. R2WinBUGS:::bug() and BRugs:::BRugsFit() should really not do that (given the danger of overwriting or deleting already existing files there). Better to save those files explicitly and later let the software do the tricks in the tempdir(). As said before, Brian and I have had some face to face discussion about possible issues. I am really sorry about that, but I think in this case it is better to revert that change. Best wishes, Uwe Gorjanc Gregor wrote: >> 1. Brian and I tried hard (in January-February 2009, see the svn logs) >> to make BRugs and R2WinBUGS not write into the working.directory unless >> a file with full path is given explicitly. A software should not write >> files into the current directory without being explicitly specified. >> The working.directory shopuld be used to read files from, not to write >> intermediate files to. If you want files to be created there: Can we >> have an additional argument that tells it? > > Ups. I was not aware of this efforts. I agree that messing up with "temporary > files" is not nice. However, one does not specify working.directory in such > cases. > > Let me clarify my intention. If we define working.directory argument in bugs(), > then this function saves data and inits file in that place, while the model file is > saved in some temporary place. This surely is not consistent. And if you need > to do some testing it is hard to find a model file in the temp. folders. I often prepair > data, inits and model files using bugs() function, because it is handy. This way one can > create a complete set of files for someone that would like to try to run BUGS, but does > not use R, say AT ;) Therefore, I thought that consistency could not do any harm. > Anyway, the model file is being removed by deafult leaving the working.directory clean > at the end. > >> 2. Does path.expand() work on S-PLUS? > > Good point! Do we have contact with S-PLUS developer (Brian?) to check this out? > > gg > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
|
From: Gorjanc G. <Gre...@bf...> - 2009-11-04 18:26:08
|
Hi, > I have reviewed your code, and I really think people who want to > generate inits, data and model files in their working directory should > do it another way, either by a separate argument (which I still dislike) > or by calling a corresponding function explicitly. > > R2WinBUGS:::bug() and BRugs:::BRugsFit() should really not do that > (given the danger of overwriting or deleting already existing files there). I do not have the will to persuade you in the other way, but I have to say that my changes made things consistent. If I defined working.directory all was saved in that place - and the only change that I did was that the model file was also saved there - data and inits were already saved there. And this was not the default but optional behaviour. gg |
|
From: <li...@us...> - 2011-12-21 10:16:19
|
Revision: 218
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=218&view=rev
Author: ligges
Date: 2011-12-21 10:16:13 +0000 (Wed, 21 Dec 2011)
Log Message:
-----------
We have to import logit from boot nowadays
Modified Paths:
--------------
trunk/R2WinBUGS/DESCRIPTION
trunk/R2WinBUGS/NAMESPACE
trunk/R2WinBUGS/R/monitor.R
Modified: trunk/R2WinBUGS/DESCRIPTION
===================================================================
--- trunk/R2WinBUGS/DESCRIPTION 2011-12-21 10:13:19 UTC (rev 217)
+++ trunk/R2WinBUGS/DESCRIPTION 2011-12-21 10:16:13 UTC (rev 218)
@@ -13,7 +13,7 @@
convergence in a table and graph, and save the simulations in arrays for easy access
in R / S-PLUS. In S-PLUS, the openbugs functionality and the windows emulation
functionality is not yet available.
-Depends: R (>= 2.5.0), coda (>= 0.11-0)
+Depends: R (>= 2.5.0), coda (>= 0.11-0), boot
Suggests: BRugs (>= 0.3-2)
SystemRequirements: WinBUGS 1.4
URL: http://www.stat.columbia.edu/~gelman/bugsR/
Modified: trunk/R2WinBUGS/NAMESPACE
===================================================================
--- trunk/R2WinBUGS/NAMESPACE 2011-12-21 10:13:19 UTC (rev 217)
+++ trunk/R2WinBUGS/NAMESPACE 2011-12-21 10:16:13 UTC (rev 218)
@@ -1,4 +1,5 @@
importFrom(coda, mcmc.list, as.mcmc.list, read.coda)
+importFrom(boot, logit)
export(bugs,
attach.all,
Modified: trunk/R2WinBUGS/R/monitor.R
===================================================================
--- trunk/R2WinBUGS/R/monitor.R 2011-12-21 10:13:19 UTC (rev 217)
+++ trunk/R2WinBUGS/R/monitor.R 2011-12-21 10:16:13 UTC (rev 218)
@@ -30,9 +30,6 @@
confshrink = conv.p$confshrink, n.eff = conv.p$n.eff)
}
else if (trans[i]=="logit"){
- if (!is.R()){
- logit <- function (x) { log(x /(1- x)) }
- }
conv.p <- conv.par(logit(ai), n.chains, Rupper.keep=Rupper.keep)
conv.p <- list(quantiles = invlogit(conv.p$quantiles),
confshrink = conv.p$confshrink, n.eff = conv.p$n.eff)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <li...@us...> - 2013-04-07 17:13:44
|
Revision: 256
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=256&view=rev
Author: ligges
Date: 2013-04-07 17:13:29 +0000 (Sun, 07 Apr 2013)
Log Message:
-----------
1. .path.package() -> system.file()
2. relocation of vignette files
3. increase version number and update version dependencies
Modified Paths:
--------------
trunk/R2WinBUGS/DESCRIPTION
trunk/R2WinBUGS/inst/NEWS
trunk/R2WinBUGS/man/attach.all.Rd
Added Paths:
-----------
trunk/R2WinBUGS/vignettes/
trunk/R2WinBUGS/vignettes/R2WinBUGS.Rnw
trunk/R2WinBUGS/vignettes/RdRW.sty
trunk/R2WinBUGS/vignettes/Z.cls
trunk/R2WinBUGS/vignettes/benzolsw.pdf
trunk/R2WinBUGS/vignettes/bugs.tex
trunk/R2WinBUGS/vignettes/countssw.pdf
trunk/R2WinBUGS/vignettes/expectedsw.pdf
trunk/R2WinBUGS/vignettes/literatur.bib
trunk/R2WinBUGS/vignettes/literatur.bst
trunk/R2WinBUGS/vignettes/plot.pdf
Removed Paths:
-------------
trunk/R2WinBUGS/inst/doc/R2WinBUGS.Rnw
trunk/R2WinBUGS/inst/doc/RdRW.sty
trunk/R2WinBUGS/inst/doc/Z.cls
trunk/R2WinBUGS/inst/doc/benzolsw.pdf
trunk/R2WinBUGS/inst/doc/bugs.tex
trunk/R2WinBUGS/inst/doc/countssw.pdf
trunk/R2WinBUGS/inst/doc/expectedsw.pdf
trunk/R2WinBUGS/inst/doc/literatur.bib
trunk/R2WinBUGS/inst/doc/literatur.bst
trunk/R2WinBUGS/inst/doc/plot.pdf
Modified: trunk/R2WinBUGS/DESCRIPTION
===================================================================
--- trunk/R2WinBUGS/DESCRIPTION 2012-07-24 08:42:13 UTC (rev 255)
+++ trunk/R2WinBUGS/DESCRIPTION 2013-04-07 17:13:29 UTC (rev 256)
@@ -1,7 +1,7 @@
Package: R2WinBUGS
Title: Running WinBUGS and OpenBUGS from R / S-PLUS
-Date: 2011-03-22
-Version: 2.1-18
+Date: 2013-04-07
+Version: 2.1-19
Author: originally written by Andrew Gelman <ge...@st...>;
changes and packaged by Sibylle Sturtz <st...@st...>
and Uwe Ligges <li...@st...>.
@@ -13,7 +13,7 @@
convergence in a table and graph, and save the simulations in arrays for easy access
in R / S-PLUS. In S-PLUS, the openbugs functionality and the windows emulation
functionality is not yet available.
-Depends: R (>= 2.5.0), coda (>= 0.11-0), boot
+Depends: R (>= 2.13.0), coda (>= 0.11-0), boot
Suggests: BRugs (>= 0.3-2)
SystemRequirements: WinBUGS 1.4
URL: http://www.stat.columbia.edu/~gelman/bugsR/
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2012-07-24 08:42:13 UTC (rev 255)
+++ trunk/R2WinBUGS/inst/NEWS 2013-04-07 17:13:29 UTC (rev 256)
@@ -1,6 +1,11 @@
Changes to R2WinBUGS:
=====================
+Update 2.1-19
+- fix outdated usage: .path.package -> system.file
+- move vignette files around
+
+Update 2.1-18
- import logit from boot nowadays (seems nobody uses that anyway)
Update 2.1-17
Deleted: trunk/R2WinBUGS/inst/doc/R2WinBUGS.Rnw
===================================================================
--- trunk/R2WinBUGS/inst/doc/R2WinBUGS.Rnw 2012-07-24 08:42:13 UTC (rev 255)
+++ trunk/R2WinBUGS/inst/doc/R2WinBUGS.Rnw 2013-04-07 17:13:29 UTC (rev 256)
@@ -1,506 +0,0 @@
-%\VignetteIndexEntry{R2WinBUGS}
-\documentclass{Z}
-\usepackage{RdRW,thumbpdf}
-\newcommand{\WinBUGS}{{\proglang{WinBUGS}}{}}
-\newcommand{\RW}{{\pkg{R2WinBUGS}}{}}
-\renewcommand{\R}{{\proglang{R}}{}}
-\setlength{\textheight}{23.5cm}
-
-\title{\RW{}:\protect\linebreak A Package for Running \WinBUGS{} from \R{}}
-\author{Sibylle Sturtz\thanks{\email{st...@st...}}\\Fachbereich Statistik\\Universit\"at Dortmund\\Germany
- \And
- Uwe Ligges\thanks{\email{li...@st...}}\\Fachbereich Statistik\\Universit\"at Dortmund\\Germany
- \And
- Andrew Gelman\thanks{\email{ge...@st...}}\\Department of Statistics\\Columbia University\\USA
-}
-\Plainauthor{Sibylle Sturtz, Uwe Ligges, Andrew Gelman}
-\Plaintitle{R2WinBUGS: A Package for Running WinBUGS from R}
-
-\Abstract{
-The \RW{} package provides convenient functions to call \WinBUGS{} from \R{}. It
-automatically writes the data and scripts in a format readable by \WinBUGS{} for processing in batch mode, which
-is possible since version 1.4. After the \WinBUGS{} process has finished, it is possible either to read the
-resulting data into \R{} by the package itself---which gives a compact graphical summary of inference and
-convergence diagnostics---or to use the facilities of the \pkg{coda} package for further analyses of the
-output. Examples are given to demonstrate the usage of this package.
-}
-
-\Keywords{\R{}, \WinBUGS{}, interface, MCMC}
-\Plainkeywords{R, WinBUGS, interface, MCMC}
-
-\begin{document}
-An earlier version of this vignette has been published by the Journal of Statistical Software:\\
-Sturtz S, Ligges U, Gelman A (2005):
-``\RW{}: A Package for Running \WinBUGS{} from \R{}.''
-{\em Journal of Statistical Software}, 12(3), 1--16.
-
-
-\section{Introduction}\label{Introduction}
-The usage of Markov chain Monte Carlo (MCMC) methods became very popular within the last decade. \WinBUGS{}
-\citep[\textbf{B}ayesian inference \textbf{U}sing \textbf{G}ibbs \textbf{S}ampling, ][]
-{Spiegelhalter;Thomas;Best:2003} is a popular software for analyzing complex statistical models using MCMC
-methods. This software uses Gibbs sampling \citep{Geman;Geman:1984,Gelfand;Smith:1990,Casella;George:1992} and the
-Metropolis algorithm \citep{Metropolis;Rosenbluth;Rosenbluth;Teller;Teller:1953}
-to generate a Markov chain by sampling from full conditional
-distributions.
-The \WinBUGS{} software is available for free
-at \url{http://www.mrc-bsu.cam.ac.uk/bugs/}.
-An introduction to MCMC methods is given in \cite{Gilks;Richardson;Spiegelhalter:1996}.
-
-Using \WinBUGS{}, the user must specify the model to run, and to load data and initial values for a specified
-number of Markov chains. Then it is possible to run the Markov chain(s) and to save the results for the parameters
-the user is interested in. Summary statistics of these data, convergence diagnostics, kernel estimates
-etc.\ are available as well.
-Nevertheless, some users of this software might be interested in saving the output and reading it into \R{}
-\citep{RCore:2004} for further analyses.
-\WinBUGS{} 1.4 comes with the ability to run the software in batch mode using scripts.
-
-The \RW{} package makes use of this feature and provides the tools to call \WinBUGS{}
-directly after data manipulation in \R{}. Furthermore, it is possible to
-work with the results after importing them back into \R{} again, for example to create posterior predictive simulations or, more generally, graphical displays of data and posterior simulations \citep{gelman:2004}.
-Embedding in R can also be useful for frequently changed data or processing a bunch of data sets,
-because it is much more convenient to use some \R{} functions (possibly within a loop)
-rather than using ``copy \& paste'' to update data in \WinBUGS{} each time; however difficulties have been encountered in this area because both \R{} and \WinBUGS{} can lock up RAM in the Windows operating system.
-
-\R{} is a ``language for data analysis and graphics'' and an open source and
-freely available statistical software package implementing that language, see \url{http://www.R-project.org/}.
-Historically, \R{} is an implementation of the award-winning \proglang{S}
-language and system \citep{becker:1984r,becker:1988r,chambers:1992,chambers:1998}.
-\R{} and \RW{} are available from \emph{CRAN} (Comprehensive \R{} Archive Network),
-i.e., \url{http://CRAN.R-Project.org} or one of its mirrors.
-\RW{} could be ported to the commercial \proglang{S} implementation
-\textsc{S-Plus}. Minor adaptions would be needed since \textsc{S-Plus}
-lacks some of \R{}'s functions and capabilities.
-If an internet connection is available, \RW{} can be installed by typing
-\verb+install.packages("R2WinBUGS")+ at the \R{} command prompt.
-Do not forget to load the package with \verb+library("R2WinBUGS")+.
-
-The package \pkg{coda} by \cite{Plummer;Best;Cowles;Vines:2004} is very useful for the analysis of \WinBUGS{}'
-output, the reader might want to install this package as well. The CRAN package \pkg{boa} (Bayesian Output
-Analysis Program) by \cite{Smith:2004} has similar aims.
-\proglang{JAGS} (Just Another Gibbs Sampler)
-by \cite{Plummer:2003} is a program for analysis of Bayesian hierarchical models using Gibbs sampling that aims for
-the same functionality as classic \proglang{BUGS}. \proglang{JAGS} is developed to work closely together with \R{} and
-the \pkg{coda} package.
-
-%% Revision 2005-01-10 start
-A new and completely revised version of WinBUGS called \proglang{OpenBUGS} \citep{Spiegelhalter;Thomas;Best;Lunn:2004}
-was lately published under the terms of the GPL.
-\proglang{OpenBUGS} is also expected to run under Linux.
-It provides a much more flexible API on which ``BRugs'' is based including
-a dynamic link library, incorporating a component loader
-that allows \R{} to make use of \proglang{OpenBUGS} components.
-OpenBUGS is still in development and suffers frequent crashes.
-As OpenBUGS becomes more reliable,
-it is planned to merge ``BRugs'' and \RW{} into one \R{} package.
-%% Revision 2005-01-10 end
-
-For other packages and projects on spatial statistics
-related to \R{}, follow the link to ``\R{} spatial projects'' at CRAN.
-
-In this paper, we give two examples, involving educational testing experiments in schools (cf.~Section~\ref{School}),
-and incidence of childhood leukaemia depending on benzene emissions (cf.~Section~\ref{Leukaemia}). Details on the
-functions of \RW{} are given in Section~\ref{Programming}. These functions automatically write the data and a
-script in a format readable by \WinBUGS{} for processing in batch mode, and call \WinBUGS{} from \R{}. After the
-\WinBUGS{} process has finished, it is possible either to read the resulting data into \R{} by the package itself
-or to use the facilities of the \pkg{coda} package for further analyses of the output. In Section~\ref{Example2},
-we demonstrate how to apply the functions provided by \RW{} on the examples' data, and how to analyze the output
-both with package \pkg{coda} and with \RW{}'s methods to \verb+plot()+ and \verb+print()+ the output.
-
-
-\section{Examples}\label{Examples}
-In this Section, we introduce two examples which will be continued in Section~\ref{Example2}.
-
-\subsection{Schools data}\label{School}
-The Scholastic Aptitude Test (SAT) measures the aptitude of high-schoolers in order to help colleges to make
-admissions decisions. It is divided into two parts, verbal (SAT-V) and mathematical (SAT-M).
-Our data comes from the SAT-V (Scholastic Aptitude Test-Verbal) on eight different high schools, from an experiment conducted in the late 1970s.
-SAT-V is a standard multiple choice test administered by the Educational Testing Service.
-This Service was interested in the effects of coaching programs for each of the selected schools.
-
-The study included coached and uncoached pupils, about sixty in each of the eight different schools; see
-\cite{Rubin:1981}. All of them had already taken the PSAT (Preliminary SAT) which results were used as covariates.
-%Even if the test is constructed to be resistant to short-term
-%efforts directed specifically toward improving test performance, each of the schools is successful at increasing
-%SAT scores.
-For each school, the estimated treatment effect and the standard error of the effect estimate are given.
-These are calculated by an analysis of covariance adjustment appropriate for a completely randomized experiment
-\citep{Rubin:1981}. This example was analyzed using a hierarchical normal model in \cite{Rubin:1981} and
-\citeauthor{Gelman:2003} (\citeyear{Gelman:2003}, Section 5.5).
-
-\subsection{Leukaemia registration data}\label{Leukaemia}
-Spatial data usually arises on different, non-nesting spatial scales. One example is childhood leukaemia
-registration data analyzed by \cite{Best;Cockings;Bennett;Wakefield;Elliot:2001}
-using ecologic regression. Data are given for Greater London bounded by the M25 orbital motorway.
-%% Revision 2005-01-10 start
-The data are not available as an example in \RW{} but we use the example here
-to illustrate
-alternative calls to the \verb+bugs()+ function and output analysis using the \pkg{coda} package.
-%% Revision 2005-01-10 end
-
-The observed number of leukaemia cases among children under 15 years old is given at ward level. Census wards are
-administrative areas containing approximately 5000 to 10\,000 people. Central London is divided into 873 wards. The
-number of incident cases of leukaemia in children is available from 1985 until 1996 from the Office of National
-Statistics and the Thames Cancer Registry. A plot of these numbers is given in Figure~\ref{observed}.
-
-\begin{figure}
-\begin{center}
-\includegraphics[width=0.85\textwidth]{countssw}
-\caption{\label{observed}Observed number of cases of childhood leukaemia in 1985--1996}
-\end{center}
-\end{figure}
-
-Additionally, the number of expected cases (cf.~Fig.~\ref{expected}) is calculated on the same
-resolution using population numbers for different age-sex-strata and the national leukaemia
-rate for the corresponding strata, for details see \cite{Best;Cockings;Bennett;Wakefield;Elliot:2001}.
-
-\begin{figure}
-\begin{center}
-\includegraphics[width=0.85\textwidth]{expectedsw}
-\caption{\label{expected}Expected number of cases of childhood leukaemia in 1985--1996}%, as obtained from a simple demographic model}
-\end{center}
-\end{figure}
-
-It is assumed that benzene emissions have an effect on the incidence rate of leukaemia. Benzene emission rates are
-available in tonnes per year from an atmospheric emissions inventory for London
-\citep{Buckingham;Clewley;Hutchinson;Sadler;Shah:1997} produced by the London Research Centre. They are provided
-at 1km $\times$ 1km grid cells, giving 2132 grid cells in total.
-Their spatial distribution is shown in Figure~\ref{benzene}.
-
-\begin{figure}
-\begin{center}
-\includegraphics[width=0.9\textwidth]{benzolsw}
-\caption{\label{benzene}Benzene emissions in tonnes per year}
-\end{center}
-\end{figure}
-
-For further details on the data see \cite{Best;Cockings;Bennett;Wakefield;Elliot:2001}.
-
-We model these data by Poisson-Gamma models introduced by \cite{Best;Ickstadt;Wolpert:2000} using \WinBUGS{}.
-A linking matrix containing information which grid cell belongs to which ward
-and to which amount is required. This matrix is calculated using \R{}.
-Unfortunately, \WinBUGS{} does not support a list format such as directly produced by \R{}.
-Therefore, the data must be provided as a matrix with 2132 rows and 873 columns (or vice versa).
-Most of the entries of this matrix are zeroes, but using \verb+dump()+ to export it from \R{}
-yields in a file size of 14.2~MB.
-Unfortunately, opening a file of such size really slows \WinBUGS{} down,
-and it was not even possible on some of our PCs.
-Importing data written by our \RW{} package does not make any problems using the batch mode,
-probably due to memory management issues in \WinBUGS{}.
-
-
-\section{Implementation}\label{Programming}
-The implementation of the \RW{} package is straightforward.
-The ``main'' function \verb+bugs()+ is intended to be called by the user.
-In principle, it is a wrapper for several other functions called therein step by step as follows:
-\begin{enumerate}
- \item \verb+bugs.data.inits()+ writes the data files \file{data.txt}, and \file{inits1.txt}, \file{inits2.txt}, ...
- into the working directory. These files will be used by \WinBUGS{} during batch processing.
-
- In particular, input for \WinBUGS{} must not exceed a certain number of digits.
- Moreover, it needs an \verb+E+ instead of an \verb+e+ in scientific notation.
- Scientific notation is particularly desirable because of the ``number of digits'' limitation.
- The default (\verb+digits = 5+) is to, e.g., reformat the number \verb+123456.789+ to \verb@1.23457E+05@.
- \item \verb+bugs.script()+ writes the file \file{script.txt} that is used by \WinBUGS{} for batch processing.
- \item \verb+bugs.run()+ updates the lengths of the adaptive phases in the \WinBUGS{} registry
- (using a function \verb+bugs.update.settings()+),
- calls \WinBUGS{}, and runs it in batch mode with \file{script.txt}.
- \item \verb+bugs.sims()+ is only called if the argument \verb+codaPkg+ has been set to \verb+FALSE+ (the default).
- Otherwise \verb+bugs()+ returns the filenames of stored data. These can, for example,
- be imported by package \pkg{coda} (see the example in Section~\ref{Leukaemia2}, page~\pageref{codaexample}),
- which provides functions for convergence diagnostics,
- calculation of Monte Carlo estimates, trace plots, and so forth.
-
- The function \verb+bugs.sims()+ reads simulations from \WinBUGS{} into \R{} (not necessarily called by \verb+bugs()+
- itself), formats them,
- monitors convergence, performs convergence checks, and computes medians and quantiles.
- It also prepares the output for \verb+bugs()+ itself.
-\end{enumerate}
-These functions are not intended to be called by the user directly.
-Arguments are passed from \verb+bugs()+ to the other functions, if appropriate.
-A shortened help file of \verb+bugs()+ listing all arguments is given in Appendix~\ref{Doc};
-for the full version type \verb+?bugs+ in \R{} after having installed and loaded the package \RW{}
-(see Section~\ref{Introduction}).
-
-%\newpage
-As known from \WinBUGS{}, one must specify the \verb+data+ in form of a list, with list names equal to the names
-of data in the corresponding \WinBUGS{} model. Alternatively, it is possible to specify a vector or list of names
-(of mode \verb+character+). In that case objects of that names are looked for in the environment in which
-\verb+bugs()+ has been called (usually that is the user's Workspace, \verb+.GlobalEnv+).
-%% Revision 2005-01-10 start
-If data have already been written in a file called \file{data.txt} to the working directory,
-it is possible to specify \verb+data = "data.txt"+.
-%% Revision 2005-01-10 end
-One will usually want to supply initial values.
-This can be done either in the form of a function \verb+inits()+ that creates these values, so that
-different chains can be automatically initialized at different points (see Section \ref{School2}), or by specifying them
-directly (see Section \ref{Leukaemia2}).
-If \verb+inits()+ is not specified,
-\verb+bugs()+ just uses the starting values created by \WinBUGS{}; but in practice \WinBUGS{} can crash when
-reasonable initial values are not specified, and so we recommend constructing a simple \verb+inits()+ function to
-simulate reasonable starting points \cite[Section C.2]{Gelman:2003}. It is also necessary to specify which
-parameters should be saved for monitoring by specifying \verb+parameters.to.save+.
-
-The user might also want to change the defaults for the length of the burn-in (\verb+n.burnin+, which defaults to half the length of the chain)
-period for every MCMC run and the number of iterations (\verb+n.iter+, default value 3)
-that are used to calculate Monte Carlo estimates.
-%SS: Achtung: n.iter=n.burn.in + length of stored chain!
-The specification of a thinning parameter (\verb+n.thin+) is possible as well; this is useful when the number of parameters is large, to keep the saved output to a reasonably-sized R object. In the default setting, the chains are thinned enough so that approximately 1000 simulation draws are saved.
-
-By setting the argument \verb+debug = TRUE+,
-\WinBUGS{} remains open after the run.
-This way it is possible to find errors in the code or the data structure,
-or even to work with that software as in a usual run.
-
-It is possible to run one or more Markov chains.
-The number of chains (\verb+n.chains+) must be specified together with the chains' initial values (\verb+inits+).
-If more than one Markov chain is requested and \verb+codaPkg+ is set to \verb+FALSE+, the convergence diagnostic
-$\hat{R}$ \citep{Brooks;Gelman:1998} is calculated by \verb+bugs.sims()+ for each of the saved parameters.
-
-%% Revision 2005-01-10 start
-Since the communication between \WinBUGS{} and \R{} is based on files,
-rather huge files will be saved in the working directory by the \verb+bugs()+ call,
-either files to be read in by \verb+bugs()+ itself, or by the \pkg{coda} package.
-The user might want to delete those files after the desired contents has been imported into \R{},
-and save those objects, e.g., as compressed \R{} data files.
-%% Revision 2005-01-10 end
-
-The function \verb+bugs()+ returns a rather complex object of class \verb+bugs+,
-if called with argument \verb+codaPkg = FALSE+.
-In order to look at the structure of such an object, type \verb+str(objectname)+.
-For convenience, \RW{} provides methods corresponding to class \verb+bugs+ for
-the generic functions \verb+print()+ and \verb+plot()+.
-
-So that user will not be overwhelmed with information; summaries of the output are provided by the
-\verb+print()+ method. That is, some parameters of the \verb+bugs()+ call are summarized, and mean,
-standard deviation, several quantiles of the parameters and convergence diagnostics based on \cite{Gelman;Rubin:1992}
-are printed. See the example in
-Section~\ref{School2}, page~\pageref{schoolssim}, for a typical output. As with \cite{Spiegelhalter;Best;Carlin;vdLinde:2002},
-%\pagebreak
- the DIC computed by \verb+bugs.sims()+ is defined as the posterior mean
-of the deviance plus $p_D$, the estimated effective number of parameters in the posterior distribution. We define
-$p_D$ as half the posterior variance of the deviance and estimate it as half the average of the within-chain
-variances of the deviance.\footnote{In contrast, \cite{Spiegelhalter;Best;Carlin;vdLinde:2002},
- and WinBUGS, define $p_D$ as the
-posterior mean of the deviance evaluated at the posterior mean of the parameter values. We cannot use that
-definition because the deviance function is not available to our program, which calls \WinBUGS{} from the
-``outside''. Both definitions of $p_D$---ours and that introduced by \cite{Spiegelhalter;Best;Carlin;vdLinde:2002}---can be
-derived from the asymptotic $\chi^2$ distribution of the deviance relative to its minimum \citep[Section 6.7]{Gelman:2003}.
-We make no claim that our measure of $p_D$ is superior to that of \cite{Spiegelhalter;Best;Carlin;vdLinde:2002};
-we choose this measure purely because it is computationally possible given what is available to us from the \WinBUGS{} output.}
-
-
-The \verb+plot()+ for objects of class \verb+bugs+
-provides information condensed in some plots conveniently arranged within the same graphics device.
-For an example, see Figure~\ref{plot} in Section~\ref{School2}. It is intended to adapt this function to work with MCMC output in general, even if obtained from software other than WinBUGS.
-
-
-
-\section{Examples continued}\label{Example2}
-The Examples introduced in Section~\ref{Example2} are continued in this Section.
-We apply the functions provided by \RW{}
-to the examples' data and analyze the output.
-
-\subsection{Schools data}\label{School2}
-Schools example data (see Section~\ref{School}) are available with the \RW{} package:
-\begin{Code}
- > data(schools)
- > schools
- school estimate sd
- 1 A 28.39 14.9
- 2 B 7.94 10.2
- 3 C -2.75 16.3
- 4 D 6.82 11.0
- 5 E -0.64 9.4
- 6 F 0.63 11.4
- 7 G 18.01 10.4
- 8 H 12.16 17.6
-\end{Code}
-For modeling these data, we use a hierarchical model as proposed by \citeauthor{Gelman:2003} (\citeyear{Gelman:2003}, Section 5.5).
-We assume a normal distribution for the observed estimate for each school with
-mean \verb+theta+ and inverse-variance \verb+tau.y+.
-The inverse-variance is given as $1/\verb+sigma.y+^{2}$ and its prior distribution is uniform on (0,1000). For the mean
-\verb+theta+, we employ another normal distribution with mean \verb+mu.theta+ and inverse-variance \verb+tau.theta+. For
-their prior distributions, see the following \WinBUGS{} code:
-
-
-\begin{Code}
- model {
- for (j in 1:J)
- {
- y[j] ~ dnorm (theta[j], tau.y[j])
- theta[j] ~ dnorm (mu.theta, tau.theta)
- tau.y[j] <- pow(sigma.y[j], -2)
- }
- mu.theta ~ dnorm (0.0, 1.0E-6)
- tau.theta <- pow(sigma.theta, -2)
- sigma.theta ~ dunif (0, 1000)
- }
-\end{Code}
-This model must be stored in a separate file, e.g.~\file{schools.bug}\footnote{Emacs Speaks Statistics (ESS)
-by \cite{rossini04}, a package available with Gnu Emacs \citep{stallmann99},
-recognizes and properly formats Bugs model files that have the .bug extension.},
-in an appropriate directory, say \path{c:/schools/}.
-In \R{} the user must prepare the data inputs the \verb+bugs()+ function needs.
-This can be a list containing the name of each data vector, e.g.
-\begin{Code}
- > J <- nrow(schools)
- > y <- schools$estimate
- > sigma.y <- schools$sd
- > data <- list ("J", "y", "sigma.y")
-\end{Code}
-Using these data and the model file, we can run an MCMC simulation to get estimates for \verb+theta+,
-\verb+mu.theta+ and \verb+sigma.theta+. Before running, the user must decide how many chains to be run
-(\verb+n.chain = 3+) for how many iterations (\verb+n.iter = 1000+).
-If the length of burn-in is not specified, \verb+n.burnin = floor(n.iter/2)+ is used, that is, 500 in this example.
-Additionally, the user must specify initial values for the chains, for example by writing a function. This can be done by
-\begin{Code}
- > inits <- function(){
- + list(theta = rnorm(J, 0, 100), mu.theta = rnorm(1, 0, 100),
- + sigma.theta = runif(1, 0, 100))
- + }
-\end{Code}
-Now, the user can start the MCMC simulation by typing
-\begin{Code}
- > schools.sim <- bugs(data, inits, model.file = "c:/schools/schools.bug",
- + parameters = c("theta", "mu.theta", "sigma.theta"),
- + n.chains = 3, n.iter = 1000,
- + bugs.directory = "c:/Program Files/WinBUGS14/")
-\end{Code}
-in \R{}.\label{schoolssim} The argument \verb+bugs.directory+ must point to the directory
-where \WinBUGS{} has been installed.
-For other available arguments, see Appendix \ref{Doc}.
-
-The results in objects \verb+schools.sim+ can conveniently be printed by \verb+print(schools.sim)+.
-The generic function \verb+print()+ calls the print method for an object of class \verb+bugs+
-provided by \RW{}.
-For this example, you will get something like
-
-\small
-\begin{Code}
- > print(schools.sim)
- Inference for Bugs model at "c:/schools/schools.bug"
- 3 chains, each with 1000 iterations (first 500 discarded)
- n.sims = 1500 iterations saved
- mean sd 2.5% 25% 50% 75% 97.5% Rhat n.eff
- theta[1] 11.1 9.1 -3.0 5.0 10.0 16.0 31.8 1.1 39
- theta[2] 7.6 6.6 -4.7 3.3 7.8 11.6 21.1 1.1 42
- theta[3] 5.7 8.4 -12.5 0.6 6.1 10.8 21.8 1.0 150
- theta[4] 7.1 7.0 -6.6 2.7 7.2 11.5 21.0 1.1 42
- theta[5] 5.1 6.8 -9.5 0.7 5.2 9.7 18.1 1.0 83
- theta[6] 5.7 7.3 -9.7 1.0 6.2 10.2 20.0 1.0 56
- theta[7] 10.4 7.3 -2.1 5.3 9.8 15.3 25.5 1.1 27
- theta[8] 8.3 8.4 -6.6 2.8 8.1 12.7 26.2 1.0 64
- mu.theta 7.6 5.9 -3.0 3.7 8.0 11.0 19.5 1.1 35
- sigma.theta 6.7 5.6 0.3 2.8 5.1 9.2 21.2 1.1 46
- deviance 60.8 2.5 57.0 59.1 60.2 62.1 66.6 1.0 170
- pD = 3 and DIC = 63.8 (using the rule, pD = var(deviance)/2)
-
- For each parameter, n.eff is a crude measure of effective sample size,
- and Rhat is the potential scale reduction factor (at convergence, Rhat=1).
- DIC is an estimate of expected predictive error (lower deviance is better).
-\end{Code}
-\normalsize
-Additionally, the user can generate a plot of the results by typing \verb+plot(schools.sim)+.
-The resulting plot is given in Figure~\ref{plot}.
-\begin{figure}[t]
-\begin{center}
-\fbox{
-\includegraphics[width=0.9\textwidth]{plot}
-} \caption{\label{plot}Plot produced by \RW{} package for the schools example. }
-\end{center}
-\end{figure}
-In this plot, the left column shows a quick
-summary of inference and convergence ($\widehat{R}$ is close to 1.0 for all parameters, indicating good mixing of
-the three chains and thus approximate convergence); and the right column shows inferences for each set of
-parameters. As can be seen in the right column, \RW{} uses the parameter names in \WinBUGS{} to structure the
-output into scalar, vector, and arrays of parameters, in addition to storing the parameters as a long vector.
-
-For the interpretation of these results see \citeauthor{Gelman:2003} (\citeyear{Gelman:2003}, Section 5.5).
-
-\subsection{Leukaemia registration data}\label{Leukaemia2}
-The leukaemia registration data (see Section \ref{Leukaemia}) are used to show data modeling and output reading
-into \R{} using the \pkg{coda} package. A simple model for these data looks as follows:
-\begin{Code}
-model{
- beta.0 ~ dgamma(a.0, tau.0)
- beta.benz ~ dgamma(a.benz, tau.benz)
- a.0 <- 0.575
- tau.0 <- a.0*2
- a.benz <- 0.575
- tau.benz <- a.benz*2
-\end{Code}
-\clearpage
-\begin{Code}
- for (i in 1:I)
- {
- count[i] ~ dpois(lambda[i])
- lambda[i] <- p[i]*expect[i]
- for (j in 1:J)
- {
- prop[j,i] <- gamma[j,i]*(benz[j] - benzbar)
- }
- p[i]<- beta.0 + beta.benz*sum(prop[,i])
- }
- }
-\end{Code}
-Here \verb+count+ denotes the number of observed incidences of childhood leukaemia in ward~\verb+i+. These are
-assumed to be Poisson distributed with mean \verb+lambda+ depending on the number of expected cases \verb+expect+
-in ward \verb+i+ and an area-specific risk rate \verb+p+. For calculation of this area specific risk rate we use
-an intercept \verb+beta.0+ and a term depending on the weighted sum of benzene emissions \verb+benz+ in each ...
[truncated message content] |
|
From: <li...@us...> - 2015-07-29 21:13:11
|
Revision: 271
http://sourceforge.net/p/bugs-r/code/271
Author: ligges
Date: 2015-07-29 21:13:08 +0000 (Wed, 29 Jul 2015)
Log Message:
-----------
import from base packages
Modified Paths:
--------------
trunk/R2WinBUGS/DESCRIPTION
trunk/R2WinBUGS/NAMESPACE
trunk/R2WinBUGS/R/attach.all.R
trunk/R2WinBUGS/inst/NEWS
Modified: trunk/R2WinBUGS/DESCRIPTION
===================================================================
--- trunk/R2WinBUGS/DESCRIPTION 2015-07-29 17:09:35 UTC (rev 270)
+++ trunk/R2WinBUGS/DESCRIPTION 2015-07-29 21:13:08 UTC (rev 271)
@@ -1,7 +1,7 @@
Package: R2WinBUGS
Title: Running 'WinBUGS' and 'OpenBUGS' from 'R' / 'S-PLUS'
-Date: 2015-05-31
-Version: 2.1-20
+Date: 2015-07-29
+Version: 2.1-21
Author: originally written by Andrew Gelman <ge...@st...>;
changes and packaged by Sibylle Sturtz <st...@st...>
and Uwe Ligges <li...@st...>.
@@ -13,6 +13,7 @@
Function write.model() allows a 'BUGS' model file to be written.
The class and auxiliary functions could be used with other MCMC programs, including 'JAGS'.
Depends: R (>= 2.13.0), coda (>= 0.11-0), boot
+Imports: utils, stats, graphics
Suggests: BRugs (>= 0.3-2)
SystemRequirements: OpenBugs for functions bugs() and openbugs() or WinBUGS 1.4 for function bugs()
Maintainer: Uwe Ligges <li...@st...>
Modified: trunk/R2WinBUGS/NAMESPACE
===================================================================
--- trunk/R2WinBUGS/NAMESPACE 2015-07-29 17:09:35 UTC (rev 270)
+++ trunk/R2WinBUGS/NAMESPACE 2015-07-29 21:13:08 UTC (rev 271)
@@ -1,6 +1,10 @@
importFrom(coda, mcmc, mcmc.list, as.mcmc.list, read.coda)
importFrom(boot, logit)
+importFrom("graphics", "layout", "lines", "mtext", "par", "plot", "points", "strheight", "strwidth", "text")
+importFrom("stats", "median", "qf", "quantile", "sd", "var")
+importFrom("utils", "flush.console", "menu", "read.table")
+
export(bugs,
attach.all,
detach.all,
Modified: trunk/R2WinBUGS/R/attach.all.R
===================================================================
--- trunk/R2WinBUGS/R/attach.all.R 2015-07-29 17:09:35 UTC (rev 270)
+++ trunk/R2WinBUGS/R/attach.all.R 2015-07-29 21:13:08 UTC (rev 271)
@@ -9,7 +9,7 @@
"\nRemove these objects from .GlobalEnv?", sep="")
if(interactive()){
if(.Platform$OS.type == "windows")
- overwrite <- "YES" == winDialog(type = "yesno", question)
+ overwrite <- "YES" == utils::winDialog(type = "yesno", question)
else
overwrite <- 1 == menu(c("YES", "NO"), graphics = FALSE, title = question)
}
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2015-07-29 17:09:35 UTC (rev 270)
+++ trunk/R2WinBUGS/inst/NEWS 2015-07-29 21:13:08 UTC (rev 271)
@@ -1,6 +1,10 @@
Changes to R2WinBUGS:
=====================
+Update 2.1-20/21
+- various URL fixes, DESCRIPTION file updates
+- import from base packages
+
Update 2.1-19
- fix outdated usage: .path.package -> system.file
- move vignette files around
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <li...@us...> - 2009-01-20 15:28:18
|
Revision: 96
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=96&view=rev
Author: ligges
Date: 2009-01-20 15:28:01 +0000 (Tue, 20 Jan 2009)
Log Message:
-----------
- NEWS entries for R2WinBUGS >= 0.2-8
- bugfix - working.directory has not been resetted correctly
Modified Paths:
--------------
trunk/R2WinBUGS/DESCRIPTION
trunk/R2WinBUGS/R/bugs.R
trunk/R2WinBUGS/inst/NEWS
Modified: trunk/R2WinBUGS/DESCRIPTION
===================================================================
--- trunk/R2WinBUGS/DESCRIPTION 2009-01-08 17:07:19 UTC (rev 95)
+++ trunk/R2WinBUGS/DESCRIPTION 2009-01-20 15:28:01 UTC (rev 96)
@@ -1,7 +1,7 @@
Package: R2WinBUGS
Title: Running WinBUGS and OpenBUGS from R / S-PLUS
-Date: 2009-01-08
-Version: 2.1-9
+Date: 2009-01-20
+Version: 2.1-10
Author: originally written by Andrew Gelman <ge...@st...>;
changes and packaged by Sibylle Sturtz <st...@st...>
and Uwe Ligges <li...@st...>.
Modified: trunk/R2WinBUGS/R/bugs.R
===================================================================
--- trunk/R2WinBUGS/R/bugs.R 2009-01-08 17:07:19 UTC (rev 95)
+++ trunk/R2WinBUGS/R/bugs.R 2009-01-20 15:28:01 UTC (rev 96)
@@ -48,12 +48,12 @@
## Some tweaks for wine (particularly required for Mac OS)
working.directory <- gsub("//", "/", working.directory)
Sys.chmod(working.directory, mode="750")
- on.exit(Sys.chmod(working.directory, mode="700"))
+ on.exit(Sys.chmod(working.directory, mode="700"), add = TRUE)
}
+ savedWD <- getwd()
+ setwd(working.directory)
+ on.exit(setwd(savedWD), add = TRUE)
}
- savedWD <- getwd()
- setwd(working.directory)
- on.exit(setwd(savedWD), add = TRUE)
## model.file is not a file name but a model function
if(is.function(model.file)){
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2009-01-08 17:07:19 UTC (rev 95)
+++ trunk/R2WinBUGS/inst/NEWS 2009-01-20 15:28:01 UTC (rev 96)
@@ -1,252 +1,256 @@
-Changes to R2WinBUGS:
-=====================
-
-Update 2.1-8?
-- findUnixBinary now fails (with a meaningfull error message) always if the
- binary file does not exist.
-- If working.directory=NULL (the default setting), then a temporary
- directory is used as a working directory to prevent overwriting/removing
- the existing files.
-- File script.txt is also removed when clearWD=TRUE.
-- If model.file does not have a "txt" extension, then it is temporarily
- copied to a file with "txt" extension in the working directory and
- removed at the end of WinBUGS run.
-
-Update 2.1-7
-- this file is now available as NEWS file in top folder of installed package
-
-Update 2.1-6 (23 August 2007):
-- reverting back to use thin.updater since it is faster, however CODA files
- have "wrong" indexes - this needs to be fixed in BUGS program
-- WINE arguments are now set in such a way that defaults work on Windows
- and Linux
-- minor formatting in the code and help files
-- added R2WinBUGS-package help page
-
-Update 2.1-5 (12 June 2007):
-- proper indexing of CODA files also in R version
-- fixed useWINE documentation in bugs help page
-- note on supported BUGS versions
-- as.bugs.array now returns info on used rule for pD i.e. var(deviance)/2
- or Dbar-Dhat
-- some internal fixes related to handling of DIC
-- merging and reversing ChangeLog files
-
-Update 2.1-4 (20 May 2007):
-- Depending on coda now (Namespace issues)
-- some more fixes for codetools checks
-- Vignette has been updated
-
-Update 2.1-3 (13 May 2007):
-- Ported to S-PLUS by Insightful Corp.
-- some fixes for codetools checks
-
-Update 2.0-4 (01 November 2006):
-- print.bugs / plot.bugs documentation fixes
-- write.model() fix
-
-Update 2.0-3 (06 October 2006):
-- \\. -> [.] in regular expressions
-
-Update 2.0-2 (26 July 2006):
-- changes for DIC, making use of BUGS internal calculations
-- some doc fixes
-
-Update 2.0-1 (26 May 2006):
-- some wine patches for 2.2-0 by Gregor Gorjanc
-
-Update 2.0-0 (08 May 2006):
-- bugs() doc fix/updates on scrambling
-- bugs.run() has new arg useWINE (by Gregor Gorjanc)
-- bugs() and bugs.script() patched for WINEPATH issue
-- bugs.script() changed to save log file in ASCII
-- new function bugs.log() by Gregor Gorjanc
-- new functions as.bugs.array, openbugs and sort.name by
- Jouni Kerman and Andrew Gelman
-- new function write.model() based on ideas from Jouni Kerman
-
-Update 1.1-1 (17 Feb 2006):
-- WINE tweaks (mainly by Gregor Gorjanc)
-
-Update 1.1-0 (14 Dec 2005):
-- Contribution by Ben Bolker and Yun Yan's rbugs package:
- make R2WinBUGS work under WINE
-
-Update 1.0-1 (14 Nov 2005):
-- make inits=NULL work (again ?)
-
-Update 1.0-0 (05 Aug 2005):
-- attach.all(), detach.all(), attach.bugs() and detach.bugs() added/changed
- more or less according to Andrew Gelman's current bugs.R
-
-Update 0.2-9 (26 July 2005):
-- bugs has new argument clearWD
-
-Update 0.2-8 (30 May 2005):
-- bugs passed DIC to bugs.script in order to be able to disable it
-
-Update 0.2-6 (18 May 2005):
-- bugs() changes in order to return a file names of coda output files
-- new read.bugs() returns a coda mcmc.list object, if codaPkg=TRUE.
-
-Update 0.2-5 (20 Oct 2004):
-- bugs() and bugs.script() have a new argument bin that allows to specify
- a number of iterations. After each "bin" iterations the coda files are saved.
-
-Update 0.2-4 (05 Oct 2004):
-- bugs.script() did not work for large n.iter values in update step
- (no scientific notation allowed)
-
-Update 0.2-3 (10 Sept 2004):
-- bugs.data.inits split to bugs.inits and bugs.data, the latter exported
- from the Namespace.
- Now we can use already written data files in bugs().
-
-Update 0.2-2 (28 Apr 2004):
-- schools data: original (see references) instead of the rounded data
-
-During the process of packaging R2WinBUGS_0.1 - R2WinBUGS_0.2-1,
-quite a lot of changes had been made. Those changes are not
-documented anywhere ...
-
-During the process of packaging R2WinBUGS_0.1, quite a lot of changes had
-been made. Those changes are not documented anywhere ...
-
-Changes prior to R2WinBUGS_0.1:
-===============================
-
-Update 30 Oct 2003:
- 1. Minor change to a return() statement to be compatible with R 1.8
- 2. Just a warning (from Ben Goodrich): if you are running Bugs.R inside
- a loop, you have to be careful with the data() and the inits()
- functions since they will not necessarily recognize locally-defined
- variables. One workaround is to define the variables used in data()
- and inits() using global assignments (<<-), but this can sometimes
- make the program run slower.
-Update 29 Aug 2003:
- 1. Fixed "bugs.data.inits" function so you can use data that have the
- same names as R functions.
- 2. Changed T and F to TRUE and FALSE everywhere in case the variables
- T and F are used as data in the main program
- 3. Caution: if you are entering the data as a list of variable names
- (see 10 Apr 2003 update, item 1), the data to be input into must
- be global variables. This can be relevant if you are running bugs()
- inside an R function.
- 4. Caution: bugs() has difficulty processing ragged arrays. It is
- better to save a whole matrix (e.g., "theta") rather than parts
- (e.g., "theta[1:10,1]", "theta[1:5,2]"). If you want to save
- part of a vector, you should do it as "theta[1:2]", not "theta[1]",
- "theta[2]".
-Update 30 Apr 2003: added time monitoring
-Update 29 Apr 2003:
- 1. The "attach.all" function (no longer called "attach2") overwrites
- so that all components of a list or data frame get attached.
- 2. Program now looks in the directory /winbug~1/ rather than /winbug~2/
- 3. Graphics parameters for margins are returned to their original state
- at the end of the program.
- 4. Added "digits.summary" option to the numerical display.
- 5. Added "last.values" output: a list that can be input as "inits"
- if you want to run the simulations longer.
-Update 13 Apr 2003: fixed new bug in round.bugs(). Now all numbers are
- saved in scientific notation.
-Update 10 Apr 2003:
- 1. It is now possible to enter the data as a list of variable names.
- For example, before you had to enter data as,
- data <- list (n=8, y=c(28,8,-3,7,-1,1,18,12))
- or
- n <- 8
- y <- c(28,8,-3,7,-1,1,18,12)
- data <- list (n=n, y=y)
- Now you can enter the data as,
- n <- 8
- y <- c(28,8,-3,7,-1,1,18,12)
- data <- list ("n", "y")
- The bugs() function will figure out which method you are using (based
- on whether "data" is a list of numbers or a vector of character
- strings).
- This doesn't look like much, but it's convenient when you're entering
- lots of data!
- 2. It is now possible to enter the initial values as a function,
- so as to automatically a random list of inits for each of the chains.
- For example, in the 8-schools example below, we can do:
- inits <- function()
- list (theta=rnorm(J,0,1), mu.theta=rnorm(1,0,100), sigma.theta=runif(1,0,100))
-
- to set up the inits as a function (rather than setting up n.chains
- sets of specific initial values). Then, the function call,
- schools.sim <- bugs (data, inits, parameters, "schools.txt", n.chains=3, n.iter=1000)
- automatically sets up 3 sets of initial values (each a list of
- theta, mu.theta, sigma.theta).
- 3. Bug in the initial rounding (the function round.bugs()) has been fixed.
- Thanks for Mark Clements for finding the bug and fixing it!
- Also, we have set the default rounding to 5 digits instead of 2.
-Update 01 Apr 2003: use layout() rather than split.screen() for graphical
- display
-Update 18 Mar 2003:
- 1. Get the Bugs configuration information from the original file
- (Registry_default.odc) rather than overwriting each time. (Fixes a
- bug that occurred when R was interrupted in the middle of a Bugs run.)
- 2. Display different colored dots in the right panel of the graphical
- display, to show the medians from each chain.
-Update 13 Mar 2003: fix minor bug in monitor()
-Update 10 Mar 2003: fix bug in pD and DIC calculations
-Update 7 Mar 2003:
- 1. Fix display.parallel=T option by adding min.width so that very
- intervals are still visible.
- 2. Compute pD separately for each sequence (which gives much more
- reasonable estimates before convergence).
-Update 8 Feb 2003: minor fixes in graphical display
-Update 6 Feb 2003:
- 1. Approximate "effective sample size" n.eff given for each parameter.
- 2. More explanatory material displayed.
- 3. Use bringToTop() to automatically bring up the graphics window.
-Update 4 Feb 2003:
- 1. Automatically compute the deviance, DIC, and pD. Bugs will not
- always compute DIC and pD, so we do so using the definition,
- DIC = E(deviance) + pD, using var(deviance)/2 as an estimate of pD.
- (This is derived from the chi^2 distribution. We can't use the
- Spiegelhalter et al. definition of DIC because we don't have access
- to the deviance function.)
- 2. Set default for n.thin so that, after thinning, the total number
- saved iterations, n.sims, is approximately 1000.
-Update 14 Jan 2003 to run with the new WinBugs1.4. You may see an error
- message and need to fix the dos.location assignment in bugs().
-Update 6 Jan 2003:
- 1. Fix of bug that occurred with uppercase and lowercase variable names
- 2. Set default for n.thin so that no more than about 500 iterations
- will be saved from each sequence
- 3. New option "display.parallel" added to show 80% inferences from
- parallel sequences on the right panel of the graphical display. This
- can be useful to understand what is going on when there are
- convergence problems.
-Update 26 Dec 2002: fix of minwidth in bugs.plot.summary
-Update 11 Dec 2002:
- 1. Automatic fixing of adaptive phases. Now you no longer need to run
- for thousands of iterations when slice or Metropolis sampling is used.
- 2. Various minor fixes
-Update 10 Dec 2002:
- 1. Cool graphical display of convergence and inferences!
- 2. New "attach2" function that overwrites so that all components of
- the list are attached
-Update 29 Nov 2002:
- 1. Fix of bug in 24 Nov update.
- 2. Fix of bug in 16 Nov update.
- 3. Length of chains is now pecified in terms of "n.iter" rather than
- "n.keep".
-Update 24 Nov 2002: improved treatment of "parameters.to.save". For
- example, you can now use "alpha" to indicate an entire array of parameters,
- whereas before you had to save "alpha[]" or "alpha[,]" or whatever.
-Update 16 Nov 2002: mean, sd, median added to outputs
-Update 4 Nov 2002: more error-flagging added
-Update 26 Oct 2002:
- 1. Parameters saved in order of the "parameters.to.save" vector
- (not alphabetical order).
- 2. Output saved in both matrix and list form.
- 3. With the attach.sims=T setting (which is the default), the simulations
- for all the saved parameters are saved as R objects. This is
- convenient for later use of the simulations.
-Updates to 16 Oct 2002: more error-flagging added, mean/sd added to summary,
- fixing scientific notation so Bugs can always read data and inits
-Update 21 Sept 2002: "quit=F" option changed to "debug=T"
-First version written 18 Sept 2002 by Andrew Gelman,
- adapted from the EmBedBugs package by Kenneth Rice
+Changes to R2WinBUGS:
+=====================
+
+Update 2.1-10
+- bugfix: working.directory was not always reset when function terminated.
+
+Update 2.1-9
+- R2WinBUGS now works on OS X and Solaris (with suitable versions of wine)
+- findUnixBinary now fails (with a meaningfull error message) always if the
+ binary file does not exist.
+- If working.directory=NULL (the default setting), then a temporary
+ directory is used as a working directory to prevent overwriting/removing
+ the existing files.
+- File script.txt is also removed when clearWD=TRUE.
+- If model.file does not have a "txt" extension, then it is temporarily
+ copied to a file with "txt" extension in the working directory and
+ removed at the end of WinBUGS run.
+
+Update 2.1-7
+- this file is now available as NEWS file in top folder of installed package
+
+Update 2.1-6 (23 August 2007):
+- reverting back to use thin.updater since it is faster, however CODA files
+ have "wrong" indexes - this needs to be fixed in BUGS program
+- WINE arguments are now set in such a way that defaults work on Windows
+ and Linux
+- minor formatting in the code and help files
+- added R2WinBUGS-package help page
+
+Update 2.1-5 (12 June 2007):
+- proper indexing of CODA files also in R version
+- fixed useWINE documentation in bugs help page
+- note on supported BUGS versions
+- as.bugs.array now returns info on used rule for pD i.e. var(deviance)/2
+ or Dbar-Dhat
+- some internal fixes related to handling of DIC
+- merging and reversing ChangeLog files
+
+Update 2.1-4 (20 May 2007):
+- Depending on coda now (Namespace issues)
+- some more fixes for codetools checks
+- Vignette has been updated
+
+Update 2.1-3 (13 May 2007):
+- Ported to S-PLUS by Insightful Corp.
+- some fixes for codetools checks
+
+Update 2.0-4 (01 November 2006):
+- print.bugs / plot.bugs documentation fixes
+- write.model() fix
+
+Update 2.0-3 (06 October 2006):
+- \\. -> [.] in regular expressions
+
+Update 2.0-2 (26 July 2006):
+- changes for DIC, making use of BUGS internal calculations
+- some doc fixes
+
+Update 2.0-1 (26 May 2006):
+- some wine patches for 2.2-0 by Gregor Gorjanc
+
+Update 2.0-0 (08 May 2006):
+- bugs() doc fix/updates on scrambling
+- bugs.run() has new arg useWINE (by Gregor Gorjanc)
+- bugs() and bugs.script() patched for WINEPATH issue
+- bugs.script() changed to save log file in ASCII
+- new function bugs.log() by Gregor Gorjanc
+- new functions as.bugs.array, openbugs and sort.name by
+ Jouni Kerman and Andrew Gelman
+- new function write.model() based on ideas from Jouni Kerman
+
+Update 1.1-1 (17 Feb 2006):
+- WINE tweaks (mainly by Gregor Gorjanc)
+
+Update 1.1-0 (14 Dec 2005):
+- Contribution by Ben Bolker and Yun Yan's rbugs package:
+ make R2WinBUGS work under WINE
+
+Update 1.0-1 (14 Nov 2005):
+- make inits=NULL work (again ?)
+
+Update 1.0-0 (05 Aug 2005):
+- attach.all(), detach.all(), attach.bugs() and detach.bugs() added/changed
+ more or less according to Andrew Gelman's current bugs.R
+
+Update 0.2-9 (26 July 2005):
+- bugs has new argument clearWD
+
+Update 0.2-8 (30 May 2005):
+- bugs passed DIC to bugs.script in order to be able to disable it
+
+Update 0.2-6 (18 May 2005):
+- bugs() changes in order to return a file names of coda output files
+- new read.bugs() returns a coda mcmc.list object, if codaPkg=TRUE.
+
+Update 0.2-5 (20 Oct 2004):
+- bugs() and bugs.script() have a new argument bin that allows to specify
+ a number of iterations. After each "bin" iterations the coda files are saved.
+
+Update 0.2-4 (05 Oct 2004):
+- bugs.script() did not work for large n.iter values in update step
+ (no scientific notation allowed)
+
+Update 0.2-3 (10 Sept 2004):
+- bugs.data.inits split to bugs.inits and bugs.data, the latter exported
+ from the Namespace.
+ Now we can use already written data files in bugs().
+
+Update 0.2-2 (28 Apr 2004):
+- schools data: original (see references) instead of the rounded data
+
+During the process of packaging R2WinBUGS_0.1 - R2WinBUGS_0.2-1,
+quite a lot of changes had been made. Those changes are not
+documented anywhere ...
+
+During the process of packaging R2WinBUGS_0.1, quite a lot of changes had
+been made. Those changes are not documented anywhere ...
+
+Changes prior to R2WinBUGS_0.1:
+===============================
+
+Update 30 Oct 2003:
+ 1. Minor change to a return() statement to be compatible with R 1.8
+ 2. Just a warning (from Ben Goodrich): if you are running Bugs.R inside
+ a loop, you have to be careful with the data() and the inits()
+ functions since they will not necessarily recognize locally-defined
+ variables. One workaround is to define the variables used in data()
+ and inits() using global assignments (<<-), but this can sometimes
+ make the program run slower.
+Update 29 Aug 2003:
+ 1. Fixed "bugs.data.inits" function so you can use data that have the
+ same names as R functions.
+ 2. Changed T and F to TRUE and FALSE everywhere in case the variables
+ T and F are used as data in the main program
+ 3. Caution: if you are entering the data as a list of variable names
+ (see 10 Apr 2003 update, item 1), the data to be input into must
+ be global variables. This can be relevant if you are running bugs()
+ inside an R function.
+ 4. Caution: bugs() has difficulty processing ragged arrays. It is
+ better to save a whole matrix (e.g., "theta") rather than parts
+ (e.g., "theta[1:10,1]", "theta[1:5,2]"). If you want to save
+ part of a vector, you should do it as "theta[1:2]", not "theta[1]",
+ "theta[2]".
+Update 30 Apr 2003: added time monitoring
+Update 29 Apr 2003:
+ 1. The "attach.all" function (no longer called "attach2") overwrites
+ so that all components of a list or data frame get attached.
+ 2. Program now looks in the directory /winbug~1/ rather than /winbug~2/
+ 3. Graphics parameters for margins are returned to their original state
+ at the end of the program.
+ 4. Added "digits.summary" option to the numerical display.
+ 5. Added "last.values" output: a list that can be input as "inits"
+ if you want to run the simulations longer.
+Update 13 Apr 2003: fixed new bug in round.bugs(). Now all numbers are
+ saved in scientific notation.
+Update 10 Apr 2003:
+ 1. It is now possible to enter the data as a list of variable names.
+ For example, before you had to enter data as,
+ data <- list (n=8, y=c(28,8,-3,7,-1,1,18,12))
+ or
+ n <- 8
+ y <- c(28,8,-3,7,-1,1,18,12)
+ data <- list (n=n, y=y)
+ Now you can enter the data as,
+ n <- 8
+ y <- c(28,8,-3,7,-1,1,18,12)
+ data <- list ("n", "y")
+ The bugs() function will figure out which method you are using (based
+ on whether "data" is a list of numbers or a vector of character
+ strings).
+ This doesn't look like much, but it's convenient when you're entering
+ lots of data!
+ 2. It is now possible to enter the initial values as a function,
+ so as to automatically a random list of inits for each of the chains.
+ For example, in the 8-schools example below, we can do:
+ inits <- function()
+ list (theta=rnorm(J,0,1), mu.theta=rnorm(1,0,100), sigma.theta=runif(1,0,100))
+
+ to set up the inits as a function (rather than setting up n.chains
+ sets of specific initial values). Then, the function call,
+ schools.sim <- bugs (data, inits, parameters, "schools.txt", n.chains=3, n.iter=1000)
+ automatically sets up 3 sets of initial values (each a list of
+ theta, mu.theta, sigma.theta).
+ 3. Bug in the initial rounding (the function round.bugs()) has been fixed.
+ Thanks for Mark Clements for finding the bug and fixing it!
+ Also, we have set the default rounding to 5 digits instead of 2.
+Update 01 Apr 2003: use layout() rather than split.screen() for graphical
+ display
+Update 18 Mar 2003:
+ 1. Get the Bugs configuration information from the original file
+ (Registry_default.odc) rather than overwriting each time. (Fixes a
+ bug that occurred when R was interrupted in the middle of a Bugs run.)
+ 2. Display different colored dots in the right panel of the graphical
+ display, to show the medians from each chain.
+Update 13 Mar 2003: fix minor bug in monitor()
+Update 10 Mar 2003: fix bug in pD and DIC calculations
+Update 7 Mar 2003:
+ 1. Fix display.parallel=T option by adding min.width so that very
+ intervals are still visible.
+ 2. Compute pD separately for each sequence (which gives much more
+ reasonable estimates before convergence).
+Update 8 Feb 2003: minor fixes in graphical display
+Update 6 Feb 2003:
+ 1. Approximate "effective sample size" n.eff given for each parameter.
+ 2. More explanatory material displayed.
+ 3. Use bringToTop() to automatically bring up the graphics window.
+Update 4 Feb 2003:
+ 1. Automatically compute the deviance, DIC, and pD. Bugs will not
+ always compute DIC and pD, so we do so using the definition,
+ DIC = E(deviance) + pD, using var(deviance)/2 as an estimate of pD.
+ (This is derived from the chi^2 distribution. We can't use the
+ Spiegelhalter et al. definition of DIC because we don't have access
+ to the deviance function.)
+ 2. Set default for n.thin so that, after thinning, the total number
+ saved iterations, n.sims, is approximately 1000.
+Update 14 Jan 2003 to run with the new WinBugs1.4. You may see an error
+ message and need to fix the dos.location assignment in bugs().
+Update 6 Jan 2003:
+ 1. Fix of bug that occurred with uppercase and lowercase variable names
+ 2. Set default for n.thin so that no more than about 500 iterations
+ will be saved from each sequence
+ 3. New option "display.parallel" added to show 80% inferences from
+ parallel sequences on the right panel of the graphical display. This
+ can be useful to understand what is going on when there are
+ convergence problems.
+Update 26 Dec 2002: fix of minwidth in bugs.plot.summary
+Update 11 Dec 2002:
+ 1. Automatic fixing of adaptive phases. Now you no longer need to run
+ for thousands of iterations when slice or Metropolis sampling is used.
+ 2. Various minor fixes
+Update 10 Dec 2002:
+ 1. Cool graphical display of convergence and inferences!
+ 2. New "attach2" function that overwrites so that all components of
+ the list are attached
+Update 29 Nov 2002:
+ 1. Fix of bug in 24 Nov update.
+ 2. Fix of bug in 16 Nov update.
+ 3. Length of chains is now pecified in terms of "n.iter" rather than
+ "n.keep".
+Update 24 Nov 2002: improved treatment of "parameters.to.save". For
+ example, you can now use "alpha" to indicate an entire array of parameters,
+ whereas before you had to save "alpha[]" or "alpha[,]" or whatever.
+Update 16 Nov 2002: mean, sd, median added to outputs
+Update 4 Nov 2002: more error-flagging added
+Update 26 Oct 2002:
+ 1. Parameters saved in order of the "parameters.to.save" vector
+ (not alphabetical order).
+ 2. Output saved in both matrix and list form.
+ 3. With the attach.sims=T setting (which is the default), the simulations
+ for all the saved parameters are saved as R objects. This is
+ convenient for later use of the simulations.
+Updates to 16 Oct 2002: more error-flagging added, mean/sd added to summary,
+ fixing scientific notation so Bugs can always read data and inits
+Update 21 Sept 2002: "quit=F" option changed to "debug=T"
+First version written 18 Sept 2002 by Andrew Gelman,
+ adapted from the EmBedBugs package by Kenneth Rice
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <li...@us...> - 2009-02-02 14:31:06
|
Revision: 99
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=99&view=rev
Author: ligges
Date: 2009-02-02 14:30:50 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
yet another working directory issue
Modified Paths:
--------------
trunk/R2WinBUGS/DESCRIPTION
trunk/R2WinBUGS/R/bugs.R
trunk/R2WinBUGS/inst/NEWS
Modified: trunk/R2WinBUGS/DESCRIPTION
===================================================================
--- trunk/R2WinBUGS/DESCRIPTION 2009-01-20 17:17:55 UTC (rev 98)
+++ trunk/R2WinBUGS/DESCRIPTION 2009-02-02 14:30:50 UTC (rev 99)
@@ -1,7 +1,7 @@
Package: R2WinBUGS
Title: Running WinBUGS and OpenBUGS from R / S-PLUS
-Date: 2009-01-20
-Version: 2.1-10
+Date: 2009-02-02
+Version: 2.1-11
Author: originally written by Andrew Gelman <ge...@st...>;
changes and packaged by Sibylle Sturtz <st...@st...>
and Uwe Ligges <li...@st...>.
Modified: trunk/R2WinBUGS/R/bugs.R
===================================================================
--- trunk/R2WinBUGS/R/bugs.R 2009-01-20 17:17:55 UTC (rev 98)
+++ trunk/R2WinBUGS/R/bugs.R 2009-02-02 14:30:50 UTC (rev 99)
@@ -42,6 +42,7 @@
}
## Move to working drirectory or temporary directory when NULL
+ inTempDir <- FALSE
if(is.null(working.directory)) {
working.directory <- tempdir()
if(useWINE){
@@ -53,6 +54,7 @@
savedWD <- getwd()
setwd(working.directory)
on.exit(setwd(savedWD), add = TRUE)
+ inTempDir <- TRUE
}
## model.file is not a file name but a model function
@@ -68,6 +70,8 @@
model.file <- gsub("\\\\", "/", temp)
if(!is.R()) on.exit(file.remove(model.file), add=TRUE)
}
+ if(inTempDir && basename(model.file) == model.file)
+ try(file.copy(file.path(savedWD, model.file), model.file, overwrite = TRUE))
if(!file.exists(model.file))
stop(paste(model.file, "does not exist."))
if(file.info(model.file)$isdir)
@@ -76,13 +80,16 @@
(regexpr("\\.txt$", data) > 0))) {
bugs.data.file <- bugs.data(data, dir = getwd(), digits)
} else {
+ if(inTempDir && basename(data) == data)
+ try(file.copy(file.path(savedWD, data), data, overwrite = TRUE))
if(!file.exists(data))
stop("File", data, "does not exist.")
bugs.data.file <- data
}
-
if (is.character(inits)) {
+ if(inTempDir && all(basename(inits) == inits))
+ try(file.copy(file.path(savedWD, inits), inits, overwrite = TRUE))
if (!all(file.exists(inits))) {
stop("One or more inits files are missing")
}
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2009-01-20 17:17:55 UTC (rev 98)
+++ trunk/R2WinBUGS/inst/NEWS 2009-02-02 14:30:50 UTC (rev 99)
@@ -1,6 +1,11 @@
Changes to R2WinBUGS:
=====================
+Update 2.1-11
+- bugfix: if working.directory was unset and files are assumed to be in R's
+ former wd, these are copied to the tempdir that is set as new working
+ directory now.
+
Update 2.1-10
- bugfix: working.directory was not always reset when function terminated.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gg...@us...> - 2009-02-20 15:11:58
|
Revision: 107
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=107&view=rev
Author: ggorjan
Date: 2009-02-20 15:11:48 +0000 (Fri, 20 Feb 2009)
Log Message:
-----------
- properly using chain parameters in as.mcmc.list.bugs
- documentation fix
Modified Paths:
--------------
trunk/R2WinBUGS/R/as.mcmc.list.bugs.R
trunk/R2WinBUGS/inst/NEWS
Modified: trunk/R2WinBUGS/R/as.mcmc.list.bugs.R
===================================================================
--- trunk/R2WinBUGS/R/as.mcmc.list.bugs.R 2009-02-20 00:12:21 UTC (rev 106)
+++ trunk/R2WinBUGS/R/as.mcmc.list.bugs.R 2009-02-20 15:11:48 UTC (rev 107)
@@ -1,18 +1,17 @@
-## Function as.mcmc.list.bugs contributed by Mike Meredith, 12 Feb 2009:
-as.mcmc.list.bugs <- function(x, ...) {
+
+as.mcmc.list.bugs <- function(x, ...)
+{
if(!inherits(x, "bugs"))
stop("Method as.mcmc.list.bugs() is only intended for bugs objects.")
if(dim(x$sims.array)[2] != x$n.chains)
stop("Inconsistancy in bug object regarding the number of chains.")
mclis <- vector("list", x$n.chains)
- strt <- x$n.burnin%/%x$n.thin + 1
- end <- x$n.iter%/%x$n.thin
+ strt <- x$n.burnin + 1
+ end <- x$n.iter
ord <- order(dimnames(x$sims.array)[[3]])
- if(end - strt + 1 < nrow(x$sims.array[,1,ord])) end <- end + 1
for(i in 1:x$n.chains) {
tmp1 <- x$sims.array[,i,ord]
- rownames(tmp1) <- strt:end
- mclis[[i]] <- mcmc(tmp1, strt, end, 1)
+ mclis[[i]] <- mcmc(tmp1, start=strt, end=end, thin=x$n.thin)
}
as.mcmc.list(mclis)
-}
+}
\ No newline at end of file
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2009-02-20 00:12:21 UTC (rev 106)
+++ trunk/R2WinBUGS/inst/NEWS 2009-02-20 15:11:48 UTC (rev 107)
@@ -1,6 +1,10 @@
Changes to R2WinBUGS:
=====================
+Update 2.1-13
+- properly using chain parameters in as.mcmc.list.bugs
+- documentation fix
+
Update 2.1-12
- new method as.mcmc.list.bugs contributed by Mike Meredith
- bugfix: plot.bugs() did not reset par(mfrow)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gg...@us...> - 2009-03-25 12:46:01
|
Revision: 108
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=108&view=rev
Author: ggorjan
Date: 2009-03-25 12:45:56 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
hack: adding group write permission for a temporary working directory in order to avoid problems with WINE emulator on Mac OS X
Modified Paths:
--------------
trunk/R2WinBUGS/DESCRIPTION
trunk/R2WinBUGS/R/bugs.R
trunk/R2WinBUGS/inst/NEWS
Modified: trunk/R2WinBUGS/DESCRIPTION
===================================================================
--- trunk/R2WinBUGS/DESCRIPTION 2009-02-20 15:11:48 UTC (rev 107)
+++ trunk/R2WinBUGS/DESCRIPTION 2009-03-25 12:45:56 UTC (rev 108)
@@ -1,7 +1,7 @@
Package: R2WinBUGS
Title: Running WinBUGS and OpenBUGS from R / S-PLUS
Date: 2009-02-11
-Version: 2.1-12
+Version: 2.1-13
Author: originally written by Andrew Gelman <ge...@st...>;
changes and packaged by Sibylle Sturtz <st...@st...>
and Uwe Ligges <li...@st...>.
Modified: trunk/R2WinBUGS/R/bugs.R
===================================================================
--- trunk/R2WinBUGS/R/bugs.R 2009-02-20 15:11:48 UTC (rev 107)
+++ trunk/R2WinBUGS/R/bugs.R 2009-03-25 12:45:56 UTC (rev 108)
@@ -48,7 +48,7 @@
if(useWINE){
## Some tweaks for wine (particularly required for Mac OS)
working.directory <- gsub("//", "/", working.directory)
- Sys.chmod(working.directory, mode="750")
+ Sys.chmod(working.directory, mode="770")
on.exit(Sys.chmod(working.directory, mode="700"), add = TRUE)
}
savedWD <- getwd()
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2009-02-20 15:11:48 UTC (rev 107)
+++ trunk/R2WinBUGS/inst/NEWS 2009-03-25 12:45:56 UTC (rev 108)
@@ -2,7 +2,9 @@
=====================
Update 2.1-13
-- properly using chain parameters in as.mcmc.list.bugs
+- hack: adding group write permission for a temporary working directory in order to
+ avoid problems with WINE emulator on Mac OS X
+- bugfix: properly using chain parameters in as.mcmc.list.bugs
- documentation fix
Update 2.1-12
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Uwe L. <li...@st...> - 2009-03-25 16:28:12
|
Thanks, do we need to release soon? Uwe gg...@us... wrote: > Revision: 108 > http://bugs-r.svn.sourceforge.net/bugs-r/?rev=108&view=rev > Author: ggorjan > Date: 2009-03-25 12:45:56 +0000 (Wed, 25 Mar 2009) > > Log Message: > ----------- > hack: adding group write permission for a temporary working directory in order to avoid problems with WINE emulator on Mac OS X > > Modified Paths: > -------------- > trunk/R2WinBUGS/DESCRIPTION > trunk/R2WinBUGS/R/bugs.R > trunk/R2WinBUGS/inst/NEWS > > Modified: trunk/R2WinBUGS/DESCRIPTION > =================================================================== > --- trunk/R2WinBUGS/DESCRIPTION 2009-02-20 15:11:48 UTC (rev 107) > +++ trunk/R2WinBUGS/DESCRIPTION 2009-03-25 12:45:56 UTC (rev 108) > @@ -1,7 +1,7 @@ > Package: R2WinBUGS > Title: Running WinBUGS and OpenBUGS from R / S-PLUS > Date: 2009-02-11 > -Version: 2.1-12 > +Version: 2.1-13 > Author: originally written by Andrew Gelman <ge...@st...>; > changes and packaged by Sibylle Sturtz <st...@st...> > and Uwe Ligges <li...@st...>. > > Modified: trunk/R2WinBUGS/R/bugs.R > =================================================================== > --- trunk/R2WinBUGS/R/bugs.R 2009-02-20 15:11:48 UTC (rev 107) > +++ trunk/R2WinBUGS/R/bugs.R 2009-03-25 12:45:56 UTC (rev 108) > @@ -48,7 +48,7 @@ > if(useWINE){ > ## Some tweaks for wine (particularly required for Mac OS) > working.directory <- gsub("//", "/", working.directory) > - Sys.chmod(working.directory, mode="750") > + Sys.chmod(working.directory, mode="770") > on.exit(Sys.chmod(working.directory, mode="700"), add = TRUE) > } > savedWD <- getwd() > > Modified: trunk/R2WinBUGS/inst/NEWS > =================================================================== > --- trunk/R2WinBUGS/inst/NEWS 2009-02-20 15:11:48 UTC (rev 107) > +++ trunk/R2WinBUGS/inst/NEWS 2009-03-25 12:45:56 UTC (rev 108) > @@ -2,7 +2,9 @@ > ===================== > > Update 2.1-13 > -- properly using chain parameters in as.mcmc.list.bugs > +- hack: adding group write permission for a temporary working directory in order to > + avoid problems with WINE emulator on Mac OS X > +- bugfix: properly using chain parameters in as.mcmc.list.bugs > - documentation fix > > Update 2.1-12 > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
|
From: Gorjanc G. <Gre...@bf...> - 2009-03-25 18:31:50
|
I guess so since we have a bugfix and a hack/solution that eases the work on Macs. If you have time of course. ________________________________________ From: Uwe Ligges [li...@st...] Sent: Wednesday, March 25, 2009 5:27 PM To: gg...@us... Cc: bug...@li... Subject: Re: [Bugs-r-devel] SF.net SVN: bugs-r:[108] trunk/R2WinBUGS Thanks, do we need to release soon? Uwe gg...@us... wrote: > Revision: 108 > http://bugs-r.svn.sourceforge.net/bugs-r/?rev=108&view=rev > Author: ggorjan > Date: 2009-03-25 12:45:56 +0000 (Wed, 25 Mar 2009) > > Log Message: > ----------- > hack: adding group write permission for a temporary working directory in order to avoid problems with WINE emulator on Mac OS X > > Modified Paths: > -------------- > trunk/R2WinBUGS/DESCRIPTION > trunk/R2WinBUGS/R/bugs.R > trunk/R2WinBUGS/inst/NEWS > > Modified: trunk/R2WinBUGS/DESCRIPTION > =================================================================== > --- trunk/R2WinBUGS/DESCRIPTION 2009-02-20 15:11:48 UTC (rev 107) > +++ trunk/R2WinBUGS/DESCRIPTION 2009-03-25 12:45:56 UTC (rev 108) > @@ -1,7 +1,7 @@ > Package: R2WinBUGS > Title: Running WinBUGS and OpenBUGS from R / S-PLUS > Date: 2009-02-11 > -Version: 2.1-12 > +Version: 2.1-13 > Author: originally written by Andrew Gelman <ge...@st...>; > changes and packaged by Sibylle Sturtz <st...@st...> > and Uwe Ligges <li...@st...>. > > Modified: trunk/R2WinBUGS/R/bugs.R > =================================================================== > --- trunk/R2WinBUGS/R/bugs.R 2009-02-20 15:11:48 UTC (rev 107) > +++ trunk/R2WinBUGS/R/bugs.R 2009-03-25 12:45:56 UTC (rev 108) > @@ -48,7 +48,7 @@ > if(useWINE){ > ## Some tweaks for wine (particularly required for Mac OS) > working.directory <- gsub("//", "/", working.directory) > - Sys.chmod(working.directory, mode="750") > + Sys.chmod(working.directory, mode="770") > on.exit(Sys.chmod(working.directory, mode="700"), add = TRUE) > } > savedWD <- getwd() > > Modified: trunk/R2WinBUGS/inst/NEWS > =================================================================== > --- trunk/R2WinBUGS/inst/NEWS 2009-02-20 15:11:48 UTC (rev 107) > +++ trunk/R2WinBUGS/inst/NEWS 2009-03-25 12:45:56 UTC (rev 108) > @@ -2,7 +2,9 @@ > ===================== > > Update 2.1-13 > -- properly using chain parameters in as.mcmc.list.bugs > +- hack: adding group write permission for a temporary working directory in order to > + avoid problems with WINE emulator on Mac OS X > +- bugfix: properly using chain parameters in as.mcmc.list.bugs > - documentation fix > > Update 2.1-12 > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel ------------------------------------------------------------------------------ _______________________________________________ Bugs-r-devel mailing list Bug...@li... https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
|
From: Uwe L. <li...@st...> - 2009-03-26 19:01:05
|
Gorjanc Gregor wrote: > I guess so since we have a bugfix and a hack/solution that eases the > work on Macs. If you have time of course. Will do shortly! Uwe > ________________________________________ > From: Uwe Ligges [li...@st...] > Sent: Wednesday, March 25, 2009 5:27 PM > To: gg...@us... > Cc: bug...@li... > Subject: Re: [Bugs-r-devel] SF.net SVN: bugs-r:[108] trunk/R2WinBUGS > > Thanks, do we need to release soon? > > Uwe > > > gg...@us... wrote: >> Revision: 108 >> http://bugs-r.svn.sourceforge.net/bugs-r/?rev=108&view=rev >> Author: ggorjan >> Date: 2009-03-25 12:45:56 +0000 (Wed, 25 Mar 2009) >> >> Log Message: >> ----------- >> hack: adding group write permission for a temporary working directory in order to avoid problems with WINE emulator on Mac OS X >> >> Modified Paths: >> -------------- >> trunk/R2WinBUGS/DESCRIPTION >> trunk/R2WinBUGS/R/bugs.R >> trunk/R2WinBUGS/inst/NEWS >> >> Modified: trunk/R2WinBUGS/DESCRIPTION >> =================================================================== >> --- trunk/R2WinBUGS/DESCRIPTION 2009-02-20 15:11:48 UTC (rev 107) >> +++ trunk/R2WinBUGS/DESCRIPTION 2009-03-25 12:45:56 UTC (rev 108) >> @@ -1,7 +1,7 @@ >> Package: R2WinBUGS >> Title: Running WinBUGS and OpenBUGS from R / S-PLUS >> Date: 2009-02-11 >> -Version: 2.1-12 >> +Version: 2.1-13 >> Author: originally written by Andrew Gelman <ge...@st...>; >> changes and packaged by Sibylle Sturtz <st...@st...> >> and Uwe Ligges <li...@st...>. >> >> Modified: trunk/R2WinBUGS/R/bugs.R >> =================================================================== >> --- trunk/R2WinBUGS/R/bugs.R 2009-02-20 15:11:48 UTC (rev 107) >> +++ trunk/R2WinBUGS/R/bugs.R 2009-03-25 12:45:56 UTC (rev 108) >> @@ -48,7 +48,7 @@ >> if(useWINE){ >> ## Some tweaks for wine (particularly required for Mac OS) >> working.directory <- gsub("//", "/", working.directory) >> - Sys.chmod(working.directory, mode="750") >> + Sys.chmod(working.directory, mode="770") >> on.exit(Sys.chmod(working.directory, mode="700"), add = TRUE) >> } >> savedWD <- getwd() >> >> Modified: trunk/R2WinBUGS/inst/NEWS >> =================================================================== >> --- trunk/R2WinBUGS/inst/NEWS 2009-02-20 15:11:48 UTC (rev 107) >> +++ trunk/R2WinBUGS/inst/NEWS 2009-03-25 12:45:56 UTC (rev 108) >> @@ -2,7 +2,9 @@ >> ===================== >> >> Update 2.1-13 >> -- properly using chain parameters in as.mcmc.list.bugs >> +- hack: adding group write permission for a temporary working directory in order to >> + avoid problems with WINE emulator on Mac OS X >> +- bugfix: properly using chain parameters in as.mcmc.list.bugs >> - documentation fix >> >> Update 2.1-12 >> >> >> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. >> >> ------------------------------------------------------------------------------ >> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are >> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and >> easily build your RIAs with Flex Builder, the Eclipse(TM)based development >> software that enables intelligent coding and step-through debugging. >> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com >> _______________________________________________ >> Bugs-r-devel mailing list >> Bug...@li... >> https://lists.sourceforge.net/lists/listinfo/bugs-r-devel > > ------------------------------------------------------------------------------ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel > > ------------------------------------------------------------------------------ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
|
From: Uwe L. <li...@st...> - 2009-03-28 18:07:52
|
Right now uploaded to CRAN and waiting for Kurt to deal with it. Uwe Gorjanc Gregor wrote: > I guess so since we have a bugfix and a hack/solution that eases the > work on Macs. If you have time of course. > ________________________________________ > From: Uwe Ligges [li...@st...] > Sent: Wednesday, March 25, 2009 5:27 PM > To: gg...@us... > Cc: bug...@li... > Subject: Re: [Bugs-r-devel] SF.net SVN: bugs-r:[108] trunk/R2WinBUGS > > Thanks, do we need to release soon? > > Uwe > > > gg...@us... wrote: >> Revision: 108 >> http://bugs-r.svn.sourceforge.net/bugs-r/?rev=108&view=rev >> Author: ggorjan >> Date: 2009-03-25 12:45:56 +0000 (Wed, 25 Mar 2009) >> >> Log Message: >> ----------- >> hack: adding group write permission for a temporary working directory in order to avoid problems with WINE emulator on Mac OS X >> >> Modified Paths: >> -------------- >> trunk/R2WinBUGS/DESCRIPTION >> trunk/R2WinBUGS/R/bugs.R >> trunk/R2WinBUGS/inst/NEWS >> >> Modified: trunk/R2WinBUGS/DESCRIPTION >> =================================================================== >> --- trunk/R2WinBUGS/DESCRIPTION 2009-02-20 15:11:48 UTC (rev 107) >> +++ trunk/R2WinBUGS/DESCRIPTION 2009-03-25 12:45:56 UTC (rev 108) >> @@ -1,7 +1,7 @@ >> Package: R2WinBUGS >> Title: Running WinBUGS and OpenBUGS from R / S-PLUS >> Date: 2009-02-11 >> -Version: 2.1-12 >> +Version: 2.1-13 >> Author: originally written by Andrew Gelman <ge...@st...>; >> changes and packaged by Sibylle Sturtz <st...@st...> >> and Uwe Ligges <li...@st...>. >> >> Modified: trunk/R2WinBUGS/R/bugs.R >> =================================================================== >> --- trunk/R2WinBUGS/R/bugs.R 2009-02-20 15:11:48 UTC (rev 107) >> +++ trunk/R2WinBUGS/R/bugs.R 2009-03-25 12:45:56 UTC (rev 108) >> @@ -48,7 +48,7 @@ >> if(useWINE){ >> ## Some tweaks for wine (particularly required for Mac OS) >> working.directory <- gsub("//", "/", working.directory) >> - Sys.chmod(working.directory, mode="750") >> + Sys.chmod(working.directory, mode="770") >> on.exit(Sys.chmod(working.directory, mode="700"), add = TRUE) >> } >> savedWD <- getwd() >> >> Modified: trunk/R2WinBUGS/inst/NEWS >> =================================================================== >> --- trunk/R2WinBUGS/inst/NEWS 2009-02-20 15:11:48 UTC (rev 107) >> +++ trunk/R2WinBUGS/inst/NEWS 2009-03-25 12:45:56 UTC (rev 108) >> @@ -2,7 +2,9 @@ >> ===================== >> >> Update 2.1-13 >> -- properly using chain parameters in as.mcmc.list.bugs >> +- hack: adding group write permission for a temporary working directory in order to >> + avoid problems with WINE emulator on Mac OS X >> +- bugfix: properly using chain parameters in as.mcmc.list.bugs >> - documentation fix >> >> Update 2.1-12 >> >> >> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. >> >> ------------------------------------------------------------------------------ >> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are >> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and >> easily build your RIAs with Flex Builder, the Eclipse(TM)based development >> software that enables intelligent coding and step-through debugging. >> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com >> _______________________________________________ >> Bugs-r-devel mailing list >> Bug...@li... >> https://lists.sourceforge.net/lists/listinfo/bugs-r-devel > > ------------------------------------------------------------------------------ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel > > ------------------------------------------------------------------------------ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
|
From: <li...@us...> - 2009-04-05 16:26:45
|
Revision: 109
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=109&view=rev
Author: ligges
Date: 2009-04-05 16:26:37 +0000 (Sun, 05 Apr 2009)
Log Message:
-----------
Modified Paths:
--------------
trunk/R2WinBUGS/DESCRIPTION
trunk/R2WinBUGS/R/bugs.R
trunk/R2WinBUGS/R/bugs.script.R
trunk/R2WinBUGS/R/openbugs.R
trunk/R2WinBUGS/inst/NEWS
trunk/R2WinBUGS/man/bugs.Rd
trunk/R2WinBUGS/man/bugs.script.Rd
trunk/R2WinBUGS/man/openbugs.Rd
Modified: trunk/R2WinBUGS/DESCRIPTION
===================================================================
--- trunk/R2WinBUGS/DESCRIPTION 2009-03-25 12:45:56 UTC (rev 108)
+++ trunk/R2WinBUGS/DESCRIPTION 2009-04-05 16:26:37 UTC (rev 109)
@@ -1,7 +1,7 @@
Package: R2WinBUGS
Title: Running WinBUGS and OpenBUGS from R / S-PLUS
-Date: 2009-02-11
-Version: 2.1-13
+Date: 2009-04-05
+Version: 2.1-14
Author: originally written by Andrew Gelman <ge...@st...>;
changes and packaged by Sibylle Sturtz <st...@st...>
and Uwe Ligges <li...@st...>.
Modified: trunk/R2WinBUGS/R/bugs.R
===================================================================
--- trunk/R2WinBUGS/R/bugs.R 2009-03-25 12:45:56 UTC (rev 108)
+++ trunk/R2WinBUGS/R/bugs.R 2009-04-05 16:26:37 UTC (rev 109)
@@ -9,7 +9,7 @@
working.directory=NULL,
clearWD=FALSE, useWINE=.Platform$OS.type != "windows", WINE=NULL,
newWINE=TRUE, WINEPATH=NULL, bugs.seed=NULL, summary.only=FALSE,
- save.history=!summary.only)
+ save.history=!summary.only, over.relax = FALSE)
{
if(!is.null(working.directory)) {
savedWD <- getwd()
@@ -26,7 +26,7 @@
## If OpenBUGS, we only call openbugs() and exit...
return(openbugs(data, inits, parameters.to.save, model.file,
n.chains, n.iter, n.burnin, n.thin, n.sims, DIC=DIC,
- bugs.directory, working.directory, digits))
+ bugs.directory, working.directory, digits, over.relax = over.relax))
}
## Checking number of inits, which is NOT saved here:
if(!missing(inits) && !is.function(inits) && !is.null(inits) && (length(inits) != n.chains))
@@ -124,7 +124,7 @@
WINEPATH=WINEPATH, bugs.seed=bugs.seed,
summary.only=summary.only, save.history=save.history,
bugs.data.file = bugs.data.file,
- bugs.inits.files = bugs.inits.files)
+ bugs.inits.files = bugs.inits.files, over.relax = over.relax)
bugs.run(n.burnin, bugs.directory, WINE=WINE, useWINE=useWINE,
newWINE=newWINE, WINEPATH=WINEPATH)
if(codaPkg)
Modified: trunk/R2WinBUGS/R/bugs.script.R
===================================================================
--- trunk/R2WinBUGS/R/bugs.script.R 2009-03-25 12:45:56 UTC (rev 108)
+++ trunk/R2WinBUGS/R/bugs.script.R 2009-04-05 16:26:37 UTC (rev 109)
@@ -3,7 +3,8 @@
n.thin, model.file, debug=FALSE, is.inits, bin,
DIC=FALSE, useWINE=.Platform$OS.type != "windows",
newWINE=TRUE, WINEPATH=NULL, bugs.seed=NULL, summary.only=FALSE,
- save.history=TRUE, bugs.data.file, bugs.inits.files)
+ save.history=TRUE, bugs.data.file, bugs.inits.files,
+ over.relax = FALSE)
{
## Write file script.txt for Bugs
if((ceiling(n.iter/n.thin) - ceiling(n.burnin/n.thin)) < 2)
@@ -58,6 +59,7 @@
"compile (", n.chains, ")\n",
if(is.inits) initlist,
"gen.inits()\n",
+ if(over.relax) 'over.relax("yes")\n',
thinUpdate,
savelist,
if(DIC) "dic.set()\n",
Modified: trunk/R2WinBUGS/R/openbugs.R
===================================================================
--- trunk/R2WinBUGS/R/openbugs.R 2009-03-25 12:45:56 UTC (rev 108)
+++ trunk/R2WinBUGS/R/openbugs.R 2009-04-05 16:26:37 UTC (rev 109)
@@ -2,7 +2,7 @@
n.chains = 3, n.iter = 2000, n.burnin = floor(n.iter/2),
n.thin = max(1, floor(n.chains *(n.iter - n.burnin) / n.sims)), n.sims = 1000,
DIC = TRUE, bugs.directory = "c:/Program Files/OpenBUGS/",
- working.directory=NULL, digits = 5)
+ working.directory=NULL, digits = 5, over.relax = FALSE)
{
if(!is.R())
stop("OpenBUGS is not yet available in S-PLUS")
@@ -78,14 +78,14 @@
cat("Sampling has been started ...\n")
flush.console()
}
- BRugs::modelUpdate(nBurnin)
+ BRugs::modelUpdate(nBurnin, overRelax = over.relax)
## BRugs::samplesSetThin(nThin)
if(DIC) {
BRugs::dicSet()
on.exit(BRugs::dicClear(), add = TRUE)
}
BRugs::samplesSet(parametersToSave)
- BRugs::modelUpdate(nIter)
+ BRugs::modelUpdate(nIter, overRelax = over.relax)
params <- sort.name(BRugs::samplesMonitors("*"), parametersToSave)
samples <- sapply(params, BRugs::samplesSample)
n.saved.per.chain <- nrow(samples)/numChains
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2009-03-25 12:45:56 UTC (rev 108)
+++ trunk/R2WinBUGS/inst/NEWS 2009-04-05 16:26:37 UTC (rev 109)
@@ -1,6 +1,9 @@
Changes to R2WinBUGS:
=====================
+Update 2.1-14
+- new argument over.relax=FALSE
+
Update 2.1-13
- hack: adding group write permission for a temporary working directory in order to
avoid problems with WINE emulator on Mac OS X
Modified: trunk/R2WinBUGS/man/bugs.Rd
===================================================================
--- trunk/R2WinBUGS/man/bugs.Rd 2009-03-25 12:45:56 UTC (rev 108)
+++ trunk/R2WinBUGS/man/bugs.Rd 2009-04-05 16:26:37 UTC (rev 109)
@@ -17,7 +17,7 @@
working.directory=NULL, clearWD=FALSE,
useWINE=.Platform$OS.type != "windows", WINE=NULL,
newWINE=TRUE, WINEPATH=NULL, bugs.seed=NULL, summary.only=FALSE,
- save.history=!summary.only)
+ save.history=!summary.only, over.relax = FALSE)
}
\arguments{
@@ -108,6 +108,7 @@
\item{summary.only}{If \code{TRUE}, only a parameter summary for very quick analyses is given,
temporary created files are not removed in that case.}
\item{save.history}{If \code{TRUE} (the default), trace plots are generated at the end.}
+ \item{over.relax}{If \code{TRUE}, over-relaxed form of MCMC is used if available from WinBUGS.}
}
\details{
Modified: trunk/R2WinBUGS/man/bugs.script.Rd
===================================================================
--- trunk/R2WinBUGS/man/bugs.script.Rd 2009-03-25 12:45:56 UTC (rev 108)
+++ trunk/R2WinBUGS/man/bugs.script.Rd 2009-04-05 16:26:37 UTC (rev 109)
@@ -11,7 +11,7 @@
model.file, debug=FALSE, is.inits, bin, DIC=FALSE,
useWINE=.Platform$OS.type != "windows", newWINE=TRUE, WINEPATH=NULL,
bugs.seed=NULL, summary.only=FALSE, save.history=TRUE,
- bugs.data.file, bugs.inits.files)
+ bugs.data.file, bugs.inits.files, over.relax = FALSE)
}
\arguments{
\item{parameters.to.save}{parameters that should be monitored}
@@ -36,6 +36,7 @@
\item{save.history}{If \code{TRUE} (the default), trace plots are generated at the end.}
\item{bugs.data.file}{character name of the data file}
\item{bugs.inits.files}{character vector of names of the inits files}
+ \item{over.relax}{If \code{TRUE}, over-relaxed form of MCMC is used if available from WinBUGS.}
}
\value{Nothing, but as a side effect, the script file \file{script.txt}
Modified: trunk/R2WinBUGS/man/openbugs.Rd
===================================================================
--- trunk/R2WinBUGS/man/openbugs.Rd 2009-03-25 12:45:56 UTC (rev 108)
+++ trunk/R2WinBUGS/man/openbugs.Rd 2009-04-05 16:26:37 UTC (rev 109)
@@ -13,7 +13,7 @@
n.thin = max(1, floor(n.chains * (n.iter - n.burnin) / n.sims)),
n.sims = 1000, DIC = TRUE,
bugs.directory = "c:/Program Files/OpenBUGS/",
- working.directory = NULL, digits = 5)
+ working.directory = NULL, digits = 5, over.relax = FALSE)
}
\arguments{
@@ -57,7 +57,7 @@
this function; \pkg{WinBUGS} in- and output will be stored in this
directory; if \code{NULL}, a temporary working directory via
\code{\link{tempdir}} is used.}
-
+ \item{over.relax}{If \code{TRUE}, over-relaxed form of MCMC is used if available from OpenBUGS.}
}
\value{A \code{\link{bugs}} object.}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <li...@us...> - 2009-11-05 16:01:16
|
Revision: 127
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=127&view=rev
Author: ligges
Date: 2009-11-05 16:01:06 +0000 (Thu, 05 Nov 2009)
Log Message:
-----------
fix for encoding issues for R >= 2.10.0
Modified Paths:
--------------
trunk/R2WinBUGS/R/bugs.update.settings.R
trunk/R2WinBUGS/inst/NEWS
Modified: trunk/R2WinBUGS/R/bugs.update.settings.R
===================================================================
--- trunk/R2WinBUGS/R/bugs.update.settings.R 2009-11-05 16:00:32 UTC (rev 126)
+++ trunk/R2WinBUGS/R/bugs.update.settings.R 2009-11-05 16:01:06 UTC (rev 127)
@@ -1,58 +1,60 @@
"bugs.update.settings" <-
function (n.burnin, bugs.directory)
{
- char.burnin <- as.character(n.burnin - 1)
if(is.R()) {
.fileCopy <- file.copy
+ .regexpr <- function(...) regexpr(..., useBytes = TRUE)
+ .sub <- function(...) sub(..., useBytes = TRUE)
+ .writeBin <-
+ if(getRversion() >= "2.10")
+ function(...) writeBin(..., useBytes = TRUE)
+ else
+ writeBin
} else {
.fileCopy <- splus.file.copy
+ .regexpr <- regexpr
+ .sub <- sub
+ .writeBin <- writeBin
}
- .fileCopy(file.path(bugs.directory, "System/Rsrc/Registry.odc"),
- file.path(bugs.directory, "System/Rsrc/Registry_Rsave.odc"),
- overwrite=TRUE)
+
+
+ char.burnin <- as.character(n.burnin - 1)
registry <- readBin(file.path(bugs.directory, "System/Rsrc/Registry.odc"),
"character", 400, size=1, endian="little")
locale <- Sys.getlocale("LC_CTYPE")
Sys.setlocale("LC_CTYPE", "C")
- if(is.R()) {
- info <- registry[regexpr("Int", registry, fixed=TRUE, useBytes=TRUE) > 0]
- } else {
- info <- registry[regexpr("Int", registry, fixed=TRUE) > 0]
- }
- while(regexpr("\r", info) > 0) {
- newline <- regexpr("\r", info)
+ .fileCopy(file.path(bugs.directory, "System/Rsrc/Registry.odc"),
+ file.path(bugs.directory, "System/Rsrc/Registry_Rsave.odc"),
+ overwrite = TRUE)
+ info <- registry[.regexpr("Int", registry, fixed = TRUE) > 0]
+ while(.regexpr("\r", info) > 0) {
+ newline <- .regexpr("\r", info)
info <- substring(info, newline + 1)
- line <- substring(info, 1, regexpr("\r", info) - 1)
- if(regexpr("AdaptivePhase", line) > 0) {
- if(is.R()) {
- numpos <- regexpr("Int", line, fixed=TRUE, useBytes=TRUE) + 4
- } else {
- numpos <- regexpr("Int", line, fixed=TRUE) + 4
- }
+ line <- substring(info, 1, .regexpr("\r", info) - 1)
+ if(.regexpr("AdaptivePhase", line) > 0) {
+ numpos <- .regexpr("Int", line, fixed=TRUE) + 4
num <- substring(line, numpos)
if(as.numeric(num) > n.burnin) {
blanks <- rep(" ", nchar(num, type="chars") - nchar(char.burnin, type="chars"))
num.new <- paste(paste(blanks, collapse=""), char.burnin, sep="")
- line.new <- sub(num, num.new, line)
- registry <- sub(line, line.new, registry)
+ line.new <- .sub(num, num.new, line)
+ registry <- .sub(line, line.new, registry)
}
}
}
Sys.setlocale("LC_CTYPE", locale)
- writeBin(registry,
- file.path(bugs.directory, "System/Rsrc/Registry.odc"), endian="little")
+ .writeBin(registry,
+ file.path(bugs.directory, "System/Rsrc/Registry.odc"), endian="little", useBytes = TRUE)
}
-## TODO: why is not this function called just file.copy within !is.R()
-"splus.file.copy"<-
- function(from, to, overwrite=FALSE)
+splus.file.copy <- function(from, to, overwrite=FALSE)
{
- if(!file.exists(from))
- stop("File: ", from, " does not exist")
- if(!overwrite && file.exists(to))
- stop("File: ", to, " already exists and overwrite is FALSE")
- n <- file.info(from)$size
- z <- writeBin(readBin(from, what="integer", size=1, n=n), to, size=1)
- invisible(z)
+ if(!file.exists(from))
+ stop("File: ", from, " does not exist")
+ if(!overwrite && file.exists(to))
+ stop("File: ", to, " already exists and overwrite is FALSE")
+ n <- file.info(from)$size
+ z <- writeBin(readBin(from, what="integer", size=1, n=n), to, size=1)
+ invisible(z)
}
Modified: trunk/R2WinBUGS/inst/NEWS
===================================================================
--- trunk/R2WinBUGS/inst/NEWS 2009-11-05 16:00:32 UTC (rev 126)
+++ trunk/R2WinBUGS/inst/NEWS 2009-11-05 16:01:06 UTC (rev 127)
@@ -4,6 +4,7 @@
Update 2.1-15
- added seed argument to openbugs()
- fix write.model() to work for separatly specified function body
+- fix bugs.update.settings() for R>=2.10.0 compatibility
Update 2.1-14
- new argument over.relax=FALSE
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|