I'm using bnlearn
package in R
, and I would like to know how the package calculates BIC-g (the BIC in Gaussian distribution).
Let's make a structure, and I can find BIC score as follows
library(bnlearn)
X = iris[, 1:3]
names(X) = c("A", "B", "C")
Network = empty.graph(names(X))
bnlearn::score(Network, X, type="bic-g")
bnlearn
provides me with more detailed information about how this score could be calculated,
bnlearn::score(Network, X, type="bic-g", debug=TRUE)
And this results in
----------------------------------------------------------------
* processing node A.
> loglikelihood is -184.041441.
> penalty is 2.505318 x 2 = 5.010635.
----------------------------------------------------------------
* processing node B.
> loglikelihood is -87.777815.
> penalty is 2.505318 x 2 = 5.010635.
----------------------------------------------------------------
* processing node C.
> loglikelihood is -297.588727.
> penalty is 2.505318 x 2 = 5.010635.
[1] -584.4399
I know how to calculate BIC for discrete data in Bayesian networks, referring to here. But I do not know how it could generalize to joint Gaussian (multivariate normal) case.
Definitely it might be related to approximating likelihood and penalty term, and it seems the package processes calculate likelihoods and penalties for each node and then sum them.
bnlearn::score(Network, X, type="loglik-g", debug=TRUE)
But I would like to know how I can specifically calculate likelihoods and penalties, given data.
I found out the material that explains the Laplace Approximation
(refer to page 57), but I could not relate it.
Anyone to help me out?