| querygrain {gRain} | R Documentation |
Query an independence network, i.e. obtain the conditional distribution of a set of variables given finding (evidence) on other variables.
querygrain(object, nodes = nodeNames(object), normalize = TRUE, type =
c("marginal", "joint", "conditional"), return="array", details = 0)
setFinding(object, nodes=NULL, states=NULL, flist=NULL, propagate=TRUE)
retractFinding(object, nodes=NULL, propagate=TRUE)
getFinding(object)
pFinding(object)
object |
A "grain" object |
nodes |
A vector of nodes |
states |
A vector of states (of the nodes given by 'nodes') |
flist |
An alternative way of specifying findings (evidence), see examples below. |
propagate |
Should the network be propagated? |
normalize |
Should the results be normalized to sum to one. |
type |
Should marginals (for each node), the joint for all nodes, or the conditional of the first node given the rest be returned. |
return |
If "data.frame" the result is returned as a data frame (or possibly as a list of dataframes). |
details |
Debugging information |
A list of tables with potentials
Søren Højsgaard, sorenh@agrsci.dk
testfile <- system.file("huginex", "chest_clinic.net", package = "gRain")
chest <- loadHuginNet(testfile, trace=0)
qb <- querygrain(chest)
qb
lapply(qb, as.numeric)
sapply(qb, as.numeric)