\name{getVariable} \alias{getVariable} \title{ This gets the MCMC values for a variable from the StatShop database. } \usage{ getVariable(model,variable=listVariables(model), subject=listSubjects(model), iterations=numeric(0), chain=getChains()) } \arguments{ \item{model}{Name of model to extract data from.} \item{variable}{Names of a variables whose values will be extracted.} \item{subject}{A vector of uids for subjects whose records will be extracted.} \item{iterations}{A vector containing the first and last cycle to extract. If omitted use all cycles.} \item{chain}{A vector of chains to extract data for. If omitted, use all chains.} } \value{ If the variable argument is a vector of names, it gets a three dimensional structure, where the rows are iteration, the columns are variables, and the third dimension is subjects. As StatShop values are typically ordered factors, the values are typically ordered factors. Note that \code{coda} does not currently handle ordered factor data, there is a limit to what can be done with this function. } \description{ This gets the MCMC values for a variable from the StatShop database. If the variable argument is a vector of names, it gets a three dimensional structure, where the rows are iteration, the columns are variables, and the third dimension is subjects. } \note{ This function is still under development; currently variables are typically not stored in databases for space reasons. } \seealso{ \code{\link{asp.dbConnect}}, \code{\link{listModels}},\code{\link{listVariables}}, \code{\link{listSubjects}}, \code{\link{getParameterVector}}, \code{\link{getAllParameters}}, \code{\link{getVariableMetadata}}, \code{\link{vQuery}} } \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 { \dontrun{ asp.dbConnect("mcmc_statistics_test","junit") ## Get all parameters for the student model. smname <- listStudentModels()[1] ## Get values of all variables for first 100 iterations getVariable(smname, iterations=c(1,100)) asp.dbDisconnect() } } } \keyword{database}