marginalProb: calculates the marginal probability of a set of nodes

Description Usage Arguments Details Value

View source: R/grainNetworkHelper.R

Description

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.

Usage

1
marginalProb(net, states)

Arguments

net

bayesian network from gRain package

states

named list of states for each node

Details

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.

Value

joint-marginal probability


RVS documentation built on Nov. 8, 2020, 6:57 p.m.