Search code examples
rdirected-acyclic-graphsbayesian-networkscausalitybnlearn

How do I represent domain knowledge information with bnlearn


I am learning about Dynamic Bayesian Network models using the R package bnlearn. To this end, I am following this paper where they impose certain constraints in the form of 6 layers (Table 1 in the paper):

1   Gender, age at ALS onset    
2   Onset site, onset delta (start of the trial - onset)    
3   Riluzole intake, placebo/treatment  
4   Variables at time t-1   
5   Variables at time t, TSO    
6   Survival    

In this example, since gender and age are in the top layer they cannot be influenced by Riluzole intake but influence (or have a causal connection) Riluzole intake and ultimately survival. This guarantees acyclicality in the network, that is, we do not have non-ending feedback loops among the variables.

My question is, how can we model such prior knowledge using the R package bnlearn.


Solution

  • You can add domain knowledge or constraints to structure learning in a couple of ways.

    • If you want to specify the network structure and parameters using domain knowledge, you can build the network manually using custom.fit.

    • If you want to estimate the structure of the BN from data then you can impose constraints on edge direction & edge presence using the whitelist and blacklist parameters in the structure learning algorithms.

    • A prior can be placed on the edges in structure learning (e.g. prior="cs", where "If prior is cs, beta is a data frame with columns from, to and prob specifying the prior probability for a set of arcs. A uniform probability distribution is assumed for the remaining arcs."). There are other priors that can be used.