writeJagsModel: Write a Node's JAGS Model

Description Usage Arguments Details Author(s) See Also Examples

View source: R/writeJagsModel.R

Description

Constructs the JAGS code that designates the model for the node conditioned on its parents. The parameters for the model may be user supplied or estimated from a given data set.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
writeJagsModel(network, node)

writeJagsModel_default(network, node_str, node_params)

writeJagsModel_dbern(network, node_str, node_params)

writeJagsModel_dcat(network, node_str, node_params)

writeJagsModel_determ(network, node_str, node_params)

writeJagsModel_dnorm(network, node_str, node_params)

writeJagsModel_dnorm_default(network, node_str, node_params)

writeJagsModel_dpois(network, node_str, node_params)

Arguments

network

A network of class HydeNetwork

node

A node within network

node_str

A character string giving the name of a node within network. This is usually generated within writeJagsModel and passed to a specific method.

node_params

A vector of parameters for the node. Generated by writeJagsModel and passed to a specific method.

Details

The manipulations are performed on the nodeParams element of the Hyde network. A string of JAGS code is returned suitable for inclusion in the Bayesian analysis.

The function will (eventually) travel through a serious of if statements until it finds the right node type. It will then match the appropriate arguments to the inputs based on user supplied values or estimating them from the data.

Author(s)

Jarrod Dalton and Benjamin Nutter

See Also

writeJagsFormula

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
#* NOTE: writeJagsModel isn't an exported function
data(PE, package='HydeNet')
Net <- HydeNetwork(~ wells + 
                     pe | wells + 
                     d.dimer | pregnant*pe + 
                     angio | pe + 
                     treat | d.dimer*angio + 
                     death | pe*treat,
                     data = PE)
HydeNet:::writeJagsModel(Net, 'pe')
HydeNet:::writeJagsModel(Net, 'treat')

## End(Not run)

nutterb/HydeNet documentation built on July 13, 2020, 5:21 p.m.