Learn R Programming

gRain (version 1.0-3)

andtable: Conditional probability tables based on logical dependcies

Description

Generate conditional probability tables based on the logical expressions AND and OR.

Usage

andtable(v, pa1 = c(TRUE, FALSE), pa2 = c(TRUE, FALSE), levels)
ortable(v, pa1 = c(TRUE, FALSE), pa2 = c(TRUE, FALSE), levels)

Arguments

v
Specifications of the names in P(v|pa1,...pak). See section 'details' for information about the form of the argument.
pa1,pa2
The coding of the logical parents
levels
The levels (or rather labels) of v, see 'examples' below

Value

  • A cptable.

Details

Regarding the form of the argument v: To specify $P(a|b,c)$ one may write ~a|b+c or ~a+b+c or c("a","b","c"). Internally, the last form is used. Notice that the + operator is used as a separator only. The order of the variables is important so + does not commute.

References

S�ren H�jsgaard (2012). Graphical Independence Networks with the gRain Package for R. Journal of Statistical Software, 46(10), 1-26. http://www.jstatsoft.org/v46/i10/.

See Also

cptable

Examples

Run this code
ortable(c("v","A","B"), levels=c("yes","no"))

Run the code above in your browser using DataLab