exactInference: Exact inference via SupGroupSeparation

View source: R/subGroup-methods.R

exactInferenceR Documentation

Exact inference via SupGroupSeparation

Description

Outputs the the marginal probability

Usage

exactInference(BayesNet, obs)

Arguments

BayesNet

Bayesian network of type bn.fit

obs

observation

Value

marginal probability

Examples

## 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)


cbg-ethz/SubGroupSeparation documentation built on Feb. 11, 2023, 8:29 p.m.