Skip to contents

Contribution of each vertex of a Bayesian network to the global monitor

Usage

node_monitor(dag, df, alpha = "default")

Arguments

dag

an object of class bn from the bnlearn package

df

a base R style dataframe

alpha

single integer. By default, number of max levels in df

Value

A dataframe including the name of the vertices and the contribution of the vertices to the global monitor. It also returns a plot where vertices with higher contributions in absolute value are darker.

Details

Consider a Bayesian network over variables \(Y_1,\dots,Y_m\) and suppose a dataset \((\boldsymbol{y}_1,\dots,\boldsymbol{y}_n)\) has been observed, where \(\boldsymbol{y}_i=(y_{i1},\dots,y_{im})\) and \(y_{ij}\) is the i-th observation of the j-th variable. The global monitor is defined as the negative log-likelihood of the model, i.e. $$-\log(p(\boldsymbol{y}_1,\dots,\boldsymbol{y}_n))= - \sum_{j=1}^m\sum_{i=1}^n \log(p(y_{ij} | \pi_{ij})),$$ where \(\pi_{ij}\) is the value of the parents of \(Y_j\) for the i-th observation. The contribution of the j-th vertex to the global monitor is thus $$-\sum_{i=1}^n\log(p(y_{ij}|\pi_{ij})).$$

References

Cowell, R. G., Dawid, P., Lauritzen, S. L., & Spiegelhalter, D. J. (2006). Probabilistic networks and expert systems: Exact computational methods for Bayesian networks. Springer Science & Business Media.

Cowell, R. G., Verrall, R. J., & Yoon, Y. K. (2007). Modeling operational risk with Bayesian networks. Journal of Risk and Insurance, 74(4), 795-827.

Examples

node_monitor(chds_bn, chds, 3)
#>      Vertex    Score
#> 1    Social 343.7419
#> 2  Economic 291.3181
#> 3    Events 537.1686
#> 4 Admission 237.7562