### Load and Display Example Model File Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Loads and displays the content of an example BUGS model file provided by the R2jags package. ```R # An example model file is given in: model.file <- system.file(package="R2jags", "model", "schools.txt") # Let's take a look: file.show(model.file) ``` -------------------------------- ### Run ‘JAGS’ from R Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html The jags function takes data and starting values as input. It automatically writes a jags script, calls the model, and saves the simulations for easy access in R. ```APIDOC ## Run ‘JAGS’ from R ### Description The `jags` function takes data and starting values as input. It automatically writes a `jags` script, calls the model, and saves the simulations for easy access in R. ``` -------------------------------- ### Define JAGS Data and Parameters Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Sets up the data, parameters, and initialization function required for a JAGS model. ```R # data J <- 8.0 y <- c(28.4,7.9,-2.8,6.8,-0.6,0.6,18.0,12.2) sd <- c(14.9,10.2,16.3,11.0,9.4,11.4,10.4,17.6) jags.data <- list("y","sd","J") jags.params <- c("mu","sigma","theta") jags.inits <- function(){ list("mu"=rnorm(1),"sigma"=runif(1),"theta"=rnorm(J)) } ``` -------------------------------- ### Run JAGS Model and Generate CODA Files Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html This code demonstrates how to run a JAGS model and generate output files in CODA format. Ensure 'jags.path' is correctly set and you have write access to the working directory. ```R jagsfit <- jags2(data=jags.data, inits=jags.inits, jags.params, n.iter=5000, model.file=model.file) print(jagsfit) plot(jagsfit) # or to use some plots in coda # use as.mcmmc to convert rjags object into mcmc.list jagsfit.mcmc <- as.mcmc.list(jagsfit) traceplot(jagsfit.mcmc) #require(lattice) #xyplot(jagsfit.mcmc) #densityplot(jagsfit.mcmc) ``` -------------------------------- ### Recompile and Update JAGS Model (Sequential) Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Demonstrates recompiling a JAGS model and then updating it with additional iterations. This is useful for continuing a previous run. ```R # to pick up the last save session # for example, load("RWorkspace.Rdata") recompile(jagsfit) jagsfit.upd <- update(jagsfit, n.iter=100) ``` -------------------------------- ### Run JAGS with Default Settings Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Runs a JAGS model with specified data, initial values, parameters, and number of iterations using an external model file. ```R jagsfit <- jags(data=jags.data, inits=jags.inits, jags.params, n.iter=5000, model.file=model.file) ``` -------------------------------- ### Generate Traceplots Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Creates traceplots for MCMC samples to assess convergence of the JAGS model. ```R # traceplot traceplot(jagsfit.p) traceplot(jagsfit) ``` -------------------------------- ### jags2() Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Legacy interface for executing JAGS models. ```APIDOC ## jags2() ### Description Legacy function for running JAGS models with specific path configurations. ### Parameters #### Request Body - **jags.path** (character) - Optional - Path to the JAGS executable. - **clearWD** (boolean) - Optional - Whether to clear the working directory after execution. ``` -------------------------------- ### Run JAGS with Data from a File Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Executes a JAGS model using data loaded from a file. The data is first dumped to a text file and then passed to the jags function. ```R ## 4) data as a file fn <- "tmpbugsdata.txt" dump(c("y","sd","J"), file=fn) jagsfit <- jags(data=fn, inits=jags.inits, jags.params, n.iter=10, model.file=model.file) unlink("tmpbugsdata.txt") ``` -------------------------------- ### jags() Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Executes a JAGS model using the standard interface. ```APIDOC ## jags() ### Description Runs a JAGS model with specified data, initial values, and parameters to monitor. ### Parameters #### Request Body - **data** (list/character) - Required - Data for the model. - **inits** (list/function) - Optional - Initial values for the parameters. - **parameters.to.save** (character vector) - Required - Parameters to monitor. - **model.file** (character) - Optional - Path to the model file (default: "model.bug"). - **n.chains** (numeric) - Optional - Number of chains (default: 3). - **n.iter** (numeric) - Optional - Number of iterations (default: 2000). - **n.burnin** (numeric) - Optional - Number of burn-in iterations. - **n.thin** (numeric) - Optional - Thinning interval. - **DIC** (boolean) - Optional - Whether to calculate DIC (default: TRUE). ``` -------------------------------- ### Run JAGS model with specified path Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Use `jags2` when you need to specify the exact path to the JAGS executable. This function also offers control over the working directory and whether to clear it after execution. ```R jags2(data, inits, parameters.to.save, model.file="model.bug", n.chains=3, n.iter=2000, n.burnin=floor(n.iter/2), n.thin=max(1, floor((n.iter - n.burnin) / 1000)), DIC=TRUE, jags.path="", working.directory=NULL, clearWD=TRUE, refresh = n.iter/50) ``` -------------------------------- ### Run JAGS model with default settings Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Use the `jags` function for standard JAGS model execution. It allows customization of chains, iterations, burn-in, and thinning. Ensure the model file and data are correctly specified. ```R jags(data, inits, parameters.to.save, model.file="model.bug", n.chains=3, n.iter=2000, n.burnin=floor(n.iter/2), n.thin=max(1, floor((n.iter - n.burnin) / 1000)), DIC=TRUE, pD = FALSE, n.iter.pd = NULL, n.adapt = 100, working.directory=NULL, jags.seed = 123, refresh = n.iter/50, progress.bar = "text", digits=5, RNGname = c("Wichmann-Hill", "Marsaglia-Multicarry", "Super-Duper", "Mersenne-Twister"), jags.module = c("glm","dic"), quiet = FALSE, checkMissing = FALSE ) ``` -------------------------------- ### Run JAGS with Data as Named List Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Executes a JAGS model using data provided as a named list, where names correspond to variable names in the model. ```R ## 3) data as named list jagsfit <- jags(data=list(y=y,sd=sd,J=J), inits=jags.inits, jags.params, n.iter=10, model.file=model.file) ``` -------------------------------- ### Access Simulation Results Directly Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html After attaching a JAGS object, simulation results like 'mu' can be accessed directly as variables. ```R # this will show a 3-way array of the bugs.sim object, for example: mu ``` -------------------------------- ### Read JAGS Output in CODA Format Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Reads Markov Chain Monte Carlo output in CODA format produced by JAGS. Returns an object of class `mcmc.list` for analysis with the `coda` package. Specify the path to CODA files and parameters to save. ```R jags2bugs(path=getwd(), parameters.to.save, n.chains=3, n.iter=2000, n.burnin=1000, n.thin=2, DIC=TRUE) ``` -------------------------------- ### traceplot Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Displays a plot of iterations vs. sampled values for each variable in the chain. ```APIDOC ## traceplot ### Description Displays a plot of iterations vs. sampled values for each variable in the chain, with a separate plot per variable. ### Parameters - **x** (bugs object) - Required - The bugs object to plot. - **mfrow** (vector) - Optional - Graphical parameter for layout. - **varname** (vector) - Optional - Variable names to plot. - **match.head** (boolean) - Optional - Matches variable names by beginning. Default: TRUE. - **ask** (boolean) - Optional - If TRUE, user is prompted before each plot. Default: TRUE. - **col** (vector) - Optional - Graphical color parameter. - **lty** (integer) - Optional - Graphical line type parameter. - **lwd** (integer) - Optional - Graphical line width parameter. ``` -------------------------------- ### Recompile and Update Parallel JAGS Model Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Shows the process of recompiling a parallel JAGS run and then updating it with more iterations. This ensures the update process is compatible with the parallel execution. ```R recompile(jagsfit.p) jagsfit.upd <- update(jagsfit, n.iter=100) ``` -------------------------------- ### Trace Plot for bugs Object Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Displays a trace plot of iterations versus sampled values for each variable in a MCMC chain. Useful for visualizing convergence. Plots are generated per variable and chain. ```R traceplot(x, mfrow = c(1, 1), varname = NULL, match.head = TRUE, ask = TRUE, col = rainbow( x$n.chains ), lty = 1, lwd = 1, ...) ``` -------------------------------- ### jags.parallel() Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Executes a JAGS model in parallel across multiple CPU cores. ```APIDOC ## jags.parallel() ### Description Runs a JAGS model using parallel processing to speed up computation across multiple chains. ### Parameters #### Request Body - **data** (list/character) - Required - Data for the model. - **n.chains** (numeric) - Optional - Number of chains (default: 2). - **n.cluster** (numeric) - Optional - Number of clusters to use. - **export_obj_names** (character vector) - Optional - Objects to export to the parallel workers. ``` -------------------------------- ### recompile Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Re-compiles a previously saved rjags object. ```APIDOC ## recompile ### Description Takes a `rjags` object as input and re-compiles it. ### Parameters - **object** (rjags object) - Required - The rjags object to recompile. - **n.iter** (integer) - Optional - Number of iterations for adapting. Default: 100. - **refresh** (integer) - Optional - Refresh frequency for progress bar. Default: n.iter/50. - **progress.bar** (string) - Optional - Type of progress bar ('text', 'gui', or 'none'). Default: 'text'. ``` -------------------------------- ### Run JAGS with Data as List of Characters Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Executes a JAGS model using data specified as a list of character strings representing variable names. ```R ## 1) data as list of character jagsfit <- jags(data=list("y","sd","J"), inits=jags.inits, jags.params, n.iter=10, model.file=model.file) ``` -------------------------------- ### Function: jags() Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Executes a BUGS model using JAGS, allowing for data input, parameter monitoring, and MCMC configuration. ```APIDOC ## jags() ### Description Runs a BUGS model in JAGS from R. It handles data preparation, model execution, and monitoring of specified parameters. ### Parameters - **data** (vector/list/string) - Required - Data objects used by the model or path to a dump format file. - **inits** (list/function) - Optional - Starting values for the BUGS model or a function to generate them. - **parameters.to.save** (character vector) - Required - Names of parameters to monitor. - **model.file** (string/function) - Required - File containing the BUGS model or an R function representing the model. - **n.chains** (integer) - Optional - Number of Markov chains (default: 3). - **n.iter** (integer) - Optional - Total iterations per chain (default: 2000). - **n.burnin** (integer) - Optional - Iterations to discard at the start. - **n.cluster** (integer) - Optional - Number of clusters for parallel chains. - **n.thin** (integer) - Optional - Thinning rate. - **DIC** (logical) - Optional - Whether to compute deviance, pD, and DIC (default: TRUE). - **pD** (logical) - Optional - Whether to compute pD (default: FALSE). - **n.iter.pd** (integer) - Optional - Iterations for pD computation (default: 1000). - **n.adapt** (integer) - Optional - Iterations for adaptation (default: 100). - **working.directory** (string) - Optional - Directory for the model file. - **jags.seed** (integer) - Optional - Random seed for JAGS (default: 123). - **jags.path** (string) - Optional - Directory containing the JAGS executable. - **clearWD** (logical) - Optional - Whether to remove temporary files after completion (default: TRUE). - **refresh** (integer) - Optional - Progress bar refresh frequency. - **progress.bar** (string) - Optional - Type of progress bar ('text', 'gui', 'none'). - **digits** (integer) - Optional - Significant digits for BUGS input. - **RNGname** (string) - Optional - Name of the random number generator. - **jags.module** (vector) - Optional - JAGS modules to load (default: 'glm', 'dic'). - **export_obj_names** (character vector) - Optional - Objects to export to clusters. - **envir** (environment) - Optional - Environment for evaluation (default: .GlobalEnv). - **quiet** (logical) - Optional - Whether to suppress stdout. - **checkMissing** (logical) - Optional - Whether to check for missing data (default: FALSE). ``` -------------------------------- ### Attach/detach elements of ‘JAGS’ objects to search path Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html These are wrapper functions for attach.bugs and detach.bugs, which attach or detach three-way-simulation array of bugs object to the search path. See attach.all for details. ```APIDOC ## Attach/detach elements of ‘JAGS’ objects to search path ### Description These are wraper functions for `attach.bugs` and `detach.bugs`, which attach or detach three-way-simulation array of bugs object to the search path. See `attach.all` for details. ### Usage ```R attach.jags(x, overwrite = NA) detach.jags() ``` ### Arguments `x` | An `rjags` object. `overwrite` | If `TRUE`, objects with identical names in the Workspace (.GlobalEnv) that are masking objects in the database to be attached will be deleted. If `NA` (the default) and an interactive session is running, a dialog box asks the user whether masking objects should be deleted. In non-interactive mode, behaviour is identical to `overwrite=FALSE`, i.e. nothing will be deleted. ### Details See `attach.bugs` for details ### Author(s) Yu-Sung Su suyusung@tsinghua.edu.cn, ### References Sibylle Sturtz and Uwe Ligges and Andrew Gelman. (2005). “R2WinBUGS: A Package for Running WinBUGS from R.” _Journal of Statistical Software_ 3 (12): 1–6. ### Examples ```R # See the example in ?jags for the usage. ``` ``` -------------------------------- ### Run JAGS in Parallel Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Executes a JAGS model in parallel. Note that the progress bar is not shown, and the R session may appear frozen during execution. ```R # Run jags parallely, no progress bar. R may be frozen for a while, # Be patient. Currenlty update afterward does not run parallelly # jagsfit.p <- jags.parallel(data=jags.data, inits=jags.inits, jags.params, n.iter=5000, model.file=model.file) ``` -------------------------------- ### Run JAGS and Compute DIC with pD Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Executes a JAGS model and computes the Deviance Information Criterion (DIC) using the pD approximation, which is closer to Spiegelhalter et al. (2002). ```R # Can also compute the DIC using pD (=Dbar-Dhat), via dic.samples(), which # is a closer approximation to the original formulation of Spiegelhalter et # al (2002), instead of pV (=var(deviance)/2), which is the default in JAGS jagsfit.pD <- jags(data=jags.data, inits=jags.inits, jags.params, n.iter=5000, model.file=model.file, pD=TRUE) ``` -------------------------------- ### Attach JAGS Objects to Search Path Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Wraps attach.bugs and detach.bugs to attach or detach three-way-simulation arrays of bugs objects to the search path. Use when managing JAGS objects in R. ```R attach.jags(x, overwrite = NA) detach.jags() ``` -------------------------------- ### jags2bugs Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Reads Markov Chain Monte Carlo output in the CODA format produced by JAGS and returns an object of class mcmc.list. ```APIDOC ## jags2bugs ### Description Reads Markov Chain Monte Carlo output in the CODA format produced by jags and returns an object of class `mcmc.list` for further output analysis. ### Parameters - **path** (string) - Optional - Working directory where CODA files are located. Default: getwd(). - **parameters.to.save** (character vector) - Required - Names of parameters to monitor. - **n.chains** (integer) - Optional - Number of Markov chains. Default: 3. - **n.iter** (integer) - Optional - Total iterations per chain. Default: 2000. - **n.burnin** (integer) - Optional - Number of iterations to discard. Default: n.iter/2. - **n.thin** (integer) - Optional - Thinning rate. Default: 2. - **DIC** (boolean) - Optional - If TRUE, compute deviance, pD, and DIC. Default: TRUE. ``` -------------------------------- ### Display and Plot JAGS Output Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Prints the summary of the JAGS model results and generates plots to visualize the output. ```R # display the output print(jagsfit) plot(jagsfit) ``` -------------------------------- ### Run JAGS with Model Defined as R Function Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Executes a JAGS model where the model definition is provided as an R function. ```R jagsfit <- jags(data=jags.data, inits=jags.inits, jags.params, n.iter=10, model.file=schoolsmodel) ``` -------------------------------- ### Run JAGS from R Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html A function to run JAGS models directly from R. It handles script writing, model execution, and simulation saving. ```R jags(data, inits, parameters.to.monitor, model.file, n.chains, n.iter, thin, start.values, jags.parameters, working.directory, digits.d = .R.digits, jags.module, DIC, verbose, R2WinBUGS=TRUE, clearWD, save.model=FALSE, ...) ``` -------------------------------- ### Convert JAGS Object to MCMC List for Coda Plots Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Converts a JAGS object into an 'mcmc.list' object, enabling the use of plotting functions from the 'coda' package. ```R # or to use some plots in coda # use as.mcmmc to convert rjags object into mcmc.list jagsfit.mcmc <- as.mcmc(jagsfit.p) jagsfit.mcmc <- as.mcmc(jagsfit) ## now we can use the plotting methods from coda #require(lattice) #xyplot(jagsfit.mcmc) #densityplot(jagsfit.mcmc) ``` -------------------------------- ### Attach JAGS Object to Search Path Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Attaches a JAGS object to the R search path, making its simulation results directly accessible by variable name. See 'attach.bugs' for details. ```R # attach jags object into search path see "attach.bugs" for details attach.jags(jagsfit.upd) ``` -------------------------------- ### Calculate DIC Samples Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Calculates DIC samples for a JAGS model using the 'pD' type, which represents the effective number of parameters. ```R # to get DIC or specify DIC=TRUE in jags() or do the following# dic.samples(jagsfit.upd$model, n.iter=1000, type="pD") ``` -------------------------------- ### Auto-Update JAGS Model Until Convergence Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Automatically updates a JAGS model iteratively until convergence is achieved. Refer to '?autojags' for detailed options. ```R # or auto update it until it converges! see ?autojags for details # recompile(jagsfit.p) jagsfit.upd <- autojags(jagsfit.p) jagsfit.upd <- autojags(jagsfit) ``` -------------------------------- ### Run JAGS model in parallel Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html The `jags.parallel` function enables parallel execution of JAGS models across multiple chains. It requires specifying the number of clusters and allows for environment variable export. ```R jags.parallel(data, inits, parameters.to.save, model.file = "model.bug", n.chains = 2, n.iter = 2000, n.burnin = floor(n.iter/2), n.thin = max(1, floor((n.iter - n.burnin)/1000)), n.cluster= n.chains, DIC = TRUE, working.directory = NULL, jags.seed = 123, digits=5, RNGname = c("Wichmann-Hill", "Marsaglia-Multicarry", "Super-Duper", "Mersenne-Twister"), jags.module = c("glm","dic"), export_obj_names=NULL, envir = .GlobalEnv ) ``` -------------------------------- ### Run JAGS with Data as Character Vector Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Executes a JAGS model using data specified as a character vector of variable names. ```R ## 2) data as character vector of names jagsfit <- jags(data=c("y","sd","J"), inits=jags.inits, jags.params, n.iter=10, model.file=model.file) ``` -------------------------------- ### Update JAGS Model Iterations Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Updates a previously run JAGS model by adding more iterations to potentially improve convergence. The results are printed and plotted. ```R # if the model does not converge, update it! jagsfit.upd <- update(jagsfit, n.iter=100) print(jagsfit.upd) print(jagsfit.upd, intervals=c(0.025, 0.5, 0.975)) plot(jagsfit.upd) ``` -------------------------------- ### Function for auto-updating ‘JAGS’ until the model converges Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html The autojags function takes a rjags object as input. autojags will update the model until it converges. ```APIDOC ## Function for auto-updating ‘JAGS’ until the model converges ### Description The `autojags` takes a `rjags` object as input. `autojags` will update the model until it converges. ### Usage ```R ## S3 method for class 'rjags' update(object, n.iter=1000, n.thin=1, refresh=n.iter/50, progress.bar = "text", ...) autojags(object, n.iter=1000, n.thin=1, Rhat=1.1, n.update=2, refresh=n.iter/50, progress.bar = "text", ...) ``` ### Arguments `object` | an object of `rjags` class. `n.iter` | number of total iterations per chain, default=1000 `n.thin` | thinning rate. Must be a positive integer, default=1 `...` | further arguments pass to or from other methods. `Rhat` | converegence criterion, default=1.1. `n.update` | the max number of updates, default=2. `refresh` | refresh frequency for progress bar, default is `n.iter/50` `progress.bar` | type of progress bar. Possible values are “text”, “gui”, and “none”. Type “text” is displayed on the R console. Type “gui” is a graphical progress bar in a new window. The progress bar is suppressed if `progress.bar` is “none” ### Author(s) Yu-Sung Su suyusung@tsinghua.edu.cn ### References Gelman, A., Carlin, J.B., Stern, H.S., Rubin, D.B. (2003): _Bayesian Data Analysis_ , 2nd edition, CRC Press. ### Examples ```R # see ?jags for an example. ``` ``` -------------------------------- ### Recompile rjags Object Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Recompiles a previously saved `rjags` object. Useful for updating model iterations or progress bar settings. Default iterations for adaptation is 100. ```R recompile(object, n.iter=100, refresh=n.iter/50, progress.bar = "text") ``` -------------------------------- ### Auto-Update JAGS Model Until Convergence Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Automatically updates an rjags object until the model converges, based on the Rhat statistic. Useful for ensuring model stability before analysis. ```R update(object, n.iter=1000, n.thin=1, refresh=n.iter/50, progress.bar = "text", ...) autojags(object, n.iter=1000, n.thin=1, Rhat=1.1, n.update=2, refresh=n.iter/50, progress.bar = "text", ...) ``` -------------------------------- ### Update Parallel JAGS Object Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Updates a parallel JAGS object after recompiling it. This is necessary for continuing MCMC sampling on a parallel run. ```R # before update parallel jags object, do recompile it recompile(jagsfit.p) jagsfit.upd <- update(jagsfit.p, n.iter=100) ``` -------------------------------- ### Define BUGS Model as an R Function Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Defines a BUGS model directly within R as a function, which can then be passed to the jags function. ```R schoolsmodel <- function() { for (j in 1:J){ y[j] ~ dnorm (theta[j], tau.y[j]) tau.y[j] <- pow(sd[j], -2) } for (j in 1:J){ theta[j] ~ dnorm (mu, tau) } tau <- pow(sigma, -2) mu ~ dnorm (0.0, 1.0E-6) sigma ~ dunif (0, 1000) } ``` -------------------------------- ### Detach JAGS Object from Search Path Source: https://cran.r-project.org/web/packages/R2jags/refman/R2jags.html Removes a JAGS object from the R search path, reverting direct access to simulation results. See 'detach.bugs' for details. ```R # detach jags object into search path see "attach.bugs" for details detach.jags() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.