marginalProb {RVS} | R Documentation |
Given a bayesian network from the gRain package and a named list of (nodes, states), this function returns the joint-marginal probability of each node taking a value in the specified set of states.
marginalProb(net, states)
net |
bayesian network from gRain package |
states |
named list of states for each node |
This function calculates the probability P(A,B,C) by factoring it into conditional probabilities, i.e. P(A|B,C) * P(B|C) * P(C). Starting at the right side, P(C) is computed and then evidence of C being true is added to the network and P(B) is computed - effectively giving the probability P(B|C). This process continues from right to left until the entire product has been computed.
joint-marginal probability