[r-cran-coda] 19/60: Imported Upstream version 0.11-2
Andreas Tille
tille at debian.org
Fri Dec 16 12:11:23 UTC 2016
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository r-cran-coda.
commit 43cd61b78334df101f10acb02fe6e658927a76a3
Author: Andreas Tille <tille at debian.org>
Date: Fri Dec 16 12:09:56 2016 +0100
Imported Upstream version 0.11-2
---
CHANGELOG | 14 +++
DESCRIPTION | 8 +-
NAMESPACE | 4 +-
R/HPDinterval.R | 3 +
R/autocorrdiag.R | 12 ++-
R/batchSE.R | 12 ++-
R/codamenu.R | 231 +++++++++++++++++++++++---------------------------
R/cumuplot.R | 7 +-
R/gelman.R | 6 ++
R/geweke.R | 6 ++
R/heidel.R | 16 +++-
R/jags.R | 33 +++++---
R/mcmc.R | 11 ++-
R/mcmclist.R | 12 ++-
R/output.R | 38 +++++++--
R/raftery.R | 5 +-
R/trellisplots.R | 15 +++-
R/util.R | 31 ++++---
man/HPDinterval.Rd | 6 +-
man/as.ts.mcmc.Rd | 4 +-
man/autocorr.Rd | 2 +-
man/autocorr.diag.Rd | 6 +-
man/autocorr.plot.Rd | 5 +-
man/coda.options.Rd | 7 +-
man/crosscorr.plot.Rd | 4 +-
man/cumuplot.Rd | 4 +-
man/densplot.Rd | 4 +-
man/gelman.diag.Rd | 33 ++++----
man/gelman.plot.Rd | 4 +-
man/geweke.plot.Rd | 4 +-
man/heidel.diag.Rd | 2 +-
man/mcmc.convert.Rd | 8 +-
man/mcmc.list.Rd | 6 +-
man/plot.mcmc.Rd | 4 +-
man/read.openbugs.Rd | 2 +-
man/summary.mcmc.Rd | 4 +-
man/thin.Rd | 4 +-
man/time.mcmc.Rd | 10 +--
man/traceplot.Rd | 4 +-
man/trellisplots.Rd | 4 +-
man/window.mcmc.Rd | 4 +-
41 files changed, 350 insertions(+), 249 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index a231fbf..8d5cb6e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,17 @@
+0.11-2
+- The codamenu function has been modified so that it no longer works with
+ coda.dat and work.dat in the global environment, solving global binding
+ issues.
+- The sample size test at the beginning of codamenu has been corrected
+ for the case of multiple chains.
+ Thanks to Luwis Diya and Pablo G Goicoechea for these bug reports
+- Syntax errors fixed in help pages.
+- Description of Gelman and Rubin diagnostic corrected
+
+0.11-1
+- Added changes from Dawn Woodward for S-PLUS.
+- Fixed global binding problems
+
0.10-7
- Documentation clarification for bugs2jags()
- Made linearity test in codamenu less stringent.
diff --git a/DESCRIPTION b/DESCRIPTION
index 630f97b..aec2593 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,11 +1,11 @@
Package: coda
-Version: 0.10-7
-Date: 2006-08-29
+Version: 0.11-2
+Date: 2007-06-04
Title: Output analysis and diagnostics for MCMC
Author: Martyn Plummer, Nicky Best, Kate Cowles, Karen Vines
Maintainer: Martyn Plummer <plummer at iarc.fr>
-Depends: R (>= 2.2.0), lattice
+Depends: R (>= 2.5.0), lattice
Description: Output analysis and diagnostics for Markov Chain Monte
Carlo simulations.
License: GPL Version 2 or later.
-Packaged: Tue Oct 10 19:04:16 2006; martyn
+Packaged: Mon Jun 4 11:33:42 2007; martyn
diff --git a/NAMESPACE b/NAMESPACE
index cae0f4c..a6e4745 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -68,9 +68,11 @@ export(
## register S3 methods
S3method(as.mcmc, default)
+## as.matrix
+S3method(as.matrix, mcmc)
+S3method(as.matrix, mcmc.list)
## mcmc
S3method("[", mcmc)
-S3method(as.matrix, mcmc)
S3method(end, mcmc)
S3method(frequency, mcmc)
S3method(plot, mcmc)
diff --git a/R/HPDinterval.R b/R/HPDinterval.R
index 275f0b5..0f745ab 100644
--- a/R/HPDinterval.R
+++ b/R/HPDinterval.R
@@ -2,6 +2,9 @@ HPDinterval <- function(obj, prob = 0.95, ...) UseMethod("HPDinterval")
HPDinterval.mcmc <- function(obj, prob = 0.95, ...)
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
obj <- as.matrix(obj)
vals <- apply(obj, 2, sort)
if (!is.matrix(vals)) stop("obj must have nsamp > 1")
diff --git a/R/autocorrdiag.R b/R/autocorrdiag.R
index ac97b6b..0b60932 100644
--- a/R/autocorrdiag.R
+++ b/R/autocorrdiag.R
@@ -10,8 +10,9 @@
ac <- autocorr(mcmc.obj,...)
dd <- dim(ac)
result <- matrix(NA,nrow=dd[1],ncol=dd[2],dimnames =dimnames(ac)[1:2])
- for (i in 1:dd[2])
+ for (i in 1:dd[2]) {
result[,i] <- ac[,i,i]
+ }
return (result)
}
@@ -19,7 +20,10 @@
"autocorr.diag.mcmc.list" <- function (mcmc.obj,...) {
ac <- lapply(mcmc.obj,autocorr.diag.mcmc,...)
result <- ac[[1]]
- for (chain in 2:length(ac))
- result <- result + ac[[chain]]
- result/length(ac)
+ if (length(ac) > 1) {
+ for (chain in 2:length(ac)) {
+ result <- result + ac[[chain]]
+ }
+ }
+ return (result/length(ac))
}
diff --git a/R/batchSE.R b/R/batchSE.R
index 7da64af..f0657ab 100644
--- a/R/batchSE.R
+++ b/R/batchSE.R
@@ -4,8 +4,10 @@
UseMethod("batchSE")
}
-"batchSE.mcmc" <-
- function(x,batchSize=100) {
+"batchSE.mcmc" <- function(x,batchSize=100) {
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
niter <- niter(x)
nbatch <- niter%/%batchSize
## Truncate the odd lot observations
@@ -21,8 +23,10 @@
stds/sqrt(niter(x))
}
-"batchSE.mcmc.list" <-
- function(x,batchSize=100) {
+"batchSE.mcmc.list" <- function(x,batchSize=100) {
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
nchain <- nchain(x)
niter <- niter(x)
nbatch <- niter%/%batchSize
diff --git a/R/codamenu.R b/R/codamenu.R
index a49ad5f..b42cdd3 100644
--- a/R/codamenu.R
+++ b/R/codamenu.R
@@ -1,6 +1,8 @@
"codamenu" <- function ()
{
- on.exit(tidy.up())
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
coda.options(default=TRUE)
file.menu <- c("Read BUGS output files",
"Use an mcmc object",
@@ -9,7 +11,7 @@
if (pick == 0 || pick == 3)
return(invisible())
else if (pick == 1) {
- assign("coda.dat", read.coda.interactive(), pos=1)
+ coda.dat <- read.coda.interactive()
if (is.null(coda.dat)) {
return(invisible())
}
@@ -26,32 +28,29 @@
else if (!exists(outname))
msg <- "Can't find this object"
else {
- work.dat <- eval(parse(text = outname))
- if (is.mcmc.list(work.dat)) {
- assign("coda.dat", work.dat, pos=1)
- break
+ coda.dat <- eval(parse(text = outname))
+ if (is.mcmc(coda.dat)) {
+ coda.dat <- mcmc.list(coda.dat)
}
- else if (is.mcmc(work.dat)) {
- assign("coda.dat", mcmc.list(work.dat), pos=1)
+ if (!is.mcmc.list(coda.dat)) {
+ msg <- "Not an mcmc or mcmc.list object"
+ }
+ else {
break
}
- else
- msg <- "Not an mcmc or mcmc.list object"
}
}
}
else stop("Invalid option")
- coda.dat <- coda.dat #Create local copy
if (is.null(chanames(coda.dat))) {
chanames(coda.dat) <- chanames(coda.dat, allow.null = FALSE)
}
if (is.matrix(coda.dat[[1]]) && is.null(varnames(coda.dat))) {
varnames(coda.dat) <- varnames(coda.dat, allow.null = FALSE)
}
- assign("coda.dat", coda.dat, pos=1)
- rm(coda.dat, inherits=FALSE) #Destroy local copy
- assign("work.dat", coda.dat, pos=1)
+ on.exit(tidy.up(coda.dat))
+
## Check for variables that are linear functions of the
## iteration number
is.linear <- rep(FALSE, nvar(coda.dat))
@@ -68,15 +67,14 @@
cat("functions of the iteration number\n")
print(varnames(coda.dat)[is.linear])
inset <- varnames(coda.dat)[!is.linear]
- assign("coda.dat", coda.dat[,inset, drop=FALSE], pos=1)
- assign("work.dat", coda.dat[,inset, drop=FALSE], pos=1)
+ coda.dat <- coda.dat[, inset, drop=FALSE]
}
## Sample size test
cat("Checking effective sample size ...")
- ess <- effectiveSize(gelman.transform(coda.dat))
+ ess <- lapply(gelman.transform(coda.dat), effectiveSize)
warn.small <- FALSE
- for (i in 1:nchain(coda.dat))
+ for (i in 1:length(ess))
{
if (any(ess[[i]] < 200))
warn.small <- TRUE
@@ -86,8 +84,9 @@
cat("\n")
cat("*******************************************\n")
cat("WARNING !!! \n")
- cat("Some variables in your chain have an \n")
- cat("effective sample size of less than 200 \n")
+ cat("Some variables have an effective sample \n")
+ cat("size of less than 200 in at least one \n")
+ cat("chain. \n")
cat("This is too small, and may cause errors \n")
cat("in the diagnostic tests \n")
cat("HINT: \n")
@@ -106,8 +105,11 @@
current.menu <- "codamenu.main"
old.opt <- options(warn=-1, show.error.messages=FALSE)
on.exit(options(old.opt))
+ ## Create working data, a subset of coda.dat
+ work.dat <- coda.dat
+
repeat {
- next.menu <- try(do.call(current.menu, vector("list", 0)))
+ next.menu <- try(do.call(current.menu, list(work.dat, coda.dat)))
if (!is.null(class(next.menu)) && class(next.menu) == "try-error")
{
if (current.menu == "codamenu.main")
@@ -127,6 +129,10 @@
}
else
{
+ if (is.list(next.menu) && !is.null(next.menu[["work.dat"]])) {
+ work.dat <- next.menu$work.dat
+ next.menu <- next.menu[[1]]
+ }
if (next.menu == "quit") {
if(read.yesno("Are you sure you want to quit", FALSE))
break
@@ -137,7 +143,7 @@
invisible()
}
-"codamenu.anal" <- function ()
+"codamenu.anal" <- function (work.dat, ...)
{
next.menu <- "codamenu.anal"
choices <- c("Plots", "Statistics", "List/Change Options",
@@ -188,7 +194,7 @@
return(next.menu)
}
-"codamenu.diags" <- function ()
+"codamenu.diags" <- function (work.dat, ...)
{
next.menu <- "diags"
while (next.menu == "diags") {
@@ -208,10 +214,10 @@
return(next.menu)
}
-"codamenu.diags.autocorr" <- function ()
+"codamenu.diags.autocorr" <- function (work.dat, ...)
{
next.menu <- "codamenu.diags"
- codamenu.output.header("AUTOCORRELATIONS WITHIN EACH CHAIN:")
+ codamenu.output.header("AUTOCORRELATIONS WITHIN EACH CHAIN:", work.dat)
print(autocorr(work.dat), digits = coda.options("digits"))
choices <- c("Plot autocorrelations", "Return to Diagnostics Menu")
pick <- menu(choices, title = "Autocorrelation Plots Menu")
@@ -231,7 +237,7 @@
return(next.menu)
}
-"codamenu.diags.crosscorr" <- function ()
+"codamenu.diags.crosscorr" <- function (work.dat, ...)
{
next.menu <- "codamenu.diags.crosscorr"
crosscorr.out <- if (coda.options("combine.corr")) {
@@ -270,12 +276,12 @@
return(next.menu)
}
-"codamenu.diags.heidel" <- function ()
+"codamenu.diags.heidel" <- function (work.dat, ...)
{
this.menu <- "codamenu.diags.heidel"
next.menu <- "codamenu.diags"
title <- "HEIDELBERGER AND WELCH STATIONARITY AND INTERVAL HALFWIDTH TESTS"
- codamenu.output.header(title)
+ codamenu.output.header(title, work.dat)
cat("Precision of halfwidth test =", coda.options("halfwidth"), "\n\n")
heidel.out <- heidel.diag(work.dat, eps = coda.options("halfwidth"))
print(heidel.out, digits = coda.options("digits"))
@@ -288,10 +294,10 @@
return(next.menu)
}
-"codamenu.diags.raftery" <- function ()
+"codamenu.diags.raftery" <- function (work.dat, ...)
{
next.menu <- this.menu <- "codamenu.diags.raftery"
- codamenu.output.header("RAFTERY AND LEWIS CONVERGENCE DIAGNOSTIC")
+ codamenu.output.header("RAFTERY AND LEWIS CONVERGENCE DIAGNOSTIC", work.dat)
print(raftery.diag(work.dat, q = coda.options("q"), r = coda.options("r"),
s = coda.options("s")), digits = coda.options("digits"))
choices <- c("Change parameters", "Return to diagnostics menu")
@@ -305,7 +311,7 @@
return(next.menu)
}
-"codamenu.main" <- function ()
+"codamenu.main" <- function (work.dat, ...)
{
choices <- c("Output Analysis", "Diagnostics", "List/Change Options", "Quit")
next.menu.list <- c("codamenu.anal", "codamenu.diags", "codamenu.options",
@@ -317,7 +323,7 @@
return(next.menu)
}
-"codamenu.diags.gelman" <- function (tol = 1e-08)
+"codamenu.diags.gelman" <- function (work.dat, ...)
{
next.menu <- this.menu <- "codamenu.diags.gelman"
if (nchain(work.dat) == 1) {
@@ -331,7 +337,7 @@
z <- window(work.dat, start = niter(work.dat)/2)
for (i in 2:nchain(z)) {
for (j in 1:(i - 1)) {
- if (any(apply(as.matrix(z[[i]] - z[[j]]), 2, var)) < tol) {
+ if (any(apply(as.matrix(z[[i]] - z[[j]]), 2, var)) < 1e-08) {
cat("\nError: 2nd halves of",
chanames(z, allow.null = FALSE)[c(j, i)],
"are identical for at least one variable\n")
@@ -339,7 +345,7 @@
}
}
}
- codamenu.output.header("GELMAN AND RUBIN DIAGNOSTIC")
+ codamenu.output.header("GELMAN AND RUBIN DIAGNOSTIC", work.dat)
print(gelman.diag(work.dat, transform = TRUE),
digits = coda.options("digits"))
choices <- c("Shrink Factor Plots", "Change bin size for shrink plot",
@@ -362,7 +368,7 @@
else break
}
}, ChangeBin = {
- codamenu.options.gelman(NULL)
+ codamenu.options.gelman(NULL, work.dat)
}, Return = {
next.menu <- "codamenu.diags"
})
@@ -370,10 +376,10 @@
return(next.menu)
}
-"codamenu.diags.geweke" <- function ()
+"codamenu.diags.geweke" <- function (work.dat, ...)
{
next.menu <- "codamenu.diags.geweke"
- codamenu.output.header("GEWEKE CONVERGENCE DIAGNOSTIC (Z-score)")
+ codamenu.output.header("GEWEKE CONVERGENCE DIAGNOSTIC (Z-score)", work.dat)
geweke.out <- geweke.diag(work.dat, frac1 = coda.options("frac1"),
frac2 = coda.options("frac2"))
print(geweke.out, digits = coda.options("digits"))
@@ -418,7 +424,7 @@
return(next.menu)
}
-"codamenu.options" <- function ()
+"codamenu.options" <- function (work.dat, ...)
{
next.menu <- "codamenu.options"
choices <- c("List current options", "Data Options", "Plot Options",
@@ -432,15 +438,15 @@
if (pick == 0)
return("quit")
if (action.list[pick] == "ListOptions") {
- display.coda.options(data = TRUE, stats = TRUE, plots = TRUE,
- diags = TRUE)
+ display.working.data(work.dat)
+ display.coda.options(stats = TRUE, plots = TRUE, diags = TRUE)
next.menu <- "codamenu.options"
}
else next.menu <- action.list[pick]
return(next.menu)
}
-"codamenu.options.data" <- function ()
+"codamenu.options.data" <- function (work.dat, coda.dat)
{
next.menu <- "codamenu.options.data"
@@ -459,7 +465,7 @@
if (pick == 0)
return("quit")
switch(action.list[pick], ListDataOptions = {
- display.coda.options(data = TRUE)
+ display.working.data(work.dat)
}, SelectVars = {
work.vars <- multi.menu(varnames(coda.dat, allow.null = FALSE),
"Select variables for analysis",
@@ -494,12 +500,12 @@
cat("Recreating working data...\n")
wd <- window(coda.dat[, work.vars, drop = FALSE], start = work.start,
end = work.end, thin = work.thin)
- assign("work.dat", wd[work.chains, drop=FALSE], pos=1)
+ work.dat <- wd[work.chains, drop=FALSE]
}
- return(next.menu)
+ return(list(next.menu, "work.dat"=work.dat))
}
-"codamenu.options.diag" <- function ()
+"codamenu.options.diag" <- function (work.dat, ...)
{
next.menu <- this.menu <- "codamenu.options.diag"
choices <- c("Display current diagnostic options",
@@ -516,7 +522,7 @@
switch(pick, display.coda.options(diags = TRUE),
next.menu <- codamenu.options.geweke.win(this.menu),
next.menu <- codamenu.options.geweke.bin(this.menu),
- next.menu <- codamenu.options.gelman(this.menu),
+ next.menu <- codamenu.options.gelman(this.menu, work.dat),
next.menu <- codamenu.options.raftery(this.menu),
next.menu <- codamenu.options.heidel(this.menu),
{
@@ -525,7 +531,7 @@
return(next.menu)
}
-"codamenu.options.gelman" <- function (last.menu)
+"codamenu.options.gelman" <- function (last.menu, work.dat)
{
choices <- c("Default: bin width = 10; maximum number of bins = 50",
"User-specified bin width",
@@ -591,8 +597,7 @@ function (last.menu)
return(last.menu)
}
-"codamenu.options.plot" <-
-function ()
+"codamenu.options.plot" <- function (...)
{
next.menu <- "codamenu.options.plot"
choices <- c("Show current plotting options",
@@ -637,8 +642,7 @@ function ()
return(next.menu)
}
-"codamenu.options.plot.kernel" <-
-function ()
+"codamenu.options.plot.kernel" <- function (...)
{
if (!coda.options("densplot")) {
cat("\nNo density plots requested - this option is irrelevant\n")
@@ -703,7 +707,7 @@ function ()
return(last.menu)
}
-"codamenu.options.stats" <- function ()
+"codamenu.options.stats" <- function (...)
{
next.menu <- "codamenu.options.stats"
choices <- c("Display current statistics options", "Combine chains for summary statistics",
@@ -720,8 +724,13 @@ function ()
paste(coda.options("quantiles"), collapse = ", "))
repeat {
cat("\n", mssg, "\n")
- ans <- as.numeric(scan(what = character(), sep = ",",
- quiet = TRUE, nlines = 1))
+ if (is.R()) {
+ ans <- as.numeric(scan(what = character(), sep = ",", nlines = 1,
+ quiet = TRUE))
+ }
+ else {
+ ans <- as.numeric(scan(what = character(), sep = ",", nlines = 1))
+ }
if (length(ans) == 0)
ans <- coda.options("quantiles")
if (any(is.na(ans)))
@@ -743,25 +752,27 @@ function ()
return(next.menu)
}
+"display.working.data" <- function (data)
+{
+ cat("WORKING DATA\n")
+ cat("============\n")
+ cat("Variables selected : ",
+ paste(varnames(data, allow.null = FALSE), collapse=", ")
+ ,"\n", sep="")
+ cat("Chains selected : ",
+ paste(chanames(data, allow.null = FALSE), collapse=", ")
+ , "\n", sep="")
+ cat("Iterations - start : ", start(data), "\n", sep="")
+ cat(" end : ", end(data), "\n", sep="")
+ cat("Thinning interval : ", thin(data), "\n", sep="")
+ cat("\n")
+}
+
"display.coda.options" <-
- function (data = FALSE, stats = FALSE, plots = FALSE, diags = FALSE)
+ function (stats = FALSE, plots = FALSE, diags = FALSE)
{
cat("\nCurrent option settings:")
cat("\n=======================\n\n")
- if (data) {
- cat("WORKING DATA\n")
- cat("============\n")
- cat("Variables selected : ",
- paste(varnames(work.dat, allow.null = FALSE), collapse=", ")
- ,"\n", sep="")
- cat("Chains selected : ",
- paste(chanames(work.dat, allow.null = FALSE), collapse=", ")
- , "\n", sep="")
- cat("Iterations - start : ", start(work.dat), "\n", sep="")
- cat(" end : ", end(work.dat), "\n", sep="")
- cat("Thinning interval : ", thin(work.dat), "\n", sep="")
- cat("\n")
- }
if (stats) {
cat("SUMMARY STATISTICS OPTIONS\n")
cat("==========================\n\n")
@@ -820,17 +831,31 @@ function ()
"read.coda.interactive" <- function ()
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
repeat {
cat("Enter CODA index file name\n")
cat("(or a blank line to exit)\n")
- index.file <- scan(what = character(), sep = "\n", strip.white = TRUE,
- quiet = TRUE, nlines=1)
+ if (is.R()) {
+ index.file <- scan(what = character(), sep = "\n", strip.white = TRUE,
+ nlines=1, quiet=TRUE)
+ }
+ else {
+ index.file <- scan(what = character(), sep = "\n", strip.white = TRUE,
+ nlines = 1)
+ }
if (length(index.file) == 0)
return()
cat("Enter CODA output file names, separated by return key\n")
cat("(leave a blank line when you have finished)\n")
- output.files <- scan(what = character(), sep = "\n", strip.white = TRUE,
- quiet = TRUE)
+ if (is.R()) {
+ output.files <- scan(what = character(), sep = "\n", strip.white = TRUE,
+ quiet = TRUE)
+ }
+ else {
+ output.files <- scan(what = character(), sep = "\n", strip.white = TRUE)
+ }
all.files <- c(index.file, output.files)
if (any(!file.exists(all.files))) {
cat("The following files were not found:\n")
@@ -846,22 +871,17 @@ function ()
return(mcmc.list(chains))
}
-"tidy.up" <- function ()
+"tidy.up" <- function (data)
{
cat("\nQuitting codamenu ...\n")
if (!coda.options("data.saved")) {
ans <- read.yesno("Do you want to save the mcmc output", default=FALSE)
if (ans == TRUE) {
- cat("Enter name you want to call this object file:\n")
+ cat("Enter name you want to call this object:\n")
fname <- scan(what = character(), nmax = 1, strip.white = TRUE)
- assign(fname, coda.dat, pos=1)
+ assign(fname, data, pos=1)
}
}
- coda.objects <- c("coda.dat", "work.dat")
- for (i in coda.objects) {
- if (exists(i))
- rm(list=i, pos = 1)
- }
}
"codamenu.ps" <- function ()
@@ -895,7 +915,7 @@ function ()
return(dev.cur())
}
-"codamenu.output.header" <- function (title)
+"codamenu.output.header" <- function (title, data)
{
##
## A short header: common to most codamenu output
@@ -903,50 +923,9 @@ function ()
cat("\n", title, sep = "")
cat("\n", paste(rep("=", nchar(title)), collapse = ""), "\n\n",
sep = "")
- cat("Iterations used = ", start(work.dat), ":", end(work.dat),
+ cat("Iterations used = ", start(data), ":", end(data),
"\n", sep = "")
- cat("Thinning interval =", thin(work.dat), "\n")
- cat("Sample size per chain =", niter(work.dat), "\n\n")
+ cat("Thinning interval =", thin(data), "\n")
+ cat("Sample size per chain =", niter(data), "\n\n")
invisible()
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/R/cumuplot.R b/R/cumuplot.R
index 2e55ef1..446ad10 100644
--- a/R/cumuplot.R
+++ b/R/cumuplot.R
@@ -2,9 +2,12 @@ cumuplot <- function(x, probs=c(0.025,0.5,0.975), ylab="", lty=c(2,1),
lwd=c(1,2), type="l", ask=dev.interactive(),
auto.layout=TRUE, col=1, ...)
{
- cquantile <- function(z, probs)
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
+ cquantile <- function(z, probs)
{
- ## Calculates cumulative quantile of a vector
+ ## Calculates cumulative quantile of a vector
cquant <- matrix(0, nrow=length(z), length(probs))
for(i in seq(along=z)) # for loop proved faster than apply here
cquant[i,] <- quantile(z[1:i], probs=probs, names=FALSE)
diff --git a/R/gelman.R b/R/gelman.R
index f78c0fd..85de854 100644
--- a/R/gelman.R
+++ b/R/gelman.R
@@ -10,6 +10,9 @@
## Graphical Statistics, 7, 434-455.
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
x <- as.mcmc.list(x)
if (nchain(x) < 2)
stop("You need at least two chains")
@@ -148,6 +151,9 @@
col = 1:2, lty = 1:2, xlab = "last iteration in chain",
ylab = "shrink factor", type = "l", ...)
{
+ if (!is.R()) {
+ stop("This function is not yet avialable in S-PLUS")
+ }
x <- as.mcmc.list(x)
oldpar <- NULL
on.exit(par(oldpar))
diff --git a/R/geweke.R b/R/geweke.R
index 2ef4680..6d26eb2 100644
--- a/R/geweke.R
+++ b/R/geweke.R
@@ -2,6 +2,9 @@
function (x, frac1 = 0.1, frac2 = 0.5)
##
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
if (is.mcmc.list(x))
return(lapply(x, geweke.diag, frac1, frac2))
x <- as.mcmc(x)
@@ -23,6 +26,9 @@
function (x, frac1 = 0.1, frac2 = 0.5, nbins = 20,
pvalue = 0.05, auto.layout = TRUE, ask = dev.interactive(), ...)
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
x <- as.mcmc.list(x)
oldpar <- NULL
on.exit(par(oldpar))
diff --git a/R/heidel.R b/R/heidel.R
index 4dcec69..f5777d8 100644
--- a/R/heidel.R
+++ b/R/heidel.R
@@ -1,5 +1,8 @@
"heidel.diag" <- function (x, eps = 0.1, pvalue=0.05)
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
if (is.mcmc.list(x))
return(lapply(x, heidel.diag, eps))
x <- as.mcmc(as.matrix(x))
@@ -113,7 +116,12 @@ effectiveSize <- function(x)
x <- as.matrix(x)
if (!is.null(max.length) && nrow(x) > max.length) {
batch.size <- ceiling(nrow(x)/max.length)
- x <- aggregate(ts(x, frequency=batch.size), nfreq = 1, FUN=mean)
+ if (is.R()) {
+ x <- aggregate(ts(x, frequency=batch.size), nfreq = 1, FUN=mean)
+ }
+ else {
+ x <- aggregate(ts(x, frequency=batch.size), nf = 1, fun=mean)
+ }
}
else {
batch.size <- 1
@@ -157,8 +165,7 @@ effectiveSize <- function(x)
spec = spec[1 + (1:Nfreq)],
inset = I(freq<=max.freq))
- glm.out <- glm(fmla, family=Gamma(link="log"), data=spec.data,
- subset=inset)
+ glm.out <- glm(fmla, family=Gamma(link="log"), data=spec.data)
v0[i] <- predict(glm.out, type="response",
newdata=data.frame(spec=0,one=1,f1=-sqrt(3),f2=sqrt(5)))
}
@@ -168,6 +175,9 @@ effectiveSize <- function(x)
"pcramer" <- function (q, eps=1.0e-5)
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
## Distribution function of the Cramer-von Mises statistic
##
log.eps <- log(eps)
diff --git a/R/jags.R b/R/jags.R
index 412df9d..feca17a 100644
--- a/R/jags.R
+++ b/R/jags.R
@@ -1,22 +1,29 @@
"read.jags" <- function (file = "jags.out", start, end, thin, quiet=FALSE)
{
- read.coda(file, start, end, thin, quiet)
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
+ read.coda(file, start, end, thin, quiet)
}
bugs2jags <- function(infile, outfile)
{
- ## Convert S-style data for WinBUGS into the R dump format
- ## used by JAGS.
- bugs.dat <- dget(infile)
- for (bugs.variable.name in names(bugs.dat)) {
- if(!is.null(dim(bugs.dat[[bugs.variable.name]]))) {
- ## Manually reverse order of dimensions of arrays
- dim(bugs.dat[[bugs.variable.name]]) <-
- rev(dim(bugs.dat[[bugs.variable.name]]))
- ## Then transpose
- bugs.dat[[bugs.variable.name]] <- aperm(bugs.dat[[bugs.variable.name]])
- }
- assign(bugs.variable.name, bugs.dat[[bugs.variable.name]])
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
+
+ ## Convert S-style data for WinBUGS into the R dump format
+ ## used by JAGS.
+ bugs.dat <- dget(infile)
+ for (bugs.variable.name in names(bugs.dat)) {
+ if(!is.null(dim(bugs.dat[[bugs.variable.name]]))) {
+ ## Manually reverse order of dimensions of arrays
+ dim(bugs.dat[[bugs.variable.name]]) <-
+ rev(dim(bugs.dat[[bugs.variable.name]]))
+ ## Then transpose
+ bugs.dat[[bugs.variable.name]] <- aperm(bugs.dat[[bugs.variable.name]])
}
+ assign(bugs.variable.name, bugs.dat[[bugs.variable.name]])
+ }
dump(names(bugs.dat), file=outfile)
}
diff --git a/R/mcmc.R b/R/mcmc.R
index 180be85..7503d6e 100644
--- a/R/mcmc.R
+++ b/R/mcmc.R
@@ -1,8 +1,15 @@
"[.mcmc" <- function (x, i, j, drop = missing(i))
{
+ ## In S-PLUS the code is altered so that the user can
+ ## pick out particular parameters by calling mcmc.obj[,c("param1", "param2")]
xstart <- start(x)
xthin <- thin(x)
- y <- NextMethod("[")
+ if (is.R()) {
+ y <- NextMethod("[")
+ }
+ else {
+ y <- as.matrix(x)[i,j]
+ }
if (length(y) == 0 || is.null(y))
return(y)
if (missing(i))
@@ -108,7 +115,7 @@
}
-"as.matrix.mcmc" <- function (x, iters = FALSE)
+"as.matrix.mcmc" <- function (x, iters = FALSE, ...)
{
y <- matrix(nrow = niter(x), ncol = nvar(x) + iters)
var.cols <- iters + 1:nvar(x)
diff --git a/R/mcmclist.R b/R/mcmclist.R
index c49d52d..bcc6b20 100644
--- a/R/mcmclist.R
+++ b/R/mcmclist.R
@@ -1,12 +1,20 @@
"[.mcmc.list" <- function (x, i, j, drop = TRUE)
{
+ ## In S-PLUS the code is altered so that the user can
+ ## pick out particular parameters by calling mcmc.obj[,c("param1", "param2")]
+
## Trying to squeeze too much functionality in here
## x[p:q] will subset the list
## x[p,], x[,q], x[p,q] will be recursively applied to
## the elements of the list, even if they are vectors
if (nargs() < 3 + !missing(drop)) {
## Subset the list
- y <- NextMethod("[")
+ if (is.R()) {
+ y <- NextMethod("[")
+ }
+ else {
+ y <- as.matrix(x)[i,j]
+ }
}
else {
## Subset the elements of the list
@@ -137,7 +145,7 @@
}
"as.matrix.mcmc.list" <-
- function (x, iters = FALSE, chains = FALSE)
+ function (x, iters = FALSE, chains = FALSE, ...)
{
x <- mcmc.list(x)
y <- matrix(nrow = niter(x) * nchain(x), ncol = nvar(x) +
diff --git a/R/output.R b/R/output.R
index e3c6e85..d9af9bc 100644
--- a/R/output.R
+++ b/R/output.R
@@ -4,7 +4,8 @@ function (x, lags = c(0, 1, 5, 10, 50), relative = TRUE)
## RGA moved MCMC list processing first, else thinning gets
## applied twice. Thanks to Denise Chang for finding this.
if (is.mcmc.list(x))
- return(lapply(x, autocorr, lags, relative))
+ return(lapply(x, autocorr, lags = lags, relative = relative))
+ lag.max <- max(lags)
if (relative)
lags <- lags * thin(x)
else if (any(lags%%thin(x) != 0))
@@ -13,7 +14,7 @@ function (x, lags = c(0, 1, 5, 10, 50), relative = TRUE)
x <- as.mcmc(x)
y <- array(dim = c(length(lags), nvar(x), nvar(x)))
dimnames(y) <- list(paste("Lag", lags), varnames(x), varnames(x))
- acf.out <- acf(as.ts.mcmc(x), lag.max = max(lags), plot = FALSE)$acf
+ acf.out <- acf(as.ts.mcmc(x), lag.max = lag.max, plot = FALSE)$acf
y[, , ] <- if (is.array(acf.out))
acf.out[lags%/%thin(x) + 1, , ]
else acf.out[lags%/%thin(x) + 1]
@@ -21,8 +22,16 @@ function (x, lags = c(0, 1, 5, 10, 50), relative = TRUE)
}
"autocorr.plot" <-
-function (x, lag.max, auto.layout = TRUE, ask = dev.interactive(), ...)
+function (x, lag.max, auto.layout = TRUE, ask, ...)
{
+ if (missing(ask)) {
+ ask <- if (is.R()) {
+ dev.interactive()
+ }
+ else {
+ interactive()
+ }
+ }
oldpar <- NULL
on.exit(par(oldpar))
if (auto.layout)
@@ -56,6 +65,9 @@ function (x)
"crosscorr.plot" <-
function (x, col = topo.colors(10), ...)
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
Nvar <- nvar(x)
pcorr <- crosscorr(x)
dens <- ((pcorr + 1) * length(col))%/%2 + (pcorr < 1) + (pcorr <
@@ -95,6 +107,9 @@ function (x, col = topo.colors(10), ...)
"densplot" <-
function (x, show.obs = TRUE, bwf, main = "", ylim, ...)
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
xx <- as.matrix(x)
for (i in 1:nvar(x)) {
y <- xx[, i, drop = TRUE]
@@ -159,6 +174,9 @@ function (x, show.obs = TRUE, bwf, main = "", ylim, ...)
"read.openbugs" <-
function (stem = "", start, end, thin, quiet = FALSE)
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
index.file <- paste(stem, "CODAindex.txt", sep = "")
if (!file.exists(index.file))
stop("No index file found")
@@ -196,7 +214,12 @@ function (stem = "", start, end, thin, quiet = FALSE)
index <- read.table(index.file,
row.names = 1, col.names = c("", "begin", "end"))
vnames <- row.names(index)
- temp <- scan(output.file, what = list(iter = 0, val = 0), quiet = TRUE)
+ if (is.R()) {
+ temp <- scan(output.file, what = list(iter = 0, val = 0), quiet = TRUE)
+ }
+ else {
+ temp <- scan(output.file, what = list(iter = 0, val = 0))
+ }
## Do one pass through the data to see if we can construct
## a regular time series easily
##
@@ -388,7 +411,12 @@ function (x, smooth = TRUE, col = 1:6, type = "l", ylab = "",
varquant <- drop(varquant)
out <- list(statistics = varstats, quantiles = varquant,
start = start(x), end = end(x), thin = thin(x), nchain = 1)
- class(out) <- "summary.mcmc"
+ if (is.R()) {
+ class(out) <- "summary.mcmc"
+ }
+ else {
+ oldClass(out) <- "summary.mcmc"
+ }
return(out)
}
diff --git a/R/raftery.R b/R/raftery.R
index d0f9088..f42a489 100644
--- a/R/raftery.R
+++ b/R/raftery.R
@@ -1,7 +1,10 @@
"raftery.diag" <-
function (data, q = 0.025, r = 0.005, s = 0.95, converge.eps = 0.001)
{
- if (is.mcmc.list(data))
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
+ if (is.mcmc.list(data))
return(lapply(data, raftery.diag, q, r, s, converge.eps))
data <- as.mcmc(data)
resmatrix <- matrix(nrow = nvar(data), ncol = 4, dimnames = list(varnames(data,
diff --git a/R/trellisplots.R b/R/trellisplots.R
index 554864e..6c41562 100644
--- a/R/trellisplots.R
+++ b/R/trellisplots.R
@@ -137,6 +137,9 @@ densityplot.mcmc <-
...,
subset = thinned.indices(x, start = start, thin = thin))
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
if (!missing(outer)) warning("specification of outer ignored")
data <- as.data.frame(x)
form <-
@@ -188,6 +191,9 @@ densityplot.mcmc.list <-
...,
subset = thinned.indices(x[[1]], start = start, thin = thin))
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
if (groups && outer) warning("'groups=TRUE' ignored when 'outer=TRUE'")
datalist <- lapply(x, function(x) as.data.frame(x)[subset, ])
data <- do.call("rbind", datalist)
@@ -209,7 +215,7 @@ densityplot.mcmc.list <-
## paste(names(data),
## collapse = "+")))
##data[["index"]] <- seq(length = nrow(x[[1]]))[subset]
- data[[".run"]] <- gl(length(datalist), nrow(datalist[[1]]))
+ .run <- gl(length(datalist), nrow(datalist[[1]]))
if (groups && !outer)
densityplot(form, data = data,
outer = TRUE,
@@ -291,7 +297,8 @@ qqmath.mcmc.list <-
paste(lapply(names(data), as.name),
collapse = "+")))
##data[["index"]] <- seq(length = nrow(x[[1]]))[subset]
- data[[".run"]] <- gl(length(datalist), nrow(datalist[[1]]))
+ ##data[[".run"]] <- gl(length(datalist), nrow(datalist[[1]]))
+ .run <- gl(length(datalist), nrow(datalist[[1]]))
if (groups && !outer)
qqmath(form, data = data,
outer = TRUE,
@@ -380,7 +387,7 @@ xyplot.mcmc.list <-
## collapse = "+"),
## "~ index"))
data[[".index"]] <- seq(length = nrow(datalist[[1]])) ## repeated
- data[[".run"]] <- gl(length(datalist), nrow(datalist[[1]]))
+ .run <- gl(length(datalist), nrow(datalist[[1]]))
if (groups && !outer)
xyplot(form, data = data,
outer = TRUE,
@@ -527,7 +534,7 @@ acfplot.mcmc.list <-
collapse = "+"),
"~ .lag"))
data[[".lag"]] <- seq(length = nrow(datalist[[1]])) ## repeated
- data[[".run"]] <- gl(length(datalist), nrow(datalist[[1]]))
+ .run <- gl(length(datalist), nrow(datalist[[1]]))
if (groups && !outer)
xyplot(form, data = data,
outer = TRUE,
diff --git a/R/util.R b/R/util.R
index 32ee612..4c50d01 100644
--- a/R/util.R
+++ b/R/util.R
@@ -29,12 +29,19 @@ function (string, option)
"coda.options" <-
function (...)
{
+ if (!is.R()) {
+ stop("This function is not yet available in S-PLUS")
+ }
## Set and display coda options
single <- FALSE
- if (!exists(".Coda.Options", frame = 1))
- .Coda.Options <<- .Coda.Options.Default
+ copt <- if (exists(".Coda.Options", frame = 1)) {
+ get(".Coda.Options", pos=1)
+ }
+ else {
+ .Coda.Options.Default
+ }
if (nargs() == 0) {
- return(.Coda.Options)
+ return(copt)
}
else {
args <- list(...)
@@ -50,8 +57,8 @@ function (...)
args <- unlist(args)
value <- vector("list", length(args))
names(value) <- args
- for (v in args) if (any(v == names(.Coda.Options)))
- value[v] <- .Coda.Options[v]
+ for (v in args) if (any(v == names(copt)))
+ value[v] <- copt[v]
if (single)
return(value[[1]])
else return(value)
@@ -62,14 +69,15 @@ function (...)
names(oldvalue) <- names(args)
if (any(names(args) == "default") && args$default ==
TRUE)
- .Coda.Options <<- .Coda.Options.Default
- for (v in names(args)) if (any(v == names(.Coda.Options))) {
- oldvalue[v] <- .Coda.Options[v]
+ copt <- .Coda.Options.Default
+ for (v in names(args)) if (any(v == names(copt))) {
+ oldvalue[v] <- copt[v]
if (is.null(args[[v]]))
- .Coda.Options[v] <<- list(NULL)
- else if (mode(.Coda.Options[[v]]) == mode(args[[v]]))
- .Coda.Options[v] <<- args[v]
+ copt[v] <- list(NULL)
+ else if (mode(copt[[v]]) == mode(args[[v]]))
+ copt[v] <- args[v]
}
+ assign(".Coda.Options", copt, pos=1)
invisible(oldvalue)
}
}
@@ -253,3 +261,4 @@ function (...)
+
diff --git a/man/HPDinterval.Rd b/man/HPDinterval.Rd
index 34d3bcc..0047508 100644
--- a/man/HPDinterval.Rd
+++ b/man/HPDinterval.Rd
@@ -8,9 +8,9 @@
an MCMC sample.
}
\usage{
-HPDinterval(obj, prob = 0.95, ...)
-\method{HPDinterval}{mcmc}(obj, prob = 0.95, ...)
-\method{HPDinterval}{mcmc.list}(obj, prob = 0.95, ...)
+HPDinterval(obj, prob = 0.95, \dots)
+\method{HPDinterval}{mcmc}(obj, prob = 0.95, \dots)
+\method{HPDinterval}{mcmc.list}(obj, prob = 0.95, \dots)
}
\arguments{
\item{obj}{The object containing the MCMC sample - usually of class
diff --git a/man/as.ts.mcmc.Rd b/man/as.ts.mcmc.Rd
index e204f00..20fce28 100644
--- a/man/as.ts.mcmc.Rd
+++ b/man/as.ts.mcmc.Rd
@@ -2,11 +2,11 @@
\alias{as.ts.mcmc}
\title{Coerce mcmc object to time series}
-\usage{as.ts.mcmc(x,...)}
+\usage{as.ts.mcmc(x,\dots)}
\arguments{
\item{x}{an mcmc object}
- \item{...}{unused arguments for compatibility with generic \code{as.ts}}
+ \item{\dots}{unused arguments for compatibility with generic \code{as.ts}}
}
\description{
diff --git a/man/autocorr.Rd b/man/autocorr.Rd
index 307b6d6..a624f23 100644
--- a/man/autocorr.Rd
+++ b/man/autocorr.Rd
@@ -33,6 +33,6 @@ A vector or array containing the autocorrelations.
\author{Martyn Plummer}
\seealso{
-\code{\link{acf}}, \code{\link{autocorr.plot}}.}
+ \code{\link{acf}}, \code{\link{autocorr.plot}}.
}
\keyword{ts}
diff --git a/man/autocorr.diag.Rd b/man/autocorr.diag.Rd
index 0441cff..18d97c6 100644
--- a/man/autocorr.diag.Rd
+++ b/man/autocorr.diag.Rd
@@ -4,10 +4,10 @@
\alias{autocorr.diag.mcmc.list}
\title{Autocorrelation function for Markov chains}
-\usage{autocorr.diag(mcmc.obj, ...)}
+\usage{autocorr.diag(mcmc.obj, \dots)}
\arguments{
\item{mcmc.obj}{an object of class \code{mcmc} or \code{mcmc.list}}
- \item{...}{optional arguments to be passed to \code{autocorr}}
+ \item{\dots}{optional arguments to be passed to \code{autocorr}}
}
\description{
\code{autocorr.diag} calculates the autocorrelation function for the
@@ -31,6 +31,6 @@ A vector containing the autocorrelations.
\author{Russell Almond}
\seealso{
-\code{\link{autocorr}}, \code{\link{acf}}, \code{\link{autocorr.plot}}.}
+ \code{\link{autocorr}}, \code{\link{acf}}, \code{\link{autocorr.plot}}.
}
\keyword{ts}
diff --git a/man/autocorr.plot.Rd b/man/autocorr.plot.Rd
index 61124a2..d46df63 100644
--- a/man/autocorr.plot.Rd
+++ b/man/autocorr.plot.Rd
@@ -2,8 +2,7 @@
\alias{autocorr.plot}
\title{Plot autocorrelations for Markov Chains}
-\usage{autocorr.plot(x, lag.max, auto.layout = TRUE,
-ask=dev.interactive(), ...)}
+\usage{autocorr.plot(x, lag.max, auto.layout = TRUE, ask, \dots)}
\arguments{
\item{x}{A Markov Chain}
@@ -12,7 +11,7 @@ ask=dev.interactive(), ...)}
plots, otherwise use existing one.}
\item{ask}{If \code{TRUE} then prompt user before displaying
each page of plots.}
-\item{...}{graphical parameters}
+\item{\dots}{graphical parameters}
}
\description{
diff --git a/man/coda.options.Rd b/man/coda.options.Rd
index 49342a9..3c0ce33 100644
--- a/man/coda.options.Rd
+++ b/man/coda.options.Rd
@@ -5,17 +5,16 @@
\alias{.Coda.Options.Default}
\title{Options settings for the codamenu driver}
\usage{
-coda.options(...)
-display.coda.options(data = FALSE, stats = FALSE, plots = FALSE, diags = FALSE)
+coda.options(\dots)
+display.coda.options(stats = FALSE, plots = FALSE, diags = FALSE)
.Coda.Options
.Coda.Options.Default
}
\arguments{
- \item{data}{logical flag: show data options?}
\item{stats}{logical flag: show summary statistic options?}
\item{plots}{logical flag: show plotting options?}
\item{diags}{logical flag: show plotting options?}
- \item{...}{list of options}
+ \item{\dots}{list of options}
}
\description{
\code{coda.options} is a utility function that queries and sets
diff --git a/man/crosscorr.plot.Rd b/man/crosscorr.plot.Rd
index 18df54a..62d9f63 100644
--- a/man/crosscorr.plot.Rd
+++ b/man/crosscorr.plot.Rd
@@ -2,12 +2,12 @@
\alias{crosscorr.plot}
\title{Plot image of correlation matrix}
-\usage{crosscorr.plot (x, col = topo.colors(10), ...)}
+\usage{crosscorr.plot (x, col = topo.colors(10), \dots)}
\arguments{
\item{x}{an \code{mcmc} or \code{mcmc.list} object}
\item{col}{color palette to use}
-\item{...}{graphical parameters}
+\item{\dots}{graphical parameters}
}
\description{
diff --git a/man/cumuplot.Rd b/man/cumuplot.Rd
index 248eed5..3630efa 100644
--- a/man/cumuplot.Rd
+++ b/man/cumuplot.Rd
@@ -5,7 +5,7 @@
\usage{
cumuplot(x, probs=c(0.025,0.5,0.975), ylab="",
lty=c(2,1), lwd=c(1,2), type="l", ask=dev.interactive(),
- auto.layout=TRUE, col=1, ...)
+ auto.layout=TRUE, col=1, \dots)
}
\arguments{
@@ -16,7 +16,7 @@
plots, otherwise use existing one.}
\item{ask}{If \code{TRUE} then prompt user before displaying
each page of plots.}
- \item{...}{further graphical parameters}
+ \item{\dots}{further graphical parameters}
}
\description{
diff --git a/man/densplot.Rd b/man/densplot.Rd
index 9baf342..c69efa6 100644
--- a/man/densplot.Rd
+++ b/man/densplot.Rd
@@ -2,7 +2,7 @@
\alias{densplot}
\title{Probability density function estimate from MCMC output}
-\usage{densplot(x, show.obs=TRUE, bwf, main, ylim, ...)}
+\usage{densplot(x, show.obs=TRUE, bwf, main, ylim, \dots)}
\arguments{
\item{x}{An \code{mcmc} or \code{mcmc.list} object}
@@ -13,7 +13,7 @@
size to the negative one fifth power}
\item{main}{Title. See \code{par()}}
\item{ylim}{Limits on y axis. See \code{par()}}
- \item{...}{Further graphical parameters}
+ \item{\dots}{Further graphical parameters}
}
\description{
diff --git a/man/gelman.diag.Rd b/man/gelman.diag.Rd
index 97c8338..3e92d8a 100644
--- a/man/gelman.diag.Rd
+++ b/man/gelman.diag.Rd
@@ -37,27 +37,31 @@ distribution of the variable under examination is normal. Hence the
}
\section{Theory}{
+
Gelman and Rubin (1992) propose a general approach to monitoring
-convergence of MCMC output in which two or more parallel chains are run
+convergence of MCMC output in which \eqn{m > 1} parallel chains are run
with starting values that are overdispersed relative to the posterior
distribution. Convergence is diagnosed when the chains have `forgotten'
-their initial values, and the output from all chains is indistinguishable.
-The \code{gelman.diag} diagnostic is applied to a single variable from
-the chain. It is based a comparison of within-chain and between-chain
-variances, and is similar to a classical analysis of variance.
+their initial values, and the output from all chains is
+indistinguishable. The \code{gelman.diag} diagnostic is applied to a
+single variable from the chain. It is based a comparison of within-chain
+and between-chain variances, and is similar to a classical analysis of
+variance.
There are two ways to estimate the variance of the stationary distribution:
the mean of the empirical variance within each chain, \eqn{W}, and
the empirical variance from all chains combined, which can be expressed as
\deqn{ \widehat{\sigma}^2 =
- \frac{(n-1) B }{n} + \frac{W}{n} }{ sigma.hat^2 = (n-1)B/n + W/n }
-where \eqn{B} is the empirical between-chain variance.
+ \frac{(n-1) W }{n} + \frac{B}{n} }{ sigma.hat^2 = (n-1)W/n + B/n }
+where {n} is the number of iterations and \eqn{B/n} is the empirical
+between-chain variance.
-If the chains have converged, then both estimates are unbiased. Otherwise
-the first method will \emph{underestimate} the variance, since the
-individual chains have not had time to range all over the stationary
-distribution, and the second method will \emph{overestimate} the variance,
-since the starting points were chosen to be overdispersed.
+If the chains have converged, then both estimates are
+unbiased. Otherwise the first method will \emph{underestimate} the
+variance, since the individual chains have not had time to range all
+over the stationary distribution, and the second method will
+\emph{overestimate} the variance, since the starting points were chosen
+to be overdispersed.
The convergence diagnostic is based on the assumption that the
target distribution is normal. A Bayesian credible interval can
@@ -66,9 +70,8 @@ be constructed using a t-distribution with mean
combined}}{mu.hat = Sample mean of all chains combined}
and variance
\deqn{\widehat{V}=\widehat{\sigma}^2 + \frac{B}{mn}}{V.hat=sigma.hat2 + B/(mn)}
-where \eqn{m} is the number of chains, and degrees of freedom
-estimated by the method of moments
-\deqn{d = \frac{2*\widehat{V}}{\mbox{Var}(\widehat{V})}}{d = 2*V.hat/Var(V.hat)}
+and degrees of freedom estimated by the method of moments
+\deqn{d = \frac{2*\widehat{V}^2}{\mbox{Var}(\widehat{V})}}{d = 2*V.hat^2/Var(V.hat)}
Use of the t-distribution accounts for the fact that the mean
and variance of the posterior distribution are estimated.
diff --git a/man/gelman.plot.Rd b/man/gelman.plot.Rd
index aa1c257..a58d5ed 100644
--- a/man/gelman.plot.Rd
+++ b/man/gelman.plot.Rd
@@ -6,7 +6,7 @@
\usage{
gelman.plot(x, bin.width = 10, max.bins = 50,
confidence = 0.95, transform = FALSE, auto.layout = TRUE,
-ask = dev.interactive(), col, lty, xlab, ylab, type, ...)
+ask = dev.interactive(), col, lty, xlab, ylab, type, \dots)
}
\arguments{
@@ -24,7 +24,7 @@ ask = dev.interactive(), col, lty, xlab, ylab, type, ...)
\item{xlab}{graphical parameter (see \code{par})}
\item{ylab}{graphical parameter (see \code{par})}
\item{type}{graphical parameter (see \code{par})}
- \item{...}{further graphical parameters.}
+ \item{\dots}{further graphical parameters.}
}
\description{
diff --git a/man/geweke.plot.Rd b/man/geweke.plot.Rd
index 5c85ffd..733289b 100644
--- a/man/geweke.plot.Rd
+++ b/man/geweke.plot.Rd
@@ -4,7 +4,7 @@
\usage{
geweke.plot(x, frac1 = 0.1, frac2 = 0.5, nbins = 20,
- pvalue = 0.05, auto.layout = TRUE, ask = dev.interactive(), ...)
+ pvalue = 0.05, auto.layout = TRUE, ask = dev.interactive(), \dots)
}
\arguments{
@@ -16,7 +16,7 @@ geweke.plot(x, frac1 = 0.1, frac2 = 0.5, nbins = 20,
\item{auto.layout}{If \code{TRUE} then, set up own layout for
plots, otherwise use existing one.}
\item{ask}{Prompt user before displaying each page of plots.}
- \item{...}{Graphical parameters.}
+ \item{\dots}{Graphical parameters.}
}
\description{
diff --git a/man/heidel.diag.Rd b/man/heidel.diag.Rd
index aa3222e..a1ccc62 100644
--- a/man/heidel.diag.Rd
+++ b/man/heidel.diag.Rd
@@ -25,7 +25,7 @@ from a chain that has converged.
The convergence test uses the Cramer-von-Mises statistic to test the null
hypothesis that the sampled values come from a stationary distribution.
The test is successively applied, firstly to the whole chain, then after
-discarding the first 10\%, 20\%, ... of the chain until either the null
+discarding the first 10\%, 20\%, \ldots of the chain until either the null
hypothesis is accepted, or 50\% of the chain has been discarded. The latter
outcome constitutes `failure' of the stationarity test and indicates
that a longer MCMC run is needed. If the stationarity test is passed,
diff --git a/man/mcmc.convert.Rd b/man/mcmc.convert.Rd
index 4c2cdc0..1de7e94 100644
--- a/man/mcmc.convert.Rd
+++ b/man/mcmc.convert.Rd
@@ -6,9 +6,9 @@
\title{Conversions of MCMC objects}
\usage{
-as.matrix.mcmc(x, iters = FALSE)
-as.matrix.mcmc.list(x, iters = FALSE, chains = FALSE)
-as.array.mcmc.list(x, drop, ...)
+\method{as.matrix}{mcmc}(x, iters = FALSE, ...)
+\method{as.matrix}{mcmc.list}(x, iters = FALSE, chains = FALSE, ...)
+\method{as.array}{mcmc.list}(x, drop, ...)
}
\arguments{
@@ -17,7 +17,7 @@ as.array.mcmc.list(x, drop, ...)
\item{chains}{logical flag: add column for chain number? (if mcmc.list)}
\item{drop}{logical flag: if \code{TRUE} the result is coerced to the
lowest possible dimension}
- \item{...}{further arguments for future methods}
+ \item{...}{optional arguments to the various methods}
}
\description{
diff --git a/man/mcmc.list.Rd b/man/mcmc.list.Rd
index 865b792..df6ffb4 100644
--- a/man/mcmc.list.Rd
+++ b/man/mcmc.list.Rd
@@ -7,13 +7,13 @@
\title{Replicated Markov Chain Monte Carlo Objects}
\usage{
-mcmc.list(...)
-as.mcmc.list(x, ...)
+mcmc.list(\dots)
+as.mcmc.list(x, \dots)
is.mcmc.list(x)
}
\arguments{
- \item{...}{a list of mcmc objects}
+ \item{\dots}{a list of mcmc objects}
\item{x}{an object that may be coerced to mcmc.list}
}
diff --git a/man/plot.mcmc.Rd b/man/plot.mcmc.Rd
index 6bdd65b..defbdf0 100644
--- a/man/plot.mcmc.Rd
+++ b/man/plot.mcmc.Rd
@@ -4,7 +4,7 @@
\usage{
\method{plot}{mcmc}(x, trace = TRUE, density = TRUE, smooth = TRUE, bwf,
- auto.layout = TRUE, ask = dev.interactive(), ...)
+ auto.layout = TRUE, ask = dev.interactive(), \dots)
}
\arguments{
@@ -15,7 +15,7 @@
\item{bwf}{Bandwidth function for density plots}
\item{auto.layout}{Automatically generate output format}
\item{ask}{Prompt user before each page of plots}
- \item{...}{Further arguments}
+ \item{\dots}{Further arguments}
}
\description{
diff --git a/man/read.openbugs.Rd b/man/read.openbugs.Rd
index 5000f5b..07d6395 100644
--- a/man/read.openbugs.Rd
+++ b/man/read.openbugs.Rd
@@ -9,7 +9,7 @@ read.openbugs(stem="", start, end, thin, quiet=FALSE)
\arguments{
\item{stem}{Character string giving the stem for the output files.
OpenBUGS produces files with names "<stem>CODAindex.txt",
- "<stem>CODAchain1.txt", "<stem>CODAchain2.txt", ...}
+ "<stem>CODAchain1.txt", "<stem>CODAchain2.txt", \ldots}
\item{start}{First iteration of chain}
\item{end}{Last iteration of chain}
\item{thin}{Thinning interval for chain}
diff --git a/man/summary.mcmc.Rd b/man/summary.mcmc.Rd
index 47b3784..26fe684 100644
--- a/man/summary.mcmc.Rd
+++ b/man/summary.mcmc.Rd
@@ -6,13 +6,13 @@
\title{Summary statistics for Markov Chain Monte Carlo chains}
\usage{
-\method{summary}{mcmc}(object, quantiles = c(0.025, 0.25, 0.5, 0.75, 0.975), ...)
+\method{summary}{mcmc}(object, quantiles = c(0.025, 0.25, 0.5, 0.75, 0.975), \dots)
}
\arguments{
\item{object}{an object of class \code{mcmc} or \code{mcmc.list}}
\item{quantiles}{a vector of quantiles to evaluate for each variable}
- \item{...}{a list of further arguments}
+ \item{\dots}{a list of further arguments}
}
\description{
diff --git a/man/thin.Rd b/man/thin.Rd
index e1d33f2..64f10aa 100644
--- a/man/thin.Rd
+++ b/man/thin.Rd
@@ -3,12 +3,12 @@
\title{Thinning interval}
\usage{
-thin(x, ...)
+thin(x, \dots)
}
\arguments{
\item{x}{a regular time series}
- \item{...}{a list of arguments}
+ \item{\dots}{a list of arguments}
}
\description{
diff --git a/man/time.mcmc.Rd b/man/time.mcmc.Rd
index 4339e33..349af5a 100644
--- a/man/time.mcmc.Rd
+++ b/man/time.mcmc.Rd
@@ -11,15 +11,15 @@
\title{Time attributes for mcmc objects}
\usage{
-\method{time}{mcmc}(x, ...)
-\method{start}{mcmc}(x, ...)
-\method{end}{mcmc}(x, ...)
-\method{thin}{mcmc}(x, ...)
+\method{time}{mcmc}(x, \dots)
+\method{start}{mcmc}(x, \dots)
+\method{end}{mcmc}(x, \dots)
+\method{thin}{mcmc}(x, \dots)
}
\arguments{
\item{x}{an \code{mcmc} or \code{mcmc.list} object}
- \item{...}{extra arguments for future methods}
+ \item{\dots}{extra arguments for future methods}
}
\description{
diff --git a/man/traceplot.Rd b/man/traceplot.Rd
index 38a1db7..fa77bc7 100644
--- a/man/traceplot.Rd
+++ b/man/traceplot.Rd
@@ -2,7 +2,7 @@
\alias{traceplot}
\title{Trace plot of MCMC output}
-\usage{traceplot(x, smooth = TRUE, col, type, ylab, ...)}
+\usage{traceplot(x, smooth = TRUE, col, type, ylab, \dots)}
\arguments{
\item{x}{An \code{mcmc} or \code{mcmc.list} object}
@@ -10,7 +10,7 @@
\item{col}{graphical parameter (see \code{par})}
\item{type}{graphical parameter (see \code{par})}
\item{ylab}{graphical parameter (see \code{par})}
- \item{...}{further graphical parameters}
+ \item{\dots}{further graphical parameters}
}
\description{
diff --git a/man/trellisplots.Rd b/man/trellisplots.Rd
index 368be93..992b54e 100644
--- a/man/trellisplots.Rd
+++ b/man/trellisplots.Rd
@@ -86,7 +86,7 @@ acfplot(x, data, \dots)
ylab = "Autocorrelation",
xlab = "Lag",
main = attr(x, "title"),
- ...,
+ \dots,
subset)
\method{acfplot}{mcmc.list}(x, data, outer = FALSE, groups = !outer,
prepanel, panel,
@@ -97,7 +97,7 @@ acfplot(x, data, \dots)
ylab = "Autocorrelation",
xlab = "Lag",
main = attr(x, "title"),
- ...,
+ \dots,
subset)
}
\description{
diff --git a/man/window.mcmc.Rd b/man/window.mcmc.Rd
index a2e589d..77306a2 100644
--- a/man/window.mcmc.Rd
+++ b/man/window.mcmc.Rd
@@ -4,7 +4,7 @@
\title{Time windows for mcmc objects}
\usage{
-\method{window}{mcmc}(x, start, end, thin, ...)
+\method{window}{mcmc}(x, start, end, thin, \dots)
}
\arguments{
@@ -12,7 +12,7 @@
\item{start}{the first iteration of interest}
\item{end}{the last iteration of interest}
\item{thin}{the required interval between successive samples}
- \item{...}{futher arguments for future methods}
+ \item{\dots}{futher arguments for future methods}
}
\description{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/r-cran-coda.git
More information about the debian-science-commits
mailing list