R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("mcgibbsit-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('mcgibbsit') Loading required package: coda > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "mcgibbsit" > > ### * mcgibbsit > > flush(stderr()); flush(stdout()) > > ### Name: mcgibbsit > ### Title: Warnes and Raftery's MCGibbsit MCMC diagnostic > ### Aliases: mcgibbsit print.mcgibbsit > ### Keywords: models > > ### ** Examples > > > # this is a totally useless example, but it does exercise the code > for(i in 1:20){ + x <- matrix(rnorm(1000),ncol=4) + x[,4] <- x[,4] + 1/3 * (x[,1] + x[,2] + x[,3]) + colnames(x) <- c("alpha","beta","gamma", "nu") + write.table(x, file=paste("mcmc",i,"csv",sep="."), sep=",") + } > > data <- read.mcmc(20, "mcmc.#.csv", sep=",") > > mcgibbsit(data) Multi-Chain Gibbsit ------------------- Call = mcgibbsit(data = data) Number of Chains = 20 Per-Chain Length = 250 Total Length = 5000 Quantile (q) = 0.025 Accuracy (r) = +/- 0.0125 Probability (s) = 0.95 Burn-in Estimation Total Lower bound Auto-Corr. Between-Chain (M) (N) (M+N) (Nmin) factor (I) Corr. factor (R) alpha 40 576 616 600 1.02 0.945 beta 40 600 640 600 1.01 0.995 gamma 40 614 654 600 1.02 1.010 nu 40 633 673 600 0.953 1.110 ----- ----- ----- ----- ----- ----- 40 633 673 NOTE: The values for M, N, and Total are combined numbers of iterations based on using 20 chains. > > > > > cleanEx(); ..nameEx <- "read.mcmc" > > ### * read.mcmc > > flush(stderr()); flush(stdout()) > > ### Name: read.mcmc > ### Title: Read in data from a set of MCMC runs > ### Aliases: read.mcmc > ### Keywords: file > > ### ** Examples > > # this is a totally useless example, but it does exercise the code > for(i in 1:20){ + x <- matrix(rnorm(1000),ncol=4) + x[,4] <- x[,4] + 1/3 * (x[,1] + x[,2] + x[,3]) + colnames(x) <- c("alpha","beta","gamma", "nu") + write.table(x, file=paste("mcmc",i,"csv",sep="."), sep=",") + } > > data <- read.mcmc(20, "mcmc.\#.csv", sep=",") > > > > ### *