From: <li...@us...> - 2008-01-08 21:12:15
|
Revision: 79 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=79&view=rev Author: ligges Date: 2008-01-08 13:11:35 -0800 (Tue, 08 Jan 2008) Log Message: ----------- bugs in monitor() reported by Andrew Gelman: - exported from NS (for making code in his book work) - extracts the default number of chains from the object by default Modified Paths: -------------- trunk/R2WinBUGS/DESCRIPTION trunk/R2WinBUGS/NAMESPACE trunk/R2WinBUGS/R/monitor.R trunk/R2WinBUGS/man/bugs.log.Rd trunk/R2WinBUGS/man/monitor.Rd Modified: trunk/R2WinBUGS/DESCRIPTION =================================================================== --- trunk/R2WinBUGS/DESCRIPTION 2008-01-06 18:56:18 UTC (rev 78) +++ trunk/R2WinBUGS/DESCRIPTION 2008-01-08 21:11:35 UTC (rev 79) @@ -1,6 +1,6 @@ Package: R2WinBUGS Title: Running WinBUGS and OpenBUGS from R / S-PLUS -Date: 2008-01-06 +Date: 2008-01-08 Version: 2.1-7 Author: originally written by Andrew Gelman <ge...@st...>; changes and packaged by Sibylle Sturtz <st...@st...> Modified: trunk/R2WinBUGS/NAMESPACE =================================================================== --- trunk/R2WinBUGS/NAMESPACE 2008-01-06 18:56:18 UTC (rev 78) +++ trunk/R2WinBUGS/NAMESPACE 2008-01-08 21:11:35 UTC (rev 79) @@ -8,6 +8,7 @@ bugs.data, read.bugs, bugs.log, + monitor, openbugs, as.bugs.array, write.model) Modified: trunk/R2WinBUGS/R/monitor.R =================================================================== --- trunk/R2WinBUGS/R/monitor.R 2008-01-06 18:56:18 UTC (rev 78) +++ trunk/R2WinBUGS/R/monitor.R 2008-01-08 21:11:35 UTC (rev 79) @@ -1,15 +1,15 @@ "monitor" <- -function (a, n.chains, trans=NULL, keep.all=FALSE, Rupper.keep=FALSE) { +function (a, n.chains=dim(a)[2], trans=NULL, keep.all=FALSE, Rupper.keep=FALSE) { -# If keep.all=T: a is a n x m x k array: -# m sequences of length n, k variables measured -# If keep.all=F: a is a 2n x m x k array (first half will be discarded) -# -# trans is a vector of length k: "" if no transformation, or "log" or "logit" -# (If trans is not defined, it will be set to "log" for parameters that -# are all-positive and 0 otherwise.) -# -# If Rupper.keep=T: keep Rupper. (Otherwise don't display it.) +## If keep.all=T: a is a n x m x k array: +## m sequences of length n, k variables measured +## If keep.all=F: a is a 2n x m x k array (first half will be discarded) +## +## trans is a vector of length k: "" if no transformation, or "log" or "logit" +## (If trans is not defined, it will be set to "log" for parameters that +## are all-positive and 0 otherwise.) +## +## If Rupper.keep=TRUE: keep Rupper. (Otherwise don't display it.) invlogit <- function (x) {1 / (1 + exp(-x))} nparams <- if(length(dim(a)) < 3) 1 else dim(a)[length(dim(a))] # Calculation and initialization of the required matrix "output" @@ -30,9 +30,9 @@ confshrink = conv.p$confshrink, n.eff = conv.p$n.eff) } else if (trans[i]=="logit"){ - if (!is.R()){ - logit <- function (x) { log(x /(1- x)) } - } + if (!is.R()){ + logit <- function (x) { log(x /(1- x)) } + } conv.p <- conv.par(logit(ai), n.chains, Rupper.keep=Rupper.keep) conv.p <- list(quantiles = invlogit(conv.p$quantiles), confshrink = conv.p$confshrink, n.eff = conv.p$n.eff) Modified: trunk/R2WinBUGS/man/bugs.log.Rd =================================================================== --- trunk/R2WinBUGS/man/bugs.log.Rd 2008-01-06 18:56:18 UTC (rev 78) +++ trunk/R2WinBUGS/man/bugs.log.Rd 2008-01-08 21:11:35 UTC (rev 79) @@ -18,5 +18,6 @@ \pkg{WinBUGS}.} } \seealso{The main function that generates the log file is \code{\link{bugs}}.} +\author{Jouni Kerman} \keyword{IO} \keyword{file} Modified: trunk/R2WinBUGS/man/monitor.Rd =================================================================== --- trunk/R2WinBUGS/man/monitor.Rd 2008-01-06 18:56:18 UTC (rev 78) +++ trunk/R2WinBUGS/man/monitor.Rd 2008-01-08 21:11:35 UTC (rev 79) @@ -3,15 +3,13 @@ \alias{conv.par} \title{Special summary statistics} -\description{Special summary statistics of the WinBUGS output - intended - for internal use} +\description{Special summary statistics of the WinBUGS output.} \usage{ -monitor(a, n.chains, trans = NULL, keep.all = FALSE, Rupper.keep = FALSE) +monitor(a, n.chains = dim(a)[2], trans = NULL, keep.all = FALSE, Rupper.keep = FALSE) conv.par(x, n.chains, Rupper.keep = TRUE) } \arguments{ - \item{x}{} \item{a}{a \code{n * m * k} array: \code{m} sequences of length \code{n}, \code{k} variables measured} \item{n.chains}{number of Markov chains} @@ -21,9 +19,10 @@ \item{keep.all}{if \code{FALSE} (default), first half of \code{a} will be discarded} \item{Rupper.keep}{if \code{FALSE}, don't return \code{Rupper}} + \item{x}{for internal use only} } -\details{See the well documented code for details.} +\details{\code{conv.par} is intended for internal use only.} \value{ for \code{monitor}: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |