You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(11) |
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
(24) |
Jun
(15) |
Jul
(5) |
Aug
(21) |
Sep
(85) |
Oct
(9) |
Nov
|
Dec
|
2008 |
Jan
(15) |
Feb
(11) |
Mar
|
Apr
(2) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(29) |
Oct
(47) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
(8) |
Feb
(12) |
Mar
(14) |
Apr
(4) |
May
(1) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
(11) |
Nov
(18) |
Dec
|
2010 |
Jan
|
Feb
|
Mar
(1) |
Apr
(3) |
May
(24) |
Jun
|
Jul
(1) |
Aug
(7) |
Sep
(5) |
Oct
(3) |
Nov
(4) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
(13) |
Apr
(3) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(24) |
Sep
(3) |
Oct
|
Nov
|
Dec
(29) |
2012 |
Jan
(5) |
Feb
(5) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
(9) |
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
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: 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: <li...@us...> - 2009-11-04 17:10:41
|
Revision: 123 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=123&view=rev Author: ligges Date: 2009-11-04 17:10:23 +0000 (Wed, 04 Nov 2009) Log Message: ----------- revert working.directory changes from revisions 119 and 121, but keep path.expand magic; update version numbers and dates for new release Modified Paths: -------------- trunk/BRugs/DESCRIPTION trunk/BRugs/NEWS trunk/BRugs/R/BRugsFit.R trunk/BRugs/R/bugs.data.R trunk/BRugs/R/bugs.inits.R trunk/BRugs/man/bugs.data.Rd trunk/BRugs/man/bugs.inits.Rd trunk/R2WinBUGS/DESCRIPTION trunk/R2WinBUGS/R/bugs.R trunk/R2WinBUGS/inst/NEWS Modified: trunk/BRugs/DESCRIPTION =================================================================== --- trunk/BRugs/DESCRIPTION 2009-10-26 12:44:56 UTC (rev 122) +++ trunk/BRugs/DESCRIPTION 2009-11-04 17:10:23 UTC (rev 123) @@ -1,8 +1,8 @@ Package: BRugs Title: OpenBUGS and its R / S-PLUS interface BRugs Version: 0.5-2 -Date: 2009-04-05 -Author: The Chief Software Bug is Andrew Thomas, with web assistance from Real Bug Bob O'Hara. Other members of the BUGS team are statisticians David Spiegelhalter, Nicky Best, Dave Lunn and Ken Rice. Dave Lunn has also made major contributions to the software development. R Code modified, extended and packaged for R by Uwe Ligges and Sibylle Sturtz. Some ideas taken from the R2WinBUGS package based on code by Andrew Gelman. +Date: 2009-11-04 +Author: The Chief Software Bug is Andrew Thomas, with web assistance from Real Bug Bob O'Hara. Other members of the BUGS team are statisticians David Spiegelhalter, Nicky Best, Dave Lunn and Ken Rice. Dave Lunn has also made major contributions to the software development. R Code modified, extended and packaged for R by Uwe Ligges and Sibylle Sturtz. Some ideas taken from the R2WinBUGS package based on code by Andrew Gelman. With considerable contributions by Gregor Gorjanc <gre...@bf...>. Description: An R / S-PLUS package containing OpenBUGS and its R / S-PLUS interface BRugs. Maintainer: Uwe Ligges <li...@st...> Depends: R (>= 2.5.0), coda Modified: trunk/BRugs/NEWS =================================================================== --- trunk/BRugs/NEWS 2009-10-26 12:44:56 UTC (rev 122) +++ trunk/BRugs/NEWS 2009-11-04 17:10:23 UTC (rev 123) @@ -2,7 +2,4 @@ ===================== Update 0.5-2 -- BRugsFit now saves model, data, and inits in working.directory, if - the later is not NULL -- bugsData and bugsInits gain dir argument - added seed argument to BRugsFit() \ No newline at end of file Modified: trunk/BRugs/R/BRugsFit.R =================================================================== --- trunk/BRugs/R/BRugsFit.R 2009-10-26 12:44:56 UTC (rev 122) +++ trunk/BRugs/R/BRugsFit.R 2009-11-04 17:10:23 UTC (rev 123) @@ -15,29 +15,22 @@ on.exit(setwd(savedWD), add = TRUE) } if(is.function(modelFile)){ - if(!is.null(working.directory)) { - temp <- file.path(working.directory, "model.txt") - } else { - temp <- tempfile("model") - on.exit(file.remove(temp), add=TRUE) - } - writeModel(modelFile, con=temp) - modelFile <- temp + writeModel(modelFile, con = (modelFile <- tempfile("model"))) + if(!is.R()) on.exit(file.remove(modelFile), add = TRUE) } if(!file.exists(modelFile)) stop(modelFile, " does not exist") if(file.info(modelFile)$isdir) stop(modelFile, " is a directory, but a file is required") modelCheck(modelFile) if(!(is.vector(data) && is.character(data) && all(file.exists(data)))) - data <- bugsData(data, digits = digits, dir=working.directory) - modelData(data) + data <- bugsData(data, digits = digits) + modelData(data) modelCompile(numChains) if(!is.null(seed)) modelSetSeed(newSeed=seed) if(missing(inits)){ modelGenInits() } else { if(is.list(inits) || is.function(inits) || (is.character(inits) && !any(file.exists(inits)))) - inits <- bugsInits(inits = inits, numChains = numChains, digits = digits, - dir=working.directory) + inits <- bugsInits(inits = inits, numChains = numChains, digits = digits) if(BRugsVerbose) print(inits) modelInits(inits) } Modified: trunk/BRugs/R/bugs.data.R =================================================================== --- trunk/BRugs/R/bugs.data.R 2009-10-26 12:44:56 UTC (rev 122) +++ trunk/BRugs/R/bugs.data.R 2009-11-04 17:10:23 UTC (rev 123) @@ -1,10 +1,5 @@ "bugsData" <- -function(data, fileName, digits = 5, dir) -{ - if(missing(fileName)) { - fileName <- file.path(ifelse(missing(dir), tempdir(), dir), - "data.txt") - } +function(data, fileName = file.path(tempdir(), "data.txt"), digits = 5){ if(is.numeric(unlist(data))) if(is.R()) { write.datafile(lapply(data, formatC, digits = digits, format = "E"), fileName) Modified: trunk/BRugs/R/bugs.inits.R =================================================================== --- trunk/BRugs/R/bugs.inits.R 2009-10-26 12:44:56 UTC (rev 122) +++ trunk/BRugs/R/bugs.inits.R 2009-11-04 17:10:23 UTC (rev 123) @@ -1,10 +1,7 @@ "bugsInits" <- -function (inits, numChains = 1, fileName, digits = 5, dir) -{ - if(missing(fileName)) { - fileName <- file.path(ifelse(missing(dir), tempdir(), dir), - paste("inits", 1:numChains, ".txt", sep="")) - } +function (inits, numChains = 1, fileName, digits = 5){ + if(missing(fileName)) + fileName <- file.path(tempdir(), paste("inits", 1:numChains, ".txt", sep = "")) if(length(fileName) != numChains) stop("numChains = ", numChains, " filenames must be specified") if(!is.null(inits)){ Modified: trunk/BRugs/man/bugs.data.Rd =================================================================== --- trunk/BRugs/man/bugs.data.Rd 2009-10-26 12:44:56 UTC (rev 122) +++ trunk/BRugs/man/bugs.data.Rd 2009-11-04 17:10:23 UTC (rev 123) @@ -3,7 +3,7 @@ \title{Writing input for OpenBUGS} \description{Write data file for OpenBUGS.} \usage{ -bugsData(data, fileName, digits = 5, dir) +bugsData(data, fileName = file.path(tempdir(), "data.txt"), digits = 5) } \arguments{ \item{data}{either a named list (names corresponding to variable names in the model file) @@ -11,7 +11,6 @@ a vector or list of the names of the data objects used by the model} \item{fileName}{the filename, defaults to \file{data.txt} in the temporary directory of the current R session} \item{digits}{number of significant digits used for OpenBUGS input, see \code{\link{formatC}}} - \item{dir}{character, where to save data, defaults to temporary directory} } \value{ Invisibly returns the \code{fileName}. Modified: trunk/BRugs/man/bugs.inits.Rd =================================================================== --- trunk/BRugs/man/bugs.inits.Rd 2009-10-26 12:44:56 UTC (rev 122) +++ trunk/BRugs/man/bugs.inits.Rd 2009-11-04 17:10:23 UTC (rev 123) @@ -3,7 +3,7 @@ \title{Writing input for OpenBUGS} \description{Write files containing inits.} \usage{ -bugsInits(inits, numChains = 1, fileName, digits = 5, dir) +bugsInits(inits, numChains = 1, fileName, digits = 5) } \arguments{ \item{inits}{a list with \code{n.chains} elements; each element of the list is @@ -13,7 +13,6 @@ \item{fileName}{the filename(s), one for each chain. Defaults to \file{inits1.txt}, ..., \file{initsN.txt} in the temporary directory of the current R session.} \item{digits}{number of significant digits used for OpenBUGS input, see \code{\link{formatC}}} - \item{dir}{character, where to save data, defaults to temporary directory} } \value{ Invisibly returns the \code{fileName}(s). Modified: trunk/R2WinBUGS/DESCRIPTION =================================================================== --- trunk/R2WinBUGS/DESCRIPTION 2009-10-26 12:44:56 UTC (rev 122) +++ trunk/R2WinBUGS/DESCRIPTION 2009-11-04 17:10:23 UTC (rev 123) @@ -1,6 +1,6 @@ Package: R2WinBUGS Title: Running WinBUGS and OpenBUGS from R / S-PLUS -Date: 2009-04-05 +Date: 2009-11-04 Version: 2.1-15 Author: originally written by Andrew Gelman <ge...@st...>; changes and packaged by Sibylle Sturtz <st...@st...> Modified: trunk/R2WinBUGS/R/bugs.R =================================================================== --- trunk/R2WinBUGS/R/bugs.R 2009-10-26 12:44:56 UTC (rev 122) +++ trunk/R2WinBUGS/R/bugs.R 2009-11-04 17:10:23 UTC (rev 123) @@ -60,9 +60,6 @@ ## 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"){ @@ -70,10 +67,9 @@ } else { gsub("\\.tmp$", ".txt", temp) } - on.exit(file.remove(model.file), add=TRUE) - } - write.model(model.file, con=temp) - model.file <- gsub("\\\\", "/", temp) + write.model(model.file, con=temp) + 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)) @@ -132,21 +128,20 @@ bugs.inits.files = bugs.inits.files, over.relax = over.relax) bugs.run(n.burnin, bugs.directory, WINE=WINE, useWINE=useWINE, newWINE=newWINE, WINEPATH=WINEPATH) - - ## 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" + if(codaPkg) + return(file.path(getwd(), paste("coda", 1:n.chains, ".txt", sep=""))) + if (summary.only) { + return(bugs.log("log.txt")) } + + 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", model.file, + bugs.inits.files, "script.txt", paste("coda", 1:n.chains, ".txt", sep=""))) } - - ret + class(sims) <- "bugs" + sims } Modified: trunk/R2WinBUGS/inst/NEWS =================================================================== --- trunk/R2WinBUGS/inst/NEWS 2009-10-26 12:44:56 UTC (rev 122) +++ trunk/R2WinBUGS/inst/NEWS 2009-11-04 17:10:23 UTC (rev 123) @@ -2,7 +2,6 @@ ===================== 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-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: <li...@us...> - 2009-10-26 12:45:15
|
Revision: 122 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=122&view=rev Author: ligges Date: 2009-10-26 12:44:56 +0000 (Mon, 26 Oct 2009) Log Message: ----------- bugfix for body()<- constructed functions [f<-1; body(f)<-1; writeModel(f)] Modified Paths: -------------- trunk/BRugs/R/write.model.R trunk/R2WinBUGS/R/write.model.R Modified: trunk/BRugs/R/write.model.R =================================================================== --- trunk/BRugs/R/write.model.R 2009-10-20 13:52:03 UTC (rev 121) +++ trunk/BRugs/R/write.model.R 2009-10-26 12:44:56 UTC (rev 122) @@ -1,8 +1,9 @@ writeModel <- function(model, con = "model.txt") { if (is.R()){ - model.text <- attr(model, "source") - model.text <- sub("^\\s*function\\s*\\(\\s*\\)", "model", model.text) + #model.text <- attr(model, "source") + #model.text <- sub("^\\s*function\\s*\\(\\s*\\)", "model", model.text) + model.text <- c("model", deparse(body(model))) } else { ## In S-PLUS the source code of a function can be obtained with ## as.character(function_name). This omits the "function_name <- function()" piece Modified: trunk/R2WinBUGS/R/write.model.R =================================================================== --- trunk/R2WinBUGS/R/write.model.R 2009-10-20 13:52:03 UTC (rev 121) +++ trunk/R2WinBUGS/R/write.model.R 2009-10-26 12:44:56 UTC (rev 122) @@ -1,8 +1,9 @@ write.model <- function(model, con = "model.bug") { if (is.R()){ - model.text <- attr(model, "source") - model.text <- sub("^\\s*function\\s*\\(\\s*\\)", "model", model.text) + #model.text <- attr(model, "source") + #model.text <- sub("^\\s*function\\s*\\(\\s*\\)", "model", model.text) + model.text <- c("model", deparse(body(model))) } else { ## In S-PLUS the source code of a function can be obtained with ## as.character(function_name). This omits the "function_name <- function()" piece This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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-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: <gg...@us...> - 2009-10-20 13:52:10
|
Revision: 121 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=121&view=rev Author: ggorjan Date: 2009-10-20 13:52:03 +0000 (Tue, 20 Oct 2009) Log Message: ----------- - BRugsFit now saves model, data, and inits in working.directory, if the later is not NULL - bugsData and bugsInits gain dir argument Modified Paths: -------------- trunk/BRugs/DESCRIPTION trunk/BRugs/NEWS trunk/BRugs/R/BRugsFit.R trunk/BRugs/R/bugs.data.R trunk/BRugs/R/bugs.inits.R trunk/BRugs/man/bugs.data.Rd trunk/BRugs/man/bugs.inits.Rd Modified: trunk/BRugs/DESCRIPTION =================================================================== --- trunk/BRugs/DESCRIPTION 2009-10-20 13:50:20 UTC (rev 120) +++ trunk/BRugs/DESCRIPTION 2009-10-20 13:52:03 UTC (rev 121) @@ -1,6 +1,6 @@ Package: BRugs Title: OpenBUGS and its R / S-PLUS interface BRugs -Version: 0.5-1 +Version: 0.5-2 Date: 2009-04-05 Author: The Chief Software Bug is Andrew Thomas, with web assistance from Real Bug Bob O'Hara. Other members of the BUGS team are statisticians David Spiegelhalter, Nicky Best, Dave Lunn and Ken Rice. Dave Lunn has also made major contributions to the software development. R Code modified, extended and packaged for R by Uwe Ligges and Sibylle Sturtz. Some ideas taken from the R2WinBUGS package based on code by Andrew Gelman. Description: An R / S-PLUS package containing OpenBUGS and its R / S-PLUS interface BRugs. Modified: trunk/BRugs/NEWS =================================================================== --- trunk/BRugs/NEWS 2009-10-20 13:50:20 UTC (rev 120) +++ trunk/BRugs/NEWS 2009-10-20 13:52:03 UTC (rev 121) @@ -2,4 +2,7 @@ ===================== Update 0.5-2 +- BRugsFit now saves model, data, and inits in working.directory, if + the later is not NULL +- bugsData and bugsInits gain dir argument - added seed argument to BRugsFit() \ No newline at end of file Modified: trunk/BRugs/R/BRugsFit.R =================================================================== --- trunk/BRugs/R/BRugsFit.R 2009-10-20 13:50:20 UTC (rev 120) +++ trunk/BRugs/R/BRugsFit.R 2009-10-20 13:52:03 UTC (rev 121) @@ -9,27 +9,35 @@ op <- options("BRugsVerbose" = BRugsVerbose) on.exit(options(op)) if(!is.null(working.directory)){ + working.directory <- path.expand(working.directory) savedWD <- getwd() setwd(working.directory) on.exit(setwd(savedWD), add = TRUE) } if(is.function(modelFile)){ - writeModel(modelFile, con = (modelFile <- tempfile("model"))) - if(!is.R()) on.exit(file.remove(modelFile), add = TRUE) + if(!is.null(working.directory)) { + temp <- file.path(working.directory, "model.txt") + } else { + temp <- tempfile("model") + on.exit(file.remove(temp), add=TRUE) + } + writeModel(modelFile, con=temp) + modelFile <- temp } if(!file.exists(modelFile)) stop(modelFile, " does not exist") if(file.info(modelFile)$isdir) stop(modelFile, " is a directory, but a file is required") modelCheck(modelFile) if(!(is.vector(data) && is.character(data) && all(file.exists(data)))) - data <- bugsData(data, digits = digits) - modelData(data) + data <- bugsData(data, digits = digits, dir=working.directory) + modelData(data) modelCompile(numChains) if(!is.null(seed)) modelSetSeed(newSeed=seed) if(missing(inits)){ modelGenInits() } else { if(is.list(inits) || is.function(inits) || (is.character(inits) && !any(file.exists(inits)))) - inits <- bugsInits(inits = inits, numChains = numChains, digits = digits) + inits <- bugsInits(inits = inits, numChains = numChains, digits = digits, + dir=working.directory) if(BRugsVerbose) print(inits) modelInits(inits) } Modified: trunk/BRugs/R/bugs.data.R =================================================================== --- trunk/BRugs/R/bugs.data.R 2009-10-20 13:50:20 UTC (rev 120) +++ trunk/BRugs/R/bugs.data.R 2009-10-20 13:52:03 UTC (rev 121) @@ -1,5 +1,10 @@ "bugsData" <- -function(data, fileName = file.path(tempdir(), "data.txt"), digits = 5){ +function(data, fileName, digits = 5, dir) +{ + if(missing(fileName)) { + fileName <- file.path(ifelse(missing(dir), tempdir(), dir), + "data.txt") + } if(is.numeric(unlist(data))) if(is.R()) { write.datafile(lapply(data, formatC, digits = digits, format = "E"), fileName) Modified: trunk/BRugs/R/bugs.inits.R =================================================================== --- trunk/BRugs/R/bugs.inits.R 2009-10-20 13:50:20 UTC (rev 120) +++ trunk/BRugs/R/bugs.inits.R 2009-10-20 13:52:03 UTC (rev 121) @@ -1,7 +1,10 @@ "bugsInits" <- -function (inits, numChains = 1, fileName, digits = 5){ - if(missing(fileName)) - fileName <- file.path(tempdir(), paste("inits", 1:numChains, ".txt", sep = "")) +function (inits, numChains = 1, fileName, digits = 5, dir) +{ + if(missing(fileName)) { + fileName <- file.path(ifelse(missing(dir), tempdir(), dir), + paste("inits", 1:numChains, ".txt", sep="")) + } if(length(fileName) != numChains) stop("numChains = ", numChains, " filenames must be specified") if(!is.null(inits)){ Modified: trunk/BRugs/man/bugs.data.Rd =================================================================== --- trunk/BRugs/man/bugs.data.Rd 2009-10-20 13:50:20 UTC (rev 120) +++ trunk/BRugs/man/bugs.data.Rd 2009-10-20 13:52:03 UTC (rev 121) @@ -3,7 +3,7 @@ \title{Writing input for OpenBUGS} \description{Write data file for OpenBUGS.} \usage{ -bugsData(data, fileName = file.path(tempdir(), "data.txt"), digits = 5) +bugsData(data, fileName, digits = 5, dir) } \arguments{ \item{data}{either a named list (names corresponding to variable names in the model file) @@ -11,6 +11,7 @@ a vector or list of the names of the data objects used by the model} \item{fileName}{the filename, defaults to \file{data.txt} in the temporary directory of the current R session} \item{digits}{number of significant digits used for OpenBUGS input, see \code{\link{formatC}}} + \item{dir}{character, where to save data, defaults to temporary directory} } \value{ Invisibly returns the \code{fileName}. Modified: trunk/BRugs/man/bugs.inits.Rd =================================================================== --- trunk/BRugs/man/bugs.inits.Rd 2009-10-20 13:50:20 UTC (rev 120) +++ trunk/BRugs/man/bugs.inits.Rd 2009-10-20 13:52:03 UTC (rev 121) @@ -3,7 +3,7 @@ \title{Writing input for OpenBUGS} \description{Write files containing inits.} \usage{ -bugsInits(inits, numChains = 1, fileName, digits = 5) +bugsInits(inits, numChains = 1, fileName, digits = 5, dir) } \arguments{ \item{inits}{a list with \code{n.chains} elements; each element of the list is @@ -13,6 +13,7 @@ \item{fileName}{the filename(s), one for each chain. Defaults to \file{inits1.txt}, ..., \file{initsN.txt} in the temporary directory of the current R session.} \item{digits}{number of significant digits used for OpenBUGS input, see \code{\link{formatC}}} + \item{dir}{character, where to save data, defaults to temporary directory} } \value{ Invisibly returns the \code{fileName}(s). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gg...@us...> - 2009-10-20 13:50:39
|
Revision: 120 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=120&view=rev Author: ggorjan Date: 2009-10-20 13:50:20 +0000 (Tue, 20 Oct 2009) Log Message: ----------- rearangement Modified Paths: -------------- trunk/BRugs/inst/README-inst_OpenBUGS Modified: trunk/BRugs/inst/README-inst_OpenBUGS =================================================================== --- trunk/BRugs/inst/README-inst_OpenBUGS 2009-10-20 12:42:09 UTC (rev 119) +++ trunk/BRugs/inst/README-inst_OpenBUGS 2009-10-20 13:50:20 UTC (rev 120) @@ -1,27 +1,31 @@ -Here goes from the current OpenBUGS distribution: +REM This 'script' can help to automate the copying of needed files +REM for BRugs from the current OpenBUGS distribution: +REM +REM OpenBUGS +REM OpenBUGS/brugs.dll +REM OpenBUGS/brugs.so +REM OpenBUGS/libtaucs.dll +REM OpenBUGS/Examples/*.bmp +REM OpenBUGS/Examples/*.html +REM OpenBUGS/Examples/*.txt +REM OpenBUGS/Developer/*.bmp +REM OpenBUGS/Developer/*.html +REM OpenBUGS/Manuals/*.bmp +REM OpenBUGS/Manuals/*.html -OpenBUGS -OpenBUGS/brugs.dll -OpenBUGS/brugs.so -OpenBUGS/libtaucs.dll -OpenBUGS/Examples/*.bmp -OpenBUGS/Examples/*.html -OpenBUGS/Examples/*.txt -OpenBUGS/Developer/*.bmp -OpenBUGS/Developer/*.html -OpenBUGS/Manuals/*.bmp -OpenBUGS/Manuals/*.html +REM Set the directory path of latest OpenBUGS distribution +set OpenBUGS=C:/Programs/BUGS/OpenBUGS_latest -This can help to automate the copying: - -set OpenBUGS=C:/Programs/BUGS/OpenBUGS_3.0.3 - +REM Cleanup previous files and create the directory structure rm -Rf OpenBUGS mkdir OpenBUGS cd OpenBUGS mkdir Examples Developer Manuals -cp -f %OpenBUGS%/{brugs.dll,brugs.so,libtaucs.dll} . +REM Copy the files +cp -f %OpenBUGS%/libOpenBUGS.dll BRugs.dll +cp -f %OpenBUGS%/libOpenBUGS.so BRugs.so +cp -f %OpenBUGS%/libtaucs.dll . cp -f %OpenBUGS%/Examples/{*.bmp,*.html,*.txt} Examples/. cp -f %OpenBUGS%/Developer/{*.bmp,*.html} Developer/. cp -f %OpenBUGS%/Manuals/{*.bmp,*.html} Manuals/. \ No newline at end of file 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: Gorjanc G. <Gre...@bf...> - 2009-10-06 13:55:54
|
> Well, it worked for me so far if I execute all the code you gave above. > Hence the questions that arise are: If you run all the code it works, because N is available from the "main/global environment" - I am not particularly familiar with environments. However, if you remove object N, then the bugs.data() does not know how to get it from the function environment without setting as shown yesterday. gg |
From: Uwe L. <li...@st...> - 2009-10-06 13:42:50
|
Rodney Sparapani wrote: > Not sure if this got to the right place or not. > > > ------------------------------------------------------------------------ > > Subject: > Problem when calling R2WinBUGS within an R function (Error in > FUN(X[[1L]], ...) : variable "N" was not found) > From: > Polychronis Kostoulas <pk...@VE...> > Date: > Thu, 1 Oct 2009 05:57:45 -0500 > > > Dear WinBUGS and R users: > > I run the following lines (a simple example) in R to create a bugs data file: > > a=2;b=2; > dirname = paste("C:/a=",a,"/b=",b,sep="") > dir.create(dirname,recursive=T) > > x1=matrix(rbeta(100,a,a),nrow=10) > > nsims<-nrow(x1) > N<-ncol(x1) > > library(R2WinBUGS) > bugs.data(list("N","nsims", "x1"), dir=(dirname), data.file="data1.txt") > > When I use a function in order to perform this for different values of a and b I get an error message. Below are the function and the error message that R generates: > > test <- function(a,b) > { > dirname = paste("C:/a=",a,"/b=",b,sep="") > dir.create(dirname,recursive=T) > > x1=matrix(rbeta(100,a,a),nrow=10) > > nsims<-nrow(x1) > N<-ncol(x1) > > library(R2WinBUGS) > bugs.data(list("N","nsims", "x1"), dir=(dirname), data.file="data1.txt") > > } > > test(2,2) > Loading required package: coda > Loading required package: lattice > Error in FUN(X[[1L]], ...) : variable "N" was not found > It seems that the function does not "accept" the "N" in bugs.data. Any help is most wellcome! Well, it worked for me so far if I execute all the code you gave above. Hence the questions that arise are: R version? (assuming R-2.9.2) R2WinBUGS version? (assuming 2.1-14) If you have older versions, please upgrade. Best, Uwe Ligges > Pol > > > =========================================== > Polychronis P. Kostoulas > D.V.M., Ph.D., SVEPM, IAP, Lecturer > Laboratory of Epidemiology, Biostatistics and Animal Health Economics > School of Veterinary Medicine > University of Thessaly > Karditsa, 224 Trikalon st. > GREECE. P.C. 43100 > Telephone: +30 2441066022 > Fax: +30 2441066047 > Email: pk...@ve...<mailto:pk...@ve...> > =========================================== > > ------------------------------------------------------------------- This list is for discussion of modelling issues and the BUGS software. For help with crashes and error messages, first mail bu...@mr... To mail the BUGS list, mail to bu...@ji... Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html Please do not mail attachments to the list. To leave the BUGS list, send LEAVE BUGS to jis...@ji... If this fails, mail bug...@ji..., NOT the whole list > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® 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/devconf > > > ------------------------------------------------------------------------ > > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
From: Gorjanc G. <Gre...@bf...> - 2009-10-05 06:50:45
|
Polychronis , ... > test(2,2) > Loading required package: coda > Loading required package: lattice > Error in FUN(X[[1L]], ...) : variable "N" was not found > It seems that the function does not "accept" the "N" in bugs.data. Any help is most wellcome! I have been bitten several times due to this error. I do not know the exact answer why this happens, but the following should help you - instead of bugs.data(list("N","nsims", "x1"), dir=(dirname), data.file="data1.txt") use bugs.data(list(N=N, nsims=nsims, x1=x1), dir=(dirname), data.file="data1.txt") Regards, gg |
From: Rodney S. <rsp...@mc...> - 2009-10-02 20:35:55
|
Not sure if this got to the right place or not. -- Rodney Sparapani Center for Patient Care & Outcomes Research (PCOR) Sr. Biostatistician http://www.mcw.edu/pcor 4 wheels good, 2 wheels better! Medical College of Wisconsin (MCW) WWLD?: What Would Lombardi Do? Milwaukee, WI, USA |
From: <gg...@us...> - 2009-07-14 22:07:57
|
Revision: 118 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=118&view=rev Author: ggorjan Date: 2009-07-14 22:07:35 +0000 (Tue, 14 Jul 2009) Log Message: ----------- Add the rm bit Modified Paths: -------------- trunk/BRugs/inst/README-inst_OpenBUGS Modified: trunk/BRugs/inst/README-inst_OpenBUGS =================================================================== --- trunk/BRugs/inst/README-inst_OpenBUGS 2009-07-13 13:02:56 UTC (rev 117) +++ trunk/BRugs/inst/README-inst_OpenBUGS 2009-07-14 22:07:35 UTC (rev 118) @@ -16,6 +16,7 @@ set OpenBUGS=C:/Programs/BUGS/OpenBUGS_3.0.3 +rm -Rf OpenBUGS mkdir OpenBUGS cd OpenBUGS mkdir Examples Developer Manuals This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gg...@us...> - 2009-07-13 13:03:23
|
Revision: 117 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=117&view=rev Author: ggorjan Date: 2009-07-13 13:02:56 +0000 (Mon, 13 Jul 2009) Log Message: ----------- Added seed to BRugsFit(). Added NEWS file and some notes for easier copying of BUGS files. Modified Paths: -------------- trunk/BRugs/R/BRugsFit.R trunk/BRugs/inst/README-inst_OpenBUGS trunk/BRugs/man/BRugsFit.Rd Added Paths: ----------- trunk/BRugs/NEWS Added: trunk/BRugs/NEWS =================================================================== --- trunk/BRugs/NEWS (rev 0) +++ trunk/BRugs/NEWS 2009-07-13 13:02:56 UTC (rev 117) @@ -0,0 +1,5 @@ +Changes to BRugs: +===================== + +Update 0.5-2 +- added seed argument to BRugsFit() \ No newline at end of file Modified: trunk/BRugs/R/BRugsFit.R =================================================================== --- trunk/BRugs/R/BRugsFit.R 2009-07-13 11:14:17 UTC (rev 116) +++ trunk/BRugs/R/BRugsFit.R 2009-07-13 13:02:56 UTC (rev 117) @@ -1,7 +1,7 @@ BRugsFit <- function(modelFile, data, inits, numChains = 3, parametersToSave, nBurnin = 1000, nIter = 1000, nThin = 1, coda = FALSE, - DIC = TRUE, working.directory = NULL, digits = 5, + DIC = TRUE, working.directory = NULL, digits = 5, seed=NULL, BRugsVerbose = getOption("BRugsVerbose")){ if(is.null(BRugsVerbose)) @@ -24,10 +24,10 @@ data <- bugsData(data, digits = digits) modelData(data) modelCompile(numChains) + if(!is.null(seed)) modelSetSeed(newSeed=seed) if(missing(inits)){ modelGenInits() - } - else{ + } else { if(is.list(inits) || is.function(inits) || (is.character(inits) && !any(file.exists(inits)))) inits <- bugsInits(inits = inits, numChains = numChains, digits = digits) if(BRugsVerbose) print(inits) Modified: trunk/BRugs/inst/README-inst_OpenBUGS =================================================================== --- trunk/BRugs/inst/README-inst_OpenBUGS 2009-07-13 11:14:17 UTC (rev 116) +++ trunk/BRugs/inst/README-inst_OpenBUGS 2009-07-13 13:02:56 UTC (rev 117) @@ -11,3 +11,16 @@ OpenBUGS/Developer/*.html OpenBUGS/Manuals/*.bmp OpenBUGS/Manuals/*.html + +This can help to automate the copying: + +set OpenBUGS=C:/Programs/BUGS/OpenBUGS_3.0.3 + +mkdir OpenBUGS +cd OpenBUGS +mkdir Examples Developer Manuals + +cp -f %OpenBUGS%/{brugs.dll,brugs.so,libtaucs.dll} . +cp -f %OpenBUGS%/Examples/{*.bmp,*.html,*.txt} Examples/. +cp -f %OpenBUGS%/Developer/{*.bmp,*.html} Developer/. +cp -f %OpenBUGS%/Manuals/{*.bmp,*.html} Manuals/. \ No newline at end of file Modified: trunk/BRugs/man/BRugsFit.Rd =================================================================== --- trunk/BRugs/man/BRugsFit.Rd 2009-07-13 11:14:17 UTC (rev 116) +++ trunk/BRugs/man/BRugsFit.Rd 2009-07-13 13:02:56 UTC (rev 117) @@ -5,7 +5,7 @@ \usage{ BRugsFit(modelFile, data, inits, numChains = 3, parametersToSave, nBurnin = 1000, nIter = 1000, nThin = 1, coda = FALSE, - DIC = TRUE, working.directory = NULL, digits = 5, + DIC = TRUE, working.directory = NULL, digits = 5, seed=NULL, BRugsVerbose = getOption("BRugsVerbose")) } \arguments{ @@ -37,6 +37,8 @@ is explicitly given in those arguments. If \code{NULL}, the current working directory is chosen.} \item{digits}{Number of significant digits used for OpenBUGS input, see \code{\link{formatC}}.} +\item{seed}{Positive non-zero integer value(s) to set seed for random number + generator - default is no seed (see \code{\link{modelSetSeed}}).} \item{BRugsVerbose}{Logical, whether BRugs is supposed to be verbose. This can be controlled for the whole BRugs package by 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-07-13 10:16:36
|
Revision: 115 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=115&view=rev Author: ggorjan Date: 2009-07-13 10:16:15 +0000 (Mon, 13 Jul 2009) Log Message: ----------- compute sampleStats only if coda=FALSE Modified Paths: -------------- trunk/BRugs/R/BRugsFit.R Modified: trunk/BRugs/R/BRugsFit.R =================================================================== --- trunk/BRugs/R/BRugsFit.R 2009-07-13 08:57:05 UTC (rev 114) +++ trunk/BRugs/R/BRugsFit.R 2009-07-13 10:16:15 UTC (rev 115) @@ -41,10 +41,8 @@ } samplesSet(parametersToSave) modelUpdate(nIter) - sims <- samplesStats("*") -# class(sims) <- "BRugsFit" if(coda) return(buildMCMC("*")) else - return(list(Stats = sims, DIC = if(DIC) dicStats())) + return(list(Stats = samplesStats("*"), DIC = if(DIC) dicStats())) } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gg...@us...> - 2009-07-13 08:57:19
|
Revision: 114 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=114&view=rev Author: ggorjan Date: 2009-07-13 08:57:05 +0000 (Mon, 13 Jul 2009) Log Message: ----------- Removed duplicated "and" Modified Paths: -------------- trunk/BRugs/man/BRugs.Rd Modified: trunk/BRugs/man/BRugs.Rd =================================================================== --- trunk/BRugs/man/BRugs.Rd 2009-05-07 11:33:12 UTC (rev 113) +++ trunk/BRugs/man/BRugs.Rd 2009-07-13 08:57:05 UTC (rev 114) @@ -20,7 +20,7 @@ initial values. However BRugs always uses plain text files for input inplace of WinBUGS compound documents. The BRugs functions can be split into two groups: those associated with setting up and simulating the graphical model and those associated with making statistical inference. In general the R functions in BRugs correspond to the - command buttons and and text entry fields in the menus of WinBUGS. Each WinBUGS text entry field splits into two + command buttons and text entry fields in the menus of WinBUGS. Each WinBUGS text entry field splits into two R functions, one to set the quantity and the other to get the value of the quantity. Andrew Gelman suggests to use the function \code{bugs} in the \pkg{R2WinBUGS} package This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <li...@us...> - 2009-05-07 11:33:29
|
Revision: 113 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=113&view=rev Author: ligges Date: 2009-05-07 11:33:12 +0000 (Thu, 07 May 2009) Log Message: ----------- we cannot expect non-Windows support for repository handling issues OS support has been restricted to windows now Modified Paths: -------------- trunk/BRugs/DESCRIPTION Modified: trunk/BRugs/DESCRIPTION =================================================================== --- trunk/BRugs/DESCRIPTION 2009-04-05 19:03:08 UTC (rev 112) +++ trunk/BRugs/DESCRIPTION 2009-05-07 11:33:12 UTC (rev 113) @@ -6,6 +6,6 @@ Description: An R / S-PLUS package containing OpenBUGS and its R / S-PLUS interface BRugs. Maintainer: Uwe Ligges <li...@st...> Depends: R (>= 2.5.0), coda -SystemRequirements: currently the only supported OS is Windows, we expect to support Linux in future releases +OS_type: windows License: GPL-2 URL: http://mathstat.helsinki.fi/openbugs/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <li...@us...> - 2009-04-05 19:03:12
|
Revision: 112 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=112&view=rev Author: ligges Date: 2009-04-05 19:03:08 +0000 (Sun, 05 Apr 2009) Log Message: ----------- improvements (internal functions) and bugfixes as suggested by Richard Cotton - thank you very much! Modified Paths: -------------- trunk/BRugs/R/bgr.grid.R trunk/BRugs/R/bgr.point.R trunk/BRugs/R/buildMCMC.R trunk/BRugs/R/current.values.R trunk/BRugs/R/dic.clear.R trunk/BRugs/R/dic.set.R trunk/BRugs/R/dic.stats.R trunk/BRugs/R/dimensions.R trunk/BRugs/R/get.chain.R trunk/BRugs/R/get.num.chains.R trunk/BRugs/R/model.adaptivePhase.R trunk/BRugs/R/model.check.R trunk/BRugs/R/model.compile.R trunk/BRugs/R/model.data.R trunk/BRugs/R/model.dynamic.R trunk/BRugs/R/model.factory.R trunk/BRugs/R/model.gen.inits.R trunk/BRugs/R/model.get.seed.R trunk/BRugs/R/model.inits.R trunk/BRugs/R/model.iteration.R trunk/BRugs/R/model.modules.R trunk/BRugs/R/model.names.R trunk/BRugs/R/model.precision.R trunk/BRugs/R/model.save.state.R trunk/BRugs/R/model.set.seed.R trunk/BRugs/R/model.setAP.R trunk/BRugs/R/model.setIts.R trunk/BRugs/R/model.setOR.R trunk/BRugs/R/model.update.R trunk/BRugs/R/plot.autoC.R trunk/BRugs/R/plot.density.R trunk/BRugs/R/plot.history.R trunk/BRugs/R/ranks.clear.R trunk/BRugs/R/ranks.set.R trunk/BRugs/R/ranks.stats.R trunk/BRugs/R/samples.clear.R trunk/BRugs/R/samples.coda.R trunk/BRugs/R/samples.correl.R trunk/BRugs/R/samples.get.beg.R trunk/BRugs/R/samples.get.end.R trunk/BRugs/R/samples.get.firstChain.R trunk/BRugs/R/samples.get.lastChain.R trunk/BRugs/R/samples.get.thin.R trunk/BRugs/R/samples.monitors.R trunk/BRugs/R/samples.sample.R trunk/BRugs/R/samples.set.R trunk/BRugs/R/samples.set.beg.R trunk/BRugs/R/samples.set.end.R trunk/BRugs/R/samples.set.firstChain.R trunk/BRugs/R/samples.set.lastChain.R trunk/BRugs/R/samples.set.thin.R trunk/BRugs/R/samples.size.R trunk/BRugs/R/samples.stats.R trunk/BRugs/R/set.values.R trunk/BRugs/R/summary.clear.R trunk/BRugs/R/summary.set.R trunk/BRugs/R/summary.stats.R trunk/BRugs/R/zzz.R Added Paths: ----------- trunk/BRugs/R/internal.R Modified: trunk/BRugs/R/bgr.grid.R =================================================================== --- trunk/BRugs/R/bgr.grid.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/bgr.grid.R 2009-04-05 19:03:08 UTC (rev 112) @@ -2,11 +2,7 @@ function(node, bins = 50) # Calculate grid of points at which to evaluate bgr statistic { - command <- paste("SamplesEmbed.SetVariable(", sQuote(node), ") END") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") - command <- paste("SamplesEmbed.SampleSize") - sampleSize <- as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[[3]]) + sampleSize <- samplesSize(node) beg <- samplesGetBeg() end <- min(c(samplesGetEnd(), modelIteration())) numChains <- samplesGetLastChain() - samplesGetFirstChain() + 1 Modified: trunk/BRugs/R/bgr.point.R =================================================================== --- trunk/BRugs/R/bgr.point.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/bgr.point.R 2009-04-05 19:03:08 UTC (rev 112) @@ -6,18 +6,9 @@ on.exit(samplesSetEnd(oldEnd)) samplesSetEnd(as.integer(iteration)) numChains <- getNumChains() - command <- paste("SamplesEmbed.SetVariable(", sQuote(node), ")") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") - command <- "SamplesEmbed.SampleSize" - sampleSize <- as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[[3]]) + sampleSize <- samplesSize(node) command <- "SamplesEmbed.SampleValues" - if (is.R()) - sample <- .C("RealArray", command, nchar(command), real(sampleSize), - as.integer(sampleSize), integer(1), PACKAGE="BRugs")[[3]] - else - sample <- .C("RealArray", command, nchar(command), double(sampleSize), - as.integer(sampleSize), integer(1), PACKAGE="BRugs")[[3]] + sample <- samplesSample(node) lenChain <- sampleSize %/% numChains if (is.R()) dq <- quantile(sample, c(0.1, 0.9), names = FALSE) Modified: trunk/BRugs/R/buildMCMC.R =================================================================== --- trunk/BRugs/R/buildMCMC.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/buildMCMC.R 2009-04-05 19:03:08 UTC (rev 112) @@ -30,31 +30,12 @@ sM <- samplesMonitors(node) if(length(sM) > 1 || sM != node) stop("node must be a scalar variable from the model, for arrays use samplesAutoC") - nodeName <- sQuote(node) - command <- paste("SamplesEmbed.SetVariable(", nodeName, ")") - .C("CmdInterpreter", command, nchar(command), integer(1), - PACKAGE = "BRugs") - command <- "SamplesEmbed.SampleSize" - sampleSize <- as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE = "BRugs")[[3]]) - command <- "SamplesEmbed.SampleValues" - if (is.R()) - sample <- .C("RealArray", command, nchar(command), real(sampleSize), - sampleSize, integer(1), PACKAGE = "BRugs")[[3]] - else - sample <- .C("RealArray", command, nchar(command), double(sampleSize), - sampleSize, integer(1), PACKAGE = "BRugs")[[3]] + sample <- samplesSample(node) numChains <- samplesGetLastChain() - samplesGetFirstChain() + 1 matrix(sample, ncol = numChains) } - nodeName <- sQuote(mons[1]) - command <- paste("SamplesEmbed.SetVariable(", nodeName, ")") - .C("CmdInterpreter", command, nchar(command), integer(1), - PACKAGE = "BRugs") - command <- "SamplesEmbed.SampleSize" - sampleSize <- as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE = "BRugs")[[3]]) + sampleSize <- samplesSize(mons[1]) end <- min(c(modelIteration(), samplesGetEnd())) thin <- samplesGetThin() numChains <- samplesGetLastChain() - samplesGetFirstChain() + 1 Modified: trunk/BRugs/R/current.values.R =================================================================== --- trunk/BRugs/R/current.values.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/current.values.R 2009-04-05 19:03:08 UTC (rev 112) @@ -7,10 +7,10 @@ len <- nchar(command) .C("CharArray", command, as.integer(len), nodeLabel, nchar(nodeLabel), integer(1), PACKAGE="BRugs") command <- "BugsRobjects.GetSize" - nodeSize <- .C("Integer", command, nchar(command), integer(1), integer(1), PACKAGE="BRugs")[[3]] + nodeSize <- .Integer(command) if(nodeSize == -1) stop(nodeLabel, " is not a node in BUGS model") command <- "BugsRobjects.GetValues" - .C("RealArray", command, nchar(command), as.real(rep(NA, nodeSize)), + .C("RealArray", command, nchar(command), as.double(rep(NA, nodeSize)), as.integer(nodeSize), integer(1), NAOK = TRUE, PACKAGE="BRugs")[[3]] } Modified: trunk/BRugs/R/dic.clear.R =================================================================== --- trunk/BRugs/R/dic.clear.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/dic.clear.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,6 +3,5 @@ # Clear monitor for dic { command <- "DevianceEmbed.StatsGuard;DevianceEmbed.Clear" - invisible(.C("CmdInterpreter", command, nchar(command), - integer(1), PACKAGE="BRugs")) + invisible(.CmdInterpreter(command)) } Modified: trunk/BRugs/R/dic.set.R =================================================================== --- trunk/BRugs/R/dic.set.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/dic.set.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,7 +3,7 @@ # Set a monitor for dic { command <- "DevianceEmbed.SetVariable('*');DevianceEmbed.SetGuard;DevianceEmbed.Set" - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) if(getOption("BRugsVerbose")) buffer() } Modified: trunk/BRugs/R/dic.stats.R =================================================================== --- trunk/BRugs/R/dic.stats.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/dic.stats.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,7 +3,7 @@ # Calculate dic statistics { command <- "DevianceEmbed.SetVariable('*');DevianceEmbed.StatsGuard;DevianceEmbed.Stats" - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) buffer <- file.path(tempdir(), "buffer.txt") rlb <- readLines(buffer) len <- length(rlb) Modified: trunk/BRugs/R/dimensions.R =================================================================== --- trunk/BRugs/R/dimensions.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/dimensions.R 2009-04-05 19:03:08 UTC (rev 112) @@ -9,8 +9,7 @@ .C("CharArray", command, nchar(command), as.character(nodeLabel), nchar(nodeLabel), integer(1), PACKAGE="BRugs") command <- "BugsRobjects.NumSlots" - numSlots <- as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[3]) + numSlots <- .Integer(command) dimensions <- integer(numSlots) command <- "BugsRobjects.Dimensions" if (numSlots > 0) Modified: trunk/BRugs/R/get.chain.R =================================================================== --- trunk/BRugs/R/get.chain.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/get.chain.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,5 +3,5 @@ # Get chain field { command<- "BugsEmbed.chain" - as.integer(.C("Integer", command, nchar(command), integer(1), integer(1), PACKAGE="BRugs")[[3]]) + .Integer(command) } Modified: trunk/BRugs/R/get.num.chains.R =================================================================== --- trunk/BRugs/R/get.num.chains.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/get.num.chains.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,6 +3,5 @@ # Get numChains field { command<- "BugsEmbed.numChains" - as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[[3]]) + .Integer(command) } Added: trunk/BRugs/R/internal.R =================================================================== --- trunk/BRugs/R/internal.R (rev 0) +++ trunk/BRugs/R/internal.R 2009-04-05 19:03:08 UTC (rev 112) @@ -0,0 +1,22 @@ +.CmdInterpreter <- function(command) +{ + command <- as.character(command) + res <- .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE = "BRugs") + handleRes(res[[3]]) + return(res) +} + +.Integer <- function(command) +{ + values <- .C("Integer", command, nchar(command), integer(1), integer(1), PACKAGE = "BRugs") + handleRes(values[[4]]) + as.integer(values[[3]]) +} + +handleRes <- function(res) +{ + switch(res, + stop("An OpenBUGS module or procedure was called that did not exist."), + stop("An OpenBUGS procedure was called with the wrong type of argument."), + stop("An OpenBUGS procedure was called with the wrong signature.")) +} Modified: trunk/BRugs/R/model.adaptivePhase.R =================================================================== --- trunk/BRugs/R/model.adaptivePhase.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.adaptivePhase.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,6 +3,5 @@ # Get endOfAdapting field { command <- "BugsInterface.endOfAdapting" - (as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[[3]])) - 1 + .Integer(command) - 1 } Modified: trunk/BRugs/R/model.check.R =================================================================== --- trunk/BRugs/R/model.check.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.check.R 2009-04-05 19:03:08 UTC (rev 112) @@ -12,10 +12,10 @@ command <- paste("BugsEmbed.SetFilePath(", sQuote(fileName), ");BugsEmbed.ParseGuard;BugsEmbed.Parse", sep = "") if (!is.R()) { - command <- gsub ("\\\\", "/", command) - command <- gsub ("//", "/", command) + command <- gsub ("\\\\", "/", command) + command <- gsub ("//", "/", command) } - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE = "BRugs") + .CmdInterpreter(command) if(getOption("BRugsVerbose")) buffer() } Modified: trunk/BRugs/R/model.compile.R =================================================================== --- trunk/BRugs/R/model.compile.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.compile.R 2009-04-05 19:03:08 UTC (rev 112) @@ -7,7 +7,7 @@ numChains <- as.integer(numChains) command <- paste("BugsEmbed.CompileGuard", ";BugsEmbed.numChains :=", as.character(numChains), "; BugsEmbed.Compile", sep = "") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) samplesSetFirstChain(1) samplesSetLastChain(numChains) if(getOption("BRugsVerbose")) Modified: trunk/BRugs/R/model.data.R =================================================================== --- trunk/BRugs/R/model.data.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.data.R 2009-04-05 19:03:08 UTC (rev 112) @@ -14,9 +14,9 @@ ");BugsEmbed.LoadDataGuard;BugsEmbed.LoadData", sep = "") if (!is.R()){ command <- gsub ("\\\\", "/", command) - command <- gsub ("//", "/", command) + command <- gsub ("//", "/", command) } - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) if(getOption("BRugsVerbose")) buffer() } Modified: trunk/BRugs/R/model.dynamic.R =================================================================== --- trunk/BRugs/R/model.dynamic.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.dynamic.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,7 +3,7 @@ # Enable Dynamic Compilation { command <- "BugsEmbed.CompiledGuard; BugsEmbed.EnableDynamic" - invisible(.C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs")[[3]]) + invisible(.CmdInterpreter(command)[[3]]) } "modelDisableDynamic" <- @@ -11,5 +11,5 @@ # Disable Dynamic Compilation { command <- "BugsEmbed.CompiledGuard; BugsEmbed.DisableDynamic" - invisible(.C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs")[[3]]) + invisible(.CmdInterpreter(command)[[3]]) } Modified: trunk/BRugs/R/model.factory.R =================================================================== --- trunk/BRugs/R/model.factory.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.factory.R 2009-04-05 19:03:08 UTC (rev 112) @@ -1,11 +1,11 @@ modelDisable <- function(factory){ command <- paste("UpdaterMethods.SetFactory('", factory,"');UpdaterMethods.Disable", sep = "") - invisible(.C("CmdInterpreter", command, nchar(command), integer(1))) + invisible(.CmdInterpreter(command)) } modelEnable <- function(factory){ command <- paste("UpdaterMethods.SetFactory('", factory,"');UpdaterMethods.Enable", sep = "") - invisible(.C("CmdInterpreter", command, nchar(command), integer(1))) + invisible(.CmdInterpreter(command)) } Modified: trunk/BRugs/R/model.gen.inits.R =================================================================== --- trunk/BRugs/R/model.gen.inits.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.gen.inits.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,8 +3,7 @@ # Generate initial values for OpenBUGS model { command <- paste("BugsEmbed.GenerateInitsGuard;", "BugsEmbed.GenerateInits") - .C("CmdInterpreter", command, nchar(command), - integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) if(getOption("BRugsVerbose")) buffer() } Modified: trunk/BRugs/R/model.get.seed.R =================================================================== --- trunk/BRugs/R/model.get.seed.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.get.seed.R 2009-04-05 19:03:08 UTC (rev 112) @@ -5,7 +5,7 @@ if(!is.numeric(i)) stop("i ", "must be numeric") command <- paste("BugsEmbed.index := ", as.integer(i), ";BugsEmbed.GetRNState") - res <- .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs")[[3]] + res <- .CmdInterpreter(command)[[3]] if(res) stop("Getting seed returned with an error.") buffer() } Modified: trunk/BRugs/R/model.inits.R =================================================================== --- trunk/BRugs/R/model.inits.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.inits.R 2009-04-05 19:03:08 UTC (rev 112) @@ -24,9 +24,9 @@ as.character(chainNum[i]), "; BugsEmbed.LoadInits") if (!is.R()){ command <- gsub ("\\\\", "/", command) - command <- gsub ("//", "/", command) + command <- gsub ("//", "/", command) } - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) if(getOption("BRugsVerbose")){ cat("Initializing chain ", chainNum[i], ": ", sep="") buffer() Modified: trunk/BRugs/R/model.iteration.R =================================================================== --- trunk/BRugs/R/model.iteration.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.iteration.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,6 +3,5 @@ # Get iteration field { command <- "BugsEmbed.iteration" - as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[[3]]) + .Integer(command) } Modified: trunk/BRugs/R/model.modules.R =================================================================== --- trunk/BRugs/R/model.modules.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.modules.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,7 +3,7 @@ # List loaded OpenBUGS components { command <- "BugsEmbed.Modules" - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) buffer <- file.path(tempdir(), "buffer.txt") result <- read.fwf(buffer, c(50, 12, 12, 12, 12, 10), skip = 1, as.is=TRUE) for(i in c(1,4,5,6)) Modified: trunk/BRugs/R/model.names.R =================================================================== --- trunk/BRugs/R/model.names.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.names.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,14 +3,14 @@ { # gets names in OpenBUGS model command <- "BugsRobjects.GetNumberNames" - number <- .C("Integer", command, nchar(command), integer(1), integer(1), PACKAGE="BRugs")[[3]] + number <- .Integer(command) name <- character(number) if(length(number)){ for(i in 1:number){ command <- paste("BugsRobjects.SetIndex(", i-1, ")", sep="") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) command <- "BugsRobjects.GetStringLength" - numchar <- .C("Integer", command, nchar(command), integer(1), integer(1), PACKAGE="BRugs")[[3]] + numchar <- .Integer(command) command <- "BugsRobjects.GetVariable" char <- paste(rep(" ", numchar), collapse="") name[i] <- .C("CharArray", command, nchar(command), char, numchar, integer(1), PACKAGE="BRugs")[[3]] Modified: trunk/BRugs/R/model.precision.R =================================================================== --- trunk/BRugs/R/model.precision.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.precision.R 2009-04-05 19:03:08 UTC (rev 112) @@ -6,6 +6,5 @@ stop("prec ", "must be numeric") prec <- as.integer(prec) command <- paste("BugsMappers.SetPrec(", prec, ")") - invisible(.C("CmdInterpreter", command, nchar(command), - integer(1), PACKAGE="BRugs")) + invisible(.CmdInterpreter(command)) } Modified: trunk/BRugs/R/model.save.state.R =================================================================== --- trunk/BRugs/R/model.save.state.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.save.state.R 2009-04-05 19:03:08 UTC (rev 112) @@ -1,9 +1,8 @@ "modelSaveState" <- function(stem) { # Saves the sate of each chain in OpenBUGS model - command <- paste("BugsEmbed.UpdateGuard", - ";BugsEmbed.WriteChains(", sQuote(stem), ")") - .C("CmdInterpreter", as.character(command), nchar(command), integer(1), PACKAGE="BRugs") - if(getOption("BRugsVerbose")) + command <- paste("BugsEmbed.UpdateGuard", ";BugsEmbed.WriteChains(", sQuote(stem), ")") + .CmdInterpreter(command) + if(getOption("BRugsVerbose")) buffer() } Modified: trunk/BRugs/R/model.set.seed.R =================================================================== --- trunk/BRugs/R/model.set.seed.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.set.seed.R 2009-04-05 19:03:08 UTC (rev 112) @@ -8,7 +8,7 @@ for(i in seq(along=newSeed)){ command <- paste("BugsEmbed.index :=", i, "; BugsEmbed.new :=", newSeed[i], ";BugsEmbed.SetRNGuard; BugsEmbed.SetRNState") - res <- .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs")[[3]] + res <- .CmdInterpreter(command)[[3]] } if(!res){ if(getOption("BRugsVerbose")) Modified: trunk/BRugs/R/model.setAP.R =================================================================== --- trunk/BRugs/R/model.setAP.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.setAP.R 2009-04-05 19:03:08 UTC (rev 112) @@ -8,5 +8,5 @@ "UpdaterMethods.SetAdaptivePhase(", adaptivePhase, ")", sep = "") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) } Modified: trunk/BRugs/R/model.setIts.R =================================================================== --- trunk/BRugs/R/model.setIts.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.setIts.R 2009-04-05 19:03:08 UTC (rev 112) @@ -8,5 +8,5 @@ "UpdaterMethods.SetIterations(", iterations, ")", sep = "") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) } Modified: trunk/BRugs/R/model.setOR.R =================================================================== --- trunk/BRugs/R/model.setOR.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.setOR.R 2009-04-05 19:03:08 UTC (rev 112) @@ -8,5 +8,5 @@ "UpdaterMethods.SetOverRelaxation(", overRelaxation, ")", sep = "") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) } Modified: trunk/BRugs/R/model.update.R =================================================================== --- trunk/BRugs/R/model.update.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/model.update.R 2009-04-05 19:03:08 UTC (rev 112) @@ -15,7 +15,7 @@ ";BugsEmbed.overRelax := ", as.integer(overRelax), ";BugsEmbed.updates := ", numUpdates, ";BugsEmbed.Update") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) if(getOption("BRugsVerbose")) buffer() } Modified: trunk/BRugs/R/plot.autoC.R =================================================================== --- trunk/BRugs/R/plot.autoC.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/plot.autoC.R 2009-04-05 19:03:08 UTC (rev 112) @@ -7,22 +7,7 @@ if(length(sM) > 1 || sM != node) stop("node must be a scalar variable from the model, for arrays use samplesAutoC") nodeName <- sQuote(node) - command <- paste("SamplesEmbed.SetVariable(", nodeName, ")") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") - command <- "SamplesEmbed.SampleSize" - if (is.R()) - sampleSize <- as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[3]) - else - sampleSize <- as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[[3]]) - command <- "SamplesEmbed.SampleValues" - if (is.R()) - sample <- .C("RealArray", command, nchar(command), real(sampleSize), - as.integer(sampleSize), integer(1), PACKAGE="BRugs")[[3]] - else - sample <- .C("RealArray", command, nchar(command), double(sampleSize), - as.integer(sampleSize), integer(1), PACKAGE="BRugs")[[3]] + sample <- samplesSample(node) chain <- samplesGetFirstChain() if (sd(sample) > 1.0E-10) acfresult <- acf(sample, col = colour[chain], main = if(is.null(main)) nodeName else main, Modified: trunk/BRugs/R/plot.density.R =================================================================== --- trunk/BRugs/R/plot.density.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/plot.density.R 2009-04-05 19:03:08 UTC (rev 112) @@ -6,18 +6,8 @@ if(length(sM) > 1 || sM != node) stop("node must be a scalar variable from the model, for arrays use samplesDensity") nodeName <- sQuote(node) - command <- paste("SamplesEmbed.SetVariable(", nodeName, ")") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") - command <- "SamplesEmbed.SampleSize" - sampleSize <- as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[[3]]) - command <- "SamplesEmbed.SampleValues" - if (is.R()) - sample <- .C("RealArray", command, nchar(command), real(sampleSize), - as.integer(sampleSize), integer(1), PACKAGE="BRugs")[[3]] - else - sample <- .C("RealArray", command, nchar(command), double(sampleSize), - as.integer(sampleSize), integer(1), PACKAGE="BRugs")[[3]] + sampleSize <- samplesSize(node) + sample <- samplesSample(node) absSample <- abs(sample) intSample <- as.integer(absSample + 1.0E-10) Modified: trunk/BRugs/R/plot.history.R =================================================================== --- trunk/BRugs/R/plot.history.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/plot.history.R 2009-04-05 19:03:08 UTC (rev 112) @@ -7,23 +7,8 @@ if(length(sM) > 1 || sM != node) stop("node must be a scalar variable from the model, for arrays use samplesHistory") nodeName <- sQuote(node) - command <- paste("SamplesEmbed.SetVariable(", nodeName, ")") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") - command <- "SamplesEmbed.SampleSize" - if (is.R()){ - sampleSize <- as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[3]) - } else { - sampleSize <- as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[3][[1]]) - } - command <- "SamplesEmbed.SampleValues" - if (is.R()) - sample <- .C("RealArray", command, nchar(command), real(sampleSize), - sampleSize, integer(1), PACKAGE="BRugs")[[3]] - else - sample <- .C("RealArray", command, nchar(command), double(sampleSize), - sampleSize, integer(1), PACKAGE="BRugs")[[3]] + sampleSize <- samplesSize(node) + sample <- samplesSample(node) end <- min(c(modelIteration(), samplesGetEnd())) thin <- samplesGetThin() numChains <- samplesGetLastChain() - samplesGetFirstChain() + 1 Modified: trunk/BRugs/R/ranks.clear.R =================================================================== --- trunk/BRugs/R/ranks.clear.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/ranks.clear.R 2009-04-05 19:03:08 UTC (rev 112) @@ -5,7 +5,7 @@ nodeName <- sQuote(node) command <- paste("RanksEmbed.SetVariable(", nodeName, "); RanksEmbed.StatsGuard;", "RanksEmbed.Clear") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) if(getOption("BRugsVerbose")) buffer() } Modified: trunk/BRugs/R/ranks.set.R =================================================================== --- trunk/BRugs/R/ranks.set.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/ranks.set.R 2009-04-05 19:03:08 UTC (rev 112) @@ -5,7 +5,7 @@ nodeName <- sQuote(node) command <- paste("RanksEmbed.SetVariable(", nodeName, "); RanksEmbed.SetGuard;", "RanksEmbed.Set") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) if(getOption("BRugsVerbose")) buffer() } Modified: trunk/BRugs/R/ranks.stats.R =================================================================== --- trunk/BRugs/R/ranks.stats.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/ranks.stats.R 2009-04-05 19:03:08 UTC (rev 112) @@ -7,7 +7,7 @@ nodeName <- sQuote(node) command <- paste("RanksEmbed.SetVariable(", nodeName, "); RanksEmbed.StatsGuard;", "RanksEmbed.Stats") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) buffer <- file.path(tempdir(), "buffer.txt") rlb <- readLines(buffer) len <- length(rlb) Modified: trunk/BRugs/R/samples.clear.R =================================================================== --- trunk/BRugs/R/samples.clear.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.clear.R 2009-04-05 19:03:08 UTC (rev 112) @@ -5,7 +5,7 @@ nodeName <- sQuote(node) command <- paste("SamplesEmbed.SetVariable(", nodeName, ");SamplesEmbed.HistoryGuard;SamplesEmbed.Clear") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) if(getOption("BRugsVerbose")) buffer() } Modified: trunk/BRugs/R/samples.coda.R =================================================================== --- trunk/BRugs/R/samples.coda.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.coda.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,37 +3,35 @@ lastChain = samplesGetLastChain(), thin = samplesGetThin()) { # Write out CODA files - - if(!is.character(node) || length(node)!=1) - stop("'node' must be character of length 1") - if(!is.character(stem) || length(stem)!=1) - stop("'stem' must be character of length 1") - if(dirname(stem) == ".") - stem <- file.path(getwd(), basename(stem)) - - oldBeg <- samplesGetBeg() - oldEnd <- samplesGetEnd() - oldFirstChain <- samplesGetFirstChain() - oldLastChain <- samplesGetLastChain() - oldThin <- samplesGetThin() - on.exit({ - samplesSetBeg(oldBeg) - samplesSetEnd(oldEnd) - samplesSetFirstChain(oldFirstChain) - samplesSetLastChain(oldLastChain) - samplesSetThin(oldThin) - }) - beg <- max(beg, modelAdaptivePhase()) - samplesSetBeg(beg) - samplesSetEnd(end) - samplesSetFirstChain(firstChain) - samplesSetLastChain(lastChain) - thin <- max(c(thin, 1)) - samplesSetThin(thin) - command <- paste("SamplesEmbed.SetVariable(", sQuote(node), - ");SamplesEmbed.StatsGuard;", "SamplesEmbed.CODA(", - sQuote(stem), ")") - .C("CmdInterpreter", as.character(command), nchar(command), - integer(1), PACKAGE="BRugs") - buffer() + if(!is.character(node) || length(node)!=1) + stop("'node' must be character of length 1") + if(!is.character(stem) || length(stem)!=1) + stop("'stem' must be character of length 1") + if(dirname(stem) == ".") + stem <- file.path(getwd(), basename(stem)) + + oldBeg <- samplesGetBeg() + oldEnd <- samplesGetEnd() + oldFirstChain <- samplesGetFirstChain() + oldLastChain <- samplesGetLastChain() + oldThin <- samplesGetThin() + on.exit({ + samplesSetBeg(oldBeg) + samplesSetEnd(oldEnd) + samplesSetFirstChain(oldFirstChain) + samplesSetLastChain(oldLastChain) + samplesSetThin(oldThin) + }) + beg <- max(beg, modelAdaptivePhase()) + samplesSetBeg(beg) + samplesSetEnd(end) + samplesSetFirstChain(firstChain) + samplesSetLastChain(lastChain) + thin <- max(c(thin, 1)) + samplesSetThin(thin) + command <- paste("SamplesEmbed.SetVariable(", sQuote(node), + ");SamplesEmbed.StatsGuard;", "SamplesEmbed.CODA(", + sQuote(stem), ")") + .CmdInterpreter(command) + buffer() } Modified: trunk/BRugs/R/samples.correl.R =================================================================== --- trunk/BRugs/R/samples.correl.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.correl.R 2009-04-05 19:03:08 UTC (rev 112) @@ -26,8 +26,7 @@ command <- paste("CorrelEmbed.SetVariable0(", sQuote(node0), ");CorrelEmbed.SetVariable1(", sQuote(node1), ");CorrelEmbed.Guard", ";CorrelEmbed.PrintMatrix") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") - + .CmdInterpreter(command) buffer <- file.path(tempdir(), "buffer.txt") rlb <- readLines(buffer) len <- length(rlb) Modified: trunk/BRugs/R/samples.get.beg.R =================================================================== --- trunk/BRugs/R/samples.get.beg.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.get.beg.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,6 +3,5 @@ # Get the beg field { command <- "SamplesEmbed.beg" - as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[[3]]) + .Integer(command) } Modified: trunk/BRugs/R/samples.get.end.R =================================================================== --- trunk/BRugs/R/samples.get.end.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.get.end.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,6 +3,5 @@ # Get the end field { command <- "SamplesEmbed.end" - as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[[3]]) + .Integer(command) } Modified: trunk/BRugs/R/samples.get.firstChain.R =================================================================== --- trunk/BRugs/R/samples.get.firstChain.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.get.firstChain.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,6 +3,5 @@ # Get the firstChain field { command <- "SamplesEmbed.firstChain" - as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[[3]]) + .Integer(command) } Modified: trunk/BRugs/R/samples.get.lastChain.R =================================================================== --- trunk/BRugs/R/samples.get.lastChain.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.get.lastChain.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,6 +3,5 @@ # Get the lastChain field { command <- "SamplesEmbed.lastChain" - as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[[3]]) + .Integer(command) } Modified: trunk/BRugs/R/samples.get.thin.R =================================================================== --- trunk/BRugs/R/samples.get.thin.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.get.thin.R 2009-04-05 19:03:08 UTC (rev 112) @@ -3,6 +3,5 @@ # Get the thin field { command <- "SamplesEmbed.thin" - as.integer(.C("Integer", command, nchar(command), integer(1), - integer(1), PACKAGE="BRugs")[[3]]) + .Integer(command) } Modified: trunk/BRugs/R/samples.monitors.R =================================================================== --- trunk/BRugs/R/samples.monitors.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.monitors.R 2009-04-05 19:03:08 UTC (rev 112) @@ -5,7 +5,7 @@ if (is.R()){ command <- paste("SamplesEmbed.SetVariable(", sQuote(node), ");SamplesEmbed.StatsGuard;SamplesEmbed.Labels") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) buffer <- file.path(tempdir(), "buffer.txt") rlb <- readLines(buffer) len <- length(rlb) @@ -24,7 +24,7 @@ sampsMonsSingle <- function(node){ command <- paste("SamplesEmbed.SetVariable(", sQuote(node), ");SamplesEmbed.StatsGuard;SamplesEmbed.Labels") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) buffer <- file.path(tempdir(), "buffer.txt") rlb <- readLines(buffer) len <- length(rlb) @@ -44,7 +44,7 @@ mons <- lapply(node, sampsMonsSingle) } mons <- unlist(mons) - return(mons) + return(mons) } } Modified: trunk/BRugs/R/samples.sample.R =================================================================== --- trunk/BRugs/R/samples.sample.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.sample.R 2009-04-05 19:03:08 UTC (rev 112) @@ -13,15 +13,11 @@ command <- "BugsRobjects.SetVariable" .C("CharArray", command, nchar(command), node, nchar(node), integer(1), PACKAGE="BRugs") command <- "BugsRobjects.GetSize" - nodeSize <- .C("Integer", command, nchar(command), integer(1), integer(1), PACKAGE="BRugs")[3] + nodeSize <- .Integer(command) if(nodeSize > 1) stop("Only scalar nodes such as ", node, "[1] are allowed.") - command <- paste("SamplesEmbed.SetVariable(", sQuote(node), ")") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") - command <- "SamplesEmbed.SampleSize" - sampleSize <- as.integer(.C("Integer", command, nchar(command), - integer(1), integer(1), PACKAGE="BRugs")[[3]]) + sampleSize <- samplesSize(node) command <- "SamplesEmbed.SampleValues" .C("RealArray", command, nchar(command), double(sampleSize), sampleSize, integer(1), PACKAGE="BRugs")[[3]] Modified: trunk/BRugs/R/samples.set.R =================================================================== --- trunk/BRugs/R/samples.set.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.set.R 2009-04-05 19:03:08 UTC (rev 112) @@ -14,7 +14,7 @@ eval(alreadySet) command <- paste("SamplesEmbed.SetVariable(", nodeName[i], ");SamplesEmbed.SetGuard;SamplesEmbed.Set") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) buffer <- file.path(tempdir(), "buffer.txt") rlb <- readLines(buffer) if(rlb == "") Modified: trunk/BRugs/R/samples.set.beg.R =================================================================== --- trunk/BRugs/R/samples.set.beg.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.set.beg.R 2009-04-05 19:03:08 UTC (rev 112) @@ -6,5 +6,5 @@ stop("begIt ", "must be numeric") begIt <- as.integer(begIt) command <- paste("SamplesEmbed.beg :=", begIt) - invisible(.C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs")) + invisible(.CmdInterpreter(command)) } Modified: trunk/BRugs/R/samples.set.end.R =================================================================== --- trunk/BRugs/R/samples.set.end.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.set.end.R 2009-04-05 19:03:08 UTC (rev 112) @@ -6,5 +6,5 @@ stop("endIt ", "must be numeric") endIt <- as.integer(endIt) command <- paste("SamplesEmbed.end :=", endIt) - invisible(.C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs")) + invisible(.CmdInterpreter(command)) } Modified: trunk/BRugs/R/samples.set.firstChain.R =================================================================== --- trunk/BRugs/R/samples.set.firstChain.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.set.firstChain.R 2009-04-05 19:03:08 UTC (rev 112) @@ -8,5 +8,5 @@ if(!(first %in% 1:getNumChains())) stop("it is required to have 1 <= first <= nchains") command <- paste("SamplesEmbed.firstChain :=", as.integer(first)) - invisible(.C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs")) + invisible(.CmdInterpreter(command)) } Modified: trunk/BRugs/R/samples.set.lastChain.R =================================================================== --- trunk/BRugs/R/samples.set.lastChain.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.set.lastChain.R 2009-04-05 19:03:08 UTC (rev 112) @@ -8,5 +8,5 @@ if(!(last %in% 1:getNumChains())) stop("it is required to have 1 <= last <= nchains") command <- paste("SamplesEmbed.lastChain :=", last) - invisible(.C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs")) + invisible(.CmdInterpreter(command)) } Modified: trunk/BRugs/R/samples.set.thin.R =================================================================== --- trunk/BRugs/R/samples.set.thin.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.set.thin.R 2009-04-05 19:03:08 UTC (rev 112) @@ -5,5 +5,5 @@ if(!is.numeric(thin)) stop("thin ", "must be numeric") command <- paste("SamplesEmbed.thin :=", as.integer(thin)) - invisible(.C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs")) + invisible(.CmdInterpreter(command)) } Modified: trunk/BRugs/R/samples.size.R =================================================================== --- trunk/BRugs/R/samples.size.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.size.R 2009-04-05 19:03:08 UTC (rev 112) @@ -2,9 +2,8 @@ function(node) # Size of stored sample of single component of OpenBUGS name { - nodeName <- sQuote(node) - command <- paste("SamplesEmbed.SetVariable(", nodeName, ")") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + command <- paste("SamplesEmbed.SetVariable(", shQuote(node), ")") + .CmdInterpreter(command) command <- "SamplesEmbed.SampleSize" - as.integer(.C("Integer", command, nchar(command), integer(1), integer(1), PACKAGE="BRugs")[[3]]) + .Integer(command) } Modified: trunk/BRugs/R/samples.stats.R =================================================================== --- trunk/BRugs/R/samples.stats.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/samples.stats.R 2009-04-05 19:03:08 UTC (rev 112) @@ -36,7 +36,7 @@ for(i in seq(along=nodeName)){ command <- paste("SamplesEmbed.SetVariable(", nodeName[i], ");SamplesEmbed.StatsGuard;SamplesEmbed.Stats") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) buffer <- file.path(tempdir(), "buffer.txt") rlb <- readLines(buffer) len <- length(rlb) Modified: trunk/BRugs/R/set.values.R =================================================================== --- trunk/BRugs/R/set.values.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/set.values.R 2009-04-05 19:03:08 UTC (rev 112) @@ -11,12 +11,12 @@ command <- "BugsRobjects.SetVariable" .C("CharArray", command, nchar(command), nodeLabel, nchar(nodeLabel), integer(1), PACKAGE="BRugs") command <- "BugsRobjects.GetSize" - nodeSize <- .C("Integer", command, nchar(command), integer(1), integer(1), PACKAGE="BRugs")[3] + nodeSize <- .Integer(command) if(nodeSize == -1) stop(nodeLabel, " is not a node in BUGS model") if(length(values) != nodeSize) stop("length(values) does not correspond to the node size") command <- "BugsRobjects.SetValues" - .C("RealArray", command, nchar(command), as.real(values), as.integer(nodeSize), + .C("RealArray", command, nchar(command), as.double(values), as.integer(nodeSize), integer(1), NAOK = TRUE, PACKAGE="BRugs") } Modified: trunk/BRugs/R/summary.clear.R =================================================================== --- trunk/BRugs/R/summary.clear.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/summary.clear.R 2009-04-05 19:03:08 UTC (rev 112) @@ -6,7 +6,7 @@ for(i in seq(along=nodeName)){ command <- paste("SummaryEmbed.SetVariable(", nodeName[i], "); SummaryEmbed.StatsGuard;", "SummaryEmbed.Clear") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) buffer <- file.path(tempdir(), "buffer.txt") rlb <- readLines(buffer) if(getOption("BRugsVerbose")) Modified: trunk/BRugs/R/summary.set.R =================================================================== --- trunk/BRugs/R/summary.set.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/summary.set.R 2009-04-05 19:03:08 UTC (rev 112) @@ -6,7 +6,7 @@ for(i in seq(along=nodeName)){ command <- paste("SummaryEmbed.SetVariable(", nodeName[i], "); SummaryEmbed.SetGuard;", "SummaryEmbed.Set") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) buffer <- file.path(tempdir(), "buffer.txt") rlb <- readLines(buffer) if(getOption("BRugsVerbose")) Modified: trunk/BRugs/R/summary.stats.R =================================================================== --- trunk/BRugs/R/summary.stats.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/summary.stats.R 2009-04-05 19:03:08 UTC (rev 112) @@ -12,7 +12,7 @@ for(i in seq(along=nodeName)){ command <- paste("SummaryEmbed.SetVariable(", nodeName[i], "); SummaryEmbed.StatsGuard;", "SummaryEmbed.Stats") - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) buffer <- file.path(tempdir(), "buffer.txt") rlb <- readLines(buffer) len <- length(rlb) Modified: trunk/BRugs/R/zzz.R =================================================================== --- trunk/BRugs/R/zzz.R 2009-04-05 17:37:08 UTC (rev 111) +++ trunk/BRugs/R/zzz.R 2009-04-05 19:03:08 UTC (rev 112) @@ -9,7 +9,7 @@ .C("SetRoot", as.character(root), len, PACKAGE="BRugs") .C("SetTempDir", as.character(tempDir), nchar(tempDir), PACKAGE="BRugs") command <- "BugsMappers.SetDest(2)" - .C("CmdInterpreter", as.character(command), nchar(command), integer(1), PACKAGE="BRugs") + .CmdInterpreter(command) if(is.null(getOption("BRugsVerbose"))) options("BRugsVerbose" = TRUE) } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <li...@us...> - 2009-04-05 17:37:09
|
Revision: 111 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=111&view=rev Author: ligges Date: 2009-04-05 17:37:08 +0000 (Sun, 05 Apr 2009) Log Message: ----------- bugfix in order to protect users from misuses of samplesSample that yield in crashes Modified Paths: -------------- trunk/BRugs/DESCRIPTION trunk/BRugs/R/samples.sample.R Modified: trunk/BRugs/DESCRIPTION =================================================================== --- trunk/BRugs/DESCRIPTION 2009-04-05 17:36:01 UTC (rev 110) +++ trunk/BRugs/DESCRIPTION 2009-04-05 17:37:08 UTC (rev 111) @@ -1,7 +1,7 @@ Package: BRugs Title: OpenBUGS and its R / S-PLUS interface BRugs -Version: 0.5-0 -Date: 2009-02-15 +Version: 0.5-1 +Date: 2009-04-05 Author: The Chief Software Bug is Andrew Thomas, with web assistance from Real Bug Bob O'Hara. Other members of the BUGS team are statisticians David Spiegelhalter, Nicky Best, Dave Lunn and Ken Rice. Dave Lunn has also made major contributions to the software development. R Code modified, extended and packaged for R by Uwe Ligges and Sibylle Sturtz. Some ideas taken from the R2WinBUGS package based on code by Andrew Gelman. Description: An R / S-PLUS package containing OpenBUGS and its R / S-PLUS interface BRugs. Maintainer: Uwe Ligges <li...@st...> Modified: trunk/BRugs/R/samples.sample.R =================================================================== --- trunk/BRugs/R/samples.sample.R 2009-04-05 17:36:01 UTC (rev 110) +++ trunk/BRugs/R/samples.sample.R 2009-04-05 17:37:08 UTC (rev 111) @@ -4,6 +4,19 @@ { if(samplesGetFirstChain() > samplesGetLastChain()) stop("Number of first chain is larger than last chain!") + if(length(node) != 1) + stop("Exactly one scalar node must be given.") + sM <- samplesMonitors(node)[1] + if(sM == "model must be initialized before monitors used") + stop("model must be initialized / updated / monitored before samplesSample is used") + + command <- "BugsRobjects.SetVariable" + .C("CharArray", command, nchar(command), node, nchar(node), integer(1), PACKAGE="BRugs") + command <- "BugsRobjects.GetSize" + nodeSize <- .C("Integer", command, nchar(command), integer(1), integer(1), PACKAGE="BRugs")[3] + if(nodeSize > 1) + stop("Only scalar nodes such as ", node, "[1] are allowed.") + command <- paste("SamplesEmbed.SetVariable(", sQuote(node), ")") .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") command <- "SamplesEmbed.SampleSize" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <li...@us...> - 2009-04-05 17:36:04
|
Revision: 110 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=110&view=rev Author: ligges Date: 2009-04-05 17:36:01 +0000 (Sun, 05 Apr 2009) Log Message: ----------- Required for R >= 2.9.x; backward compatible Modified Paths: -------------- trunk/BRugs/configure.win Modified: trunk/BRugs/configure.win =================================================================== --- trunk/BRugs/configure.win 2009-04-05 16:26:37 UTC (rev 109) +++ trunk/BRugs/configure.win 2009-04-05 17:36:01 UTC (rev 110) @@ -1,4 +1,8 @@ #!/bin/sh -mkdir $DPKG/libs -cp ./inst/OpenBUGS/brugs.dll $DPKG/libs/BRugs.dll +if test -z "$R_PACKAGE_DIR" ; then + R_PACKAGE_DIR=${DPKG} +fi +mkdir ${R_PACKAGE_DIR}/libs +cp ./inst/OpenBUGS/brugs.dll ${R_PACKAGE_DIR}/libs/BRugs.dll + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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: 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 |