View source: R/subGroup-methods.R
exactInference | R Documentation |
Outputs the the marginal probability
exactInference(BayesNet, obs)
BayesNet |
Bayesian network of type bn.fit |
obs |
observation |
marginal probability
## Not run: # create random BN and label variables set.seed(6) myBayesNet <- randomBN(3) myBayesNet@variables <- c("rain", "sprinkler", "wet grass") plot(myBayesNet) # what's the probability of having rain? # define observed variables and calculate marginal probability myObserved <- list(observed.vars=c("rain"), observed.vals=c(2)) exactInference(myBayesNet,myObserved) # what's the probability of having rain and wet grass at the same time? # define observed variables and calculate marginal probability myObserved <- list(observed.vars=c("rain", "wet grass"), observed.vals=c(2,2)) exactInference(myBayesNet,myObserved) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.