From: <snt...@us...> - 2010-10-02 12:53:22
|
Revision: 174 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=174&view=rev Author: snthomas99 Date: 2010-10-02 12:53:15 +0000 (Sat, 02 Oct 2010) Log Message: ----------- trying to add validation code to R2OpenBUGS respository Modified Paths: -------------- trunk/R2OpenBUGS/DESCRIPTION trunk/R2OpenBUGS/NAMESPACE trunk/R2OpenBUGS/R/bugs.R trunk/R2OpenBUGS/R/bugs.run.R trunk/R2OpenBUGS/R/bugs.script.R trunk/R2OpenBUGS/man/bugs.Rd trunk/R2OpenBUGS/man/bugs.inits.Rd Added Paths: ----------- trunk/R2OpenBUGS/CreatevalidateOpenBUGS.R Added: trunk/R2OpenBUGS/CreatevalidateOpenBUGS.R =================================================================== --- trunk/R2OpenBUGS/CreatevalidateOpenBUGS.R (rev 0) +++ trunk/R2OpenBUGS/CreatevalidateOpenBUGS.R 2010-10-02 12:53:15 UTC (rev 174) @@ -0,0 +1,49 @@ +library(R2OpenBUGS) + +## Selected examples which take a few seconds in total to run + +test.models <- c("Air", "Asia", "Beetles", "BiRats", "Camel", + "Dugongs", "Dyes", "Equiv", "Eyes", + "Line", "OtreesMVN", "Rats", "Stacks", + "Surgical", "Surgicalrand") + +test.params <- list(Air = c("X", "theta"), + Asia = c("bronchitis", "either", "lung.cancer"), + Beetles = c("alpha", "beta", "rhat"), + BiRats = c("mu.beta", "sigma"), + Camel = c("Sigma2", "rho", "tau"), + Dugongs = c("U3","alpha", "beta", "gamma", "sigma"), + Dyes = c("sigma2.btw", "sigma2.with", "theta"), + Equiv = c("equiv", "mu", "phi", "pi","sigma1", "sigma2", "theta"), + Eyes = c("P", "lambda", "sigma"), + Line = c("alpha", "beta", "sigma"), + OtreesMVN = c("mu","sigma", "sigmaC"), + Rats = c("alpha0", "beta.c", "sigma"), + Stacks = c("b", "b0", "outlier[21]","outlier[3]", "outlier[4]", "sigma"), + Surgical = "p", + Surgicalrand = c("p","pop.mean", "sigma") + ) + +test.modelfile = paste(test.models,"model.txt",sep="") +test.modelfile<-file.path('C:/Program Files/OpenBUGS/OpenBUGS312/Examples',test.modelfile) +test.datafile = paste(test.models,"data.txt",sep="") +test.datafile<-file.path('C:/Program Files/OpenBUGS/OpenBUGS312/Examples',test.datafile) +test.inits = paste(test.models,"inits.txt",sep="") +test.inits<-file.path('C:/Program Files/OpenBUGS/OpenBUGS312/Examples',test.inits) + +### Test for posterior means within 1 percent of previously saved values + +res.true <- vector(mode="list",length=length(test.modelfile)) +for (i in seq(along=test.models)) { + res.true[[i]]<-round(bugs(data=test.datafile[i], inits=test.inits[i], + para=test.params[[test.models[i]]],model.file=test.modelfile[i], + n.burnin=5000, n.iter=20000, n.thin=1, n.chains=1, DIC=FALSE)$summary,5) + +} + +dput(res.true,'validOpenBUGSResults.R') + + + + + Property changes on: trunk/R2OpenBUGS/CreatevalidateOpenBUGS.R ___________________________________________________________________ Added: svn:executable + * Modified: trunk/R2OpenBUGS/DESCRIPTION =================================================================== --- trunk/R2OpenBUGS/DESCRIPTION 2010-10-02 12:50:38 UTC (rev 173) +++ trunk/R2OpenBUGS/DESCRIPTION 2010-10-02 12:53:15 UTC (rev 174) @@ -1,7 +1,7 @@ Package: R2OpenBUGS Title: Running OpenBUGS from R / S-PLUS -Date: 2010-08-5 -Version: 3.0-1 +Date: 2010-09-30 +Version: 3.1-2 Author: originally written as R2WinBUGS by Andrew Gelman <ge...@st...>; changes and packaged by Sibylle Sturtz <st...@st...> and Uwe Ligges <li...@st...>. Modified: trunk/R2OpenBUGS/NAMESPACE =================================================================== --- trunk/R2OpenBUGS/NAMESPACE 2010-10-02 12:50:38 UTC (rev 173) +++ trunk/R2OpenBUGS/NAMESPACE 2010-10-02 12:53:15 UTC (rev 174) @@ -10,7 +10,8 @@ bugs.log, monitor, as.bugs.array, - write.model) + write.model, + validateInstallOpenBUGS) S3method(print, bugs) S3method(plot, bugs) Modified: trunk/R2OpenBUGS/R/bugs.R =================================================================== --- trunk/R2OpenBUGS/R/bugs.R 2010-10-02 12:50:38 UTC (rev 173) +++ trunk/R2OpenBUGS/R/bugs.R 2010-10-02 12:53:15 UTC (rev 174) @@ -5,7 +5,7 @@ OpenBUGS.pgm=ifelse(.Platform$OS.type == "windows" | useWINE==TRUE, paste("C:/Program Files/OpenBUGS/OpenBUGS", version,"/OpenBUGS.exe",sep=""),"OpenBUGS"), - version='311', + version='312', working.directory=NULL, clearWD=FALSE, useWINE=FALSE, WINE=NULL, newWINE=TRUE, WINEPATH=NULL, bugs.seed=1, summary.only=FALSE, Modified: trunk/R2OpenBUGS/R/bugs.run.R =================================================================== --- trunk/R2OpenBUGS/R/bugs.run.R 2010-10-02 12:50:38 UTC (rev 173) +++ trunk/R2OpenBUGS/R/bugs.run.R 2010-10-02 12:53:15 UTC (rev 174) @@ -27,6 +27,7 @@ native2win(file.path(getwd(), "script.txt"), useWINE=useWINE, newWINE=newWINE, WINEPATH=WINEPATH), "\" /", sep="") + if(!debug)bugsCall<-paste(bugsCall,"HEADLESS",sep="") if(useWINE) bugsCall <- paste(WINE, bugsCall) }else{ bugsCall <- paste(OpenBUGS.pgm, "<", "script.txt", ">", file.path(getwd(), "log.txt")) Modified: trunk/R2OpenBUGS/R/bugs.script.R =================================================================== --- trunk/R2OpenBUGS/R/bugs.script.R 2010-10-02 12:50:38 UTC (rev 173) +++ trunk/R2OpenBUGS/R/bugs.script.R 2010-10-02 12:53:15 UTC (rev 174) @@ -46,7 +46,8 @@ bugs.seed.cmd <- paste("modelSetRN(", bugs.seed, ")\n", sep="") } - thinUpdate <- paste("modelUpdate(", n.burnin, ",", n.thin, ")\n", sep="") + thinUpdate <- paste("modelUpdate(", formatC(n.burnin, format='d'), ",", n.thin, + ",",formatC(n.burnin, format='d'), ")\n", sep="") cat( if(.Platform$OS.type == "windows" | useWINE) "modelDisplay('log')\n", @@ -61,7 +62,8 @@ savelist, summarylist, if(DIC) "dicSet()\n", - "modelUpdate(", n.iter-n.burnin, ",", n.thin, ")\n", + "modelUpdate(", formatC(n.iter-n.burnin, format='d'), ",", n.thin, + ",",formatC(n.iter-n.burnin, format='d'),")\n", "samplesCoda('*', '", coda, "')\n", "summaryStats('*')\n", if(DIC) "dicStats()\n", Modified: trunk/R2OpenBUGS/man/bugs.Rd =================================================================== --- trunk/R2OpenBUGS/man/bugs.Rd 2010-10-02 12:50:38 UTC (rev 173) +++ trunk/R2OpenBUGS/man/bugs.Rd 2010-10-02 12:53:15 UTC (rev 174) @@ -13,7 +13,7 @@ OpenBUGS.pgm=ifelse(.Platform$OS.type == "windows" | useWINE==TRUE, paste("C:/Program Files/OpenBUGS/OpenBUGS", version,"/OpenBUGS.exe",sep=""),"OpenBUGS"), - version='311', + version='312', working.directory=NULL, clearWD=FALSE, useWINE=FALSE, WINE=NULL, newWINE=TRUE, WINEPATH=NULL, bugs.seed=1, summary.only=FALSE, @@ -100,7 +100,9 @@ \item{WINEPATH}{Character, path to \file{winepath} binary file, it is tried hard (by a guess and the utilities \code{which} and \code{locate}) to get the information automatically if not given.} - \item{bugs.seed}{Random seed for \pkg{OpenBUGS}}. + \item{bugs.seed}{Random seed for \pkg{OpenBUGS}. Must be an integer between 1-14. Seed + specification changed between WinBUGS and OpenBUGS; see the OpenBUGS documentation for + details}. \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.} Modified: trunk/R2OpenBUGS/man/bugs.inits.Rd =================================================================== --- trunk/R2OpenBUGS/man/bugs.inits.Rd 2010-10-02 12:50:38 UTC (rev 173) +++ trunk/R2OpenBUGS/man/bugs.inits.Rd 2010-10-02 12:53:15 UTC (rev 174) @@ -16,7 +16,7 @@ \item{n.chains}{number of Markov chains} \item{digits}{number of significant digits used for \pkg{OpenBUGS} input, see \code{\link{formatC}}} - \item{inits.file}{name for the inits files R write the inits into.} + \item{inits.files}{name for the inits files R write the inits into.} } \value{Vector of names of \code{inits.files}; as a side effect, the inits files \file{inits*.txt} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |