factorFormula: Convert Factor Levels in Formula to Numeric Values

Description Usage Arguments Details Author(s) Examples

View source: R/factorFormula.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 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 documentation built on July 8, 2020, 5:15 p.m.