This function calculates the score of a DAG defined by its adjacency matrix. Acceptable data matrices are homogeneous with all variables of the same type: continuous, binary or categorical. The BGe score is evaluated in the case of continuous data and the BDe score is evaluated for binary and categorical variables.
DAGscore(scorepar, incidence)
the log of the BGe or BDe score of the DAG
an object of class scoreparameters
, containing the data and
scoring parameters; see constructor function scoreparameters
a square matrix of dimensions equal to the number of nodes, representing the adjacency matrix of a DAG; the matrix entries are in {0,1}
such that incidence[i,j]
equals 1 if there is a directed edge from node i
to node j
in the DAG and
incidence[i,j]
equals 0 otherwise
Jack Kuipers, Polina Suter, the code partly derived from the order MCMC implementation from Kuipers J, Moffa G (2017) <doi:10.1080/01621459.2015.1133426>
Geiger D and Heckerman D (2002). Parameter priors for directed acyclic graphical models and the characterization of several probability distributions. The Annals of Statistics 30, 1412-1440.
Heckerman D and Geiger D (1995). Learning Bayesian networks: A unification for discrete and Gaussian domains. In Eleventh Conference on Uncertainty in Artificial Intelligence, pages 274-284.
Kuipers J, Moffa G and Heckerman D (2014). Addendum on the scoring of Gaussian directed acyclic graphical models. The Annals of Statistics 42, 1689-1691.
myScore<-scoreparameters("bde", Asia)
DAGscore(myScore, Asiamat)
Run the code above in your browser using DataLab