Learn R Programming

gRain (version 1.3-2)

cpt-update: Update components of Bayesian network

Description

Update components of Bayesian network.

Usage

setcpt(object) <- value

# S3 method for grain setcpt(object) <- value

setCPT(object, value)

# S3 method for grain setCPT(object, value)

Arguments

object

A grain object

value

A named list

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")
a    <- cptable(~asia,        values=c(1,99), levels=yn)
t.a  <- cptable(~tub + asia,  values=c(5,95,1,99), levels=yn)

plist <- compileCPT(list(a, t.a )) 
bn    <- grain(plist)
bnc   <- compile(bn, propagate=FALSE)
bncp  <- compile(bn, propagate=TRUE)

## New p(tub | asia)
z <- c(20, 80, 1, 99) 

bn2   <- setCPT(bn, list(tub=z))
bnc2   <- setCPT(bnc, list(tub=z))
bncp2   <- setCPT(bncp, list(tub=z))

# }

Run the code above in your browser using DataLab