mvnorm: Gaussian Bayesian networks and multivariate normals

multivariate normal distributionR Documentation

Gaussian Bayesian networks and multivariate normals

Description

Convert a Gaussian Bayesian network into the multivariate normal distribution that is its global distribution, and vice versa.

Usage

gbn2mvnorm(fitted)
mvnorm2gbn(dag, mu, sigma)

Arguments

fitted

an object of class bn.fit.

dag

an object of class bn, the structure of the network that will be returned.

mu

a numeric vector, the expectation of the multivariate normal.

sigma

a square numeric matrix, the covariance matrix of the multivariate normal.

Value

gbn2mvnorm() returns a list with elements "mu" (the vector of expectations) and "sigma" (the covariance matrix).

mvnorm2gbn() returns an object of class bn.fit.

Author(s)

Marco Scutari

References

Pourahmadi M (2011). "Covariance Estimation: The GLM and Regularization Perspectives". Statistical Science, 26(3), 369–387.

See Also

bn.fit.

Examples

data(gaussian.test)
dag = model2network("[A][B][E][G][C|A:B][D|B][F|A:D:E:G]")
bn = bn.fit(dag, gaussian.test)
mvn = gbn2mvnorm(bn)
bn2 = mvnorm2gbn(dag, mu = mvn$mu, sigma = mvn$sigma)
all.equal(bn, bn2)

bnlearn documentation built on Sept. 11, 2024, 8:27 p.m.