Description Usage Arguments Details Value Author(s) See Also Examples

This is a wrapper function for `jags.samples`

which sets a trace
monitor for all requested nodes, updates the model, and coerces the
output to a single `mcmc.list`

object.

1 | ```
coda.samples(model, variable.names, n.iter, thin = 1, na.rm=TRUE, ...)
``` |

`model` |
a jags model object |

`variable.names` |
a character vector giving the names of variables to be monitored |

`n.iter` |
number of iterations to monitor |

`thin` |
thinning interval for monitors |

`na.rm` |
logical flag that indicates whether variables containing missing values should be omitted. See details. |

`...` |
optional arguments that are passed to the update method for jags model objects |

If `na.rm=TRUE`

(the default) then elements of a variable that
are missing (`NA`

) for any iteration in at least one chain will
be dropped.

This argument was added to handle incompletely defined variables.
From JAGS version 4.0.0, users may monitor variables that are not
completely defined in the BUGS language description of the model,
e.g. if `y[i]`

is defined in a `for`

loop starting from
`i=3`

then `y[1], y[2]`

are not defined. The user may still
monitor variable `y`

and the monitored values corresponding to
`y[1], y[2]`

will have value `NA`

for all iterations in all
chains. Most of the functions in the coda package cannot handle
missing values so these variables are dropped by default.

An `mcmc.list`

object.

Martyn Plummer

1 2 3 4 |

```
Loading required package: coda
Linked to JAGS 4.3.0
Loaded modules: basemod,bugs
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph information:
Observed stochastic nodes: 5
Unobserved stochastic nodes: 3
Total graph size: 36
Initializing model
Iterations = 1:1000
Thinning interval = 1
Number of chains = 2
Sample size per chain = 1000
1. Empirical mean and standard deviation for each variable,
plus standard error of the mean:
Mean SD Naive SE Time-series SE
alpha 3.006 0.5200 0.011628 0.015156
beta 0.795 0.3679 0.008226 0.007609
sigma 1.007 0.6637 0.014841 0.024651
2. Quantiles for each variable:
2.5% 25% 50% 75% 97.5%
alpha 2.00839 2.7375 2.9982 3.240 4.000
beta 0.06246 0.6072 0.7981 0.985 1.537
sigma 0.42399 0.6339 0.8265 1.162 2.726
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.