Description Usage Arguments Details Value References See Also Examples
Performs a JAGS analysis by fitting a
jags_model
or list of jags_model
s
to a data frame using JAGS (Plummer 2012).
The resultant jags_analysis
object can then be
passed to other functions to
to get the convergence
of particular parameters, parameter coefficients
with credible intervals and predict
derived parameter
estimates.
1 2 | jags_analysis(model, data, niters = 10^3, default_model_id = model_id(model,
reference = TRUE)[1], mode = "current")
|
model |
a |
data |
the data.frame or list of data to analyse. |
niters |
an integer element of the number of iterations to run per MCMC chain. |
default_model_id |
a string or number defining the default model id to use in predictions etc |
mode |
a character element indicating the mode for the analysis. |
The jags_analysis
function performs a Bayesian analysis of a data frame
for a jags_model
or list of jags_model
s.
If mode = "current"
(the default) then the analysis options are as currently
globally defined by opts_jagr()
otherwise the mode
argument specifies
the analysis mode for that particular analysis.
The niters
argument specifies the total number of iterations including adaptive
and burn in periods for each chain. The only exceptions are when the analysis is in
debug mode in which case niters
is set to be 100 or if niters
is less
than nsamples * 2 / nchain
(where nsamples is set by the mode) in which case
niters
is set to be nsamples * 2 / nchain
so that nsamples
can be
drawn from the second halves of the chains.
a jags_analysis
object
Plummer M (2012) JAGS Version 3.3.0 User Manual http://sourceforge.net/projects/mcmc-jags/files/Manuals/
jags_model
and jaggernaut
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | model <- jags_model("
model {
bLambda ~ dlnorm(0,10^-2) # $\\bLambda$
for (i in 1:length(x)) {
x[i]~dpois(bLambda)
}
}")
data <- data.frame(x = rpois(100,1))
analysis <- jags_analysis (model, data, mode = "demo")
print(analysis)
analysis <- update(analysis, mode = "demo")
auto_corr(analysis)
cross_corr(analysis)
nchains(analysis)
nsamples(analysis)
convergence(analysis)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.