Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

writeJagsFormula

Write the JAGS Formula for a Hyde Node


Description

Based on the information provided about the node, an appropriate JAGS model is written in text. This is combined with the other node models to generate the complete network.

Usage

writeJagsFormula(fit, nodes, ...)

## S3 method for class 'cpt'
writeJagsFormula(fit, nodes, ...)

## S3 method for class 'glm'
writeJagsFormula(fit, nodes, bern = bern, ...)

## S3 method for class 'lm'
writeJagsFormula(fit, nodes, bern, ...)

## S3 method for class 'multinom'
writeJagsFormula(fit, nodes, bern = bern, ...)

## S3 method for class 'survreg'
writeJagsFormula(fit, ..., bern = bern)

## S3 method for class 'xtabs'
writeJagsFormula(fit, ...)

Arguments

fit

a model object

nodes

a vector of node names, usually passed from network$nodes

...

Additional arguments to be passed to other methods

bern

a vector of bernoulli node names

Details

Methods for different model objects can be written so that this function can be extended as desired.

The resulting formulas are based on the coefficient matrix of the fitted model, and the returned result is the JAGS code representing the regression equation of the model.

In the writeJagsFormula.glm method, appropriate transformations exist for the following combinations:

  1. family = binomial; link = logit

  2. family = poisson; link = log

  3. family = gaussian; link = identity (calls writeJagsFormula.lm)

Author(s)

Jarrod Dalton and Benjamin Nutter

See Also

Examples

data(PE, package="HydeNet")
fit <- lm(d.dimer ~ pregnant + pe, data=PE)
writeJagsFormula(fit, nodes=c("d.dimer", "pregnant", "pe"))

fit.glm <- glm(death ~ pe + treat, data=PE, family="binomial")
writeJagsFormula(fit.glm, nodes=c("death", "pe", "treat"))

HydeNet

Hybrid Bayesian Networks Using R and JAGS

v0.10.11
MIT + file LICENSE
Authors
Jarrod E. Dalton <daltonj@ccf.org> and Benjamin Nutter <benjamin.nutter@gmail.com>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.