Learn R Programming

gRain (version 1.3-2)

set-slot: Update components of Bayesian network

Description

Update components of Bayesian network.

Usage

set_rip(object, value)

set_ug(object, value)

set_cpt(object, list, value)

Arguments

object

A grain object

value

A named list

list

Entries to be replaced.

References

S<U+00F8>ren H<U+00F8>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

grain, propagate, triangulate, rip, junctionTree

Examples

Run this code
# NOT RUN {
yn = c("yes", "no")
universe = list(flu=yn, temp=yn, headache=yn)
p.f   = tab(~flu, levels=universe, values=c(.1, .9))
p.t_f = tab(~temp|flu, levels=universe, values=c(.9, .1, .01, .99))
p.h_t = tab(~headache|temp, levels=universe, values=c(.8, .1, .1, .9))

pl = compileCPT(list(p.f, p.t_f, p.h_t))
pl
bn = compile(grain(pl))
bn = propagate(bn)
bn
cp = cpt(bn)
cp1 = cp[[1]]
cp1
# }

Run the code above in your browser using DataLab