Marginals {BayesNetBP} R Documentation

## Obtain marginal distributions

### Description

Get the marginal distributions of multiple variables

### Usage

Marginals(tree, vars)


### Arguments

 tree a ClusterTree object vars a vector of variables for query of marginal distributions

### Details

Get the marginal distributions of multiple variables. The function Marginals returns a list of marginal distributions. The marginal distribution of a discrete variable is a named vector of probabilities. Meanwhile, the marginal distributions of continous variables in a CG-BN model are mixtures of Gaussian distributions. To fully represent this information, the marginal of a continuous variable is represented by a data.frame with three columns to specify parameters for each Gaussian distribution in the mixture, which are

mean

the mean value of a Gaussian distribution.

sd

the standard deviation of a Gaussian distribution.

n

the number of Gaussian mixtures

### Value

marginals

a list of marginal distributions

types

a named vector indicating the types of the variables whose marginals are queried: TRUE for discrete, FALSE for continuous.

Han Yu

### References

Cowell, R. G. (2005). Local propagation in conditional Gaussian Bayesian networks. Journal of Machine Learning Research, 6(Sep), 1517-1550.

Yu H, Moharil J, Blair RH (2020). BayesNetBP: An R Package for Probabilistic Reasoning in Bayesian Networks. Journal of Statistical Software, 94(3), 1-31. <doi:10.18637/jss.v094.i03>.

PlotMarginals for visualization of the marginal distributions, SummaryMarginals for summarization of the marginal distributions of continuous variables.

tree.init.p <- Initializer(dag=liver$dag, data=liver$data,
node.class=liver$node.class, propagate = TRUE) tree.post <- AbsorbEvidence(tree.init.p, c("Nr1i3", "chr1_42.65"), list(1,"1")) marg <- Marginals(tree.post, c("HDL", "Ppap2a")) marg$marginals$HDL head(marg$marginals\$Ppap2a)