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

factorFormula

Convert Factor Levels in Formula to Numeric Values


Description

When working in R, it is often more convenient to work in terms of the factor labels rather than the underlying numeric values. JAGS, however, requires that the numeric values be used. factorFormula permits the user to define formulae to be passed to JAGS using R style coding, and having factor levels translated to the underlying values as determined by the network structure.

Usage

factorFormula(form, network)

Arguments

form

A formula object.

network

A HydeNetwork object.

Details

It is assumed that factor variables will be used in logical comparisons of the format [variable_name] == '[factor_level]' and only this pattern is recognized in the text search. Single or double quotes may be used around the level, and the spaces around the == are optional.

Author(s)

Jarrod Dalton and Benjamin Nutter

Examples

## Not run: 
Net <- HydeNetwork(~ wells +
                    pe | wells +
                    d.dimer | pregnant*pe +
                    angio | pe +
                    treat | d.dimer*angio +
                    death | pe*treat,
                  data = PE)
factorFormula(form = payoff ~ (death == 'No') + (pe == 'Yes'),
              network = Net)

## End(Not run)

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.