\name{dsApplyPrint} \alias{dsApplyPrint} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Applies a function recursively to the models in a database and prints the result. } \description{ Applies a function recursively to each parameter sets in each model in the current database. The result of each function is printed along with context information giving the name of the model and the variable currently being worked on. } \usage{ dsApplyPrint(FUN, ..., chains, window, studentModelList = listStudentModels(), linkModelList = listLinkModels(), trimRegExp = NULL, maxparams = 99) } \arguments{ \item{FUN}{A function which is assumed to be a graphics function, e.g., \code{plot}.} \item{\dots}{Additional arguments to the graphics function.} \item{chains}{A vector of chains to extract data for. By default it uses all chains which have positive length.} \item{window}{A vector containing the first and last cycle to use. Last cycle defaults to length of smallest chain in database. Burn-in defaults to 1001 for long series, 501 for short series and 1 for very short series.} \item{studentModelList}{List of names of student models to use.} \item{linkModelList}{List of names of link models to use..} \item{trimRegExp}{A regular expression for names of link or student models which will be trimmed from the list of models to be read.} \item{maxparams}{A interger given the maximum number of parameter to be read in a parameter set. This saves reading really big parameter into memory and may avoid memory problems on some PCs.} } \details{ Applies a function recursively to each parameter set for each model in the current database. The result of each function is printed along with context information giving the name of the model and the variable currently being worked on. Note that the main objects passed to \code{FUN} are \code{mcmc.list} objects, so generic functions should have an appropriate method for \code{mcmc.list}. The database used is the one referenced by the latest call to \code{asp.dbConnect}. The arguments \code{studentModelList} and \code{linkModelsList} can be used to restrict calculations to a subset of models. These arguments should be a list of model names. } \author{Russell Almond} \note{ This function is like doing \code{daCapo} and \code{daCapoApplyPrint} in one function call. However, rather than create a large daCapo object in memory, it reads the data for one model at a time and then discards it. Thus, it takes longer, but uses less memory. } \section{Side Effects}{ Prints results to standard output (console or wherever they are currenty being set by \code{sink()}). Note: Wraps calls to \code{FUN} in try, so that errors in one model will be printed to console and the function will move on to the next model. } \seealso{ \code{\link[coda]{mcmc.list}},\code{\link{daCapo}}, \code{\link{daCapoApplyPrint}},\code{\link{grandSummary}} \code{\link{dsApplyPlot}},\code{\link{asp.dbConnect}} } \examples{ ### This example will only run if you have the StatShop test databases ### installed on your machine. StatShop <- Sys.getenv("STATSHOP") if (StatShop == "") { warn("StatShop not installed, skipping test.") } else { asp.dbConnect("mcmc_statistics_test","junit") ## Print it all! dsApplyPrint(grandSummary,window=c(1,1000)) ## Only use first two link models dsApplyPrint(effectiveSize,whichLinkModels=1:2) ## Look at initial values (assumes burn-in is 1) dsApplyPrint(function(param) param[1:2,],window=c(1,2)) } } \keyword{database}