Compile Jags Model from a Hyde Network
Generates the JAGS code from the Hyde network and uses it to create an object representing a Bayesian graphical model.
compileJagsModel(network, data = NULL, ...)
network |
An object of class |
data |
A list of data values to be observed in the nodes. It is
passed to the |
... |
Additional arguments to be passed to |
compileJagsModel
is a partial wrapper for
jags.model
. Running compileJagsModel(network)
is
equivalent to running jags.model(textConnection(writeNetworkModel(network)))
.
Returns a compiledHydeNetwork
object. The jags
element
of this object is suitable to pass to coda.samples
. Otherwise,
the primary function of the object is plotting the network with
observed data shown.
Benjamin Nutter
jags.model
data(PE, package="HydeNet") Net <- HydeNetwork(~ wells + pe | wells + d.dimer | pregnant*pe + angio | pe + treat | d.dimer*angio + death | pe*treat, data = PE) compiledNet <- compileJagsModel(Net, n.chains=5) #* Generate the posterior distribution Posterior <- HydeSim(compiledNet, variable.names = c("d.dimer", "death"), n.iter = 1000) Posterior #* For a single model (ie, not a decision model), the user may choose to #* use the \code{rjags} function \code{coda.samples}. #* However, this does not have a succinct print method library(rjags) s <- coda.samples(compiledNet$jags, variable.names = c("d.dimer", "death"), n.iter=1000)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.