Description Usage Arguments Author(s) References See Also Examples
Update components of Bayesian network.
1 2 3 4 |
object |
A |
value |
A named list, see examples below. |
Søren Højsgaard, sorenh@math.aau.dk
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/.
grain
, propagate
,
triangulate
, rip
,
junctionTree
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## See the wet grass example at
## https://en.wikipedia.org/wiki/Bayesian_network
yn <- c("yes", "no")
p.R <- cptable(~R, values=c(.2, .8), levels=yn)
p.S_R <- cptable(~S:R, values=c(.01, .99, .4, .6), levels=yn)
p.G_SR <- cptable(~G:S:R, values=c(.99, .01, .8, .2, .9, .1, 0, 1), levels=yn)
x <- compileCPT(p.R, p.S_R, p.G_SR)
x
wet.bn <- grain(x)
getgrain(wet.bn, "cpt")
getgrain(wet.bn, "cpt")$R
getgrain(wet.bn, "cpt")$S
# Now update some cpt's
wet.bn2 <- setCPT(wet.bn, list(R=c(.3, .7), S=c(.1, .9, .7, .3)))
getgrain(wet.bn2, "cpt")$R
getgrain(wet.bn2, "cpt")$S
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.