Learn R Programming

⚠️There's a newer version (0.2.2) of this package.Take me there.

bnmonitor

bnmonitor is a package for sensitivity analysis and robustness in Bayesian networks (BNs). If you use the package in your work please consider citing it as

citation("bnmonitor")
#> To cite package 'bnmonitor' in publications use:
#> 
#>   Leonelli M, Ramanathan R, Wilkerson RL (2023). "Sensitivity and
#>   robustness analysis in Bayesian networks with the bnmonitor R
#>   package." _Knowledge-Based Systems_, *278*, 110882.
#>   doi:10.1016/j.knosys.2023.110882
#>   <https://doi.org/10.1016/j.knosys.2023.110882>.
#> 
#> A BibTeX entry for LaTeX users is
#> 
#>   @Article{,
#>     title = {Sensitivity and robustness analysis in {Bayesian} networks with the bnmonitor R package},
#>     author = {Manuele Leonelli and Ramsiya Ramanathan and Rachel L. Wilkerson},
#>     journal = {Knowledge-Based Systems},
#>     year = {2023},
#>     volume = {278},
#>     pages = {110882},
#>     doi = {10.1016/j.knosys.2023.110882},
#>   }

Installation

The package bnmonitor can be installed from CRAN using the command

install.packages("bnmonitor")

and loaded in R with

library(bnmonitor)
#> Warning: package 'bnmonitor' was built under R version 4.3.3

Note that bnmonitor requires the package gRain which, while on CRAN, depends on packages that are on Bioconductor both directly and through the gRbase package, which depends on RBGL:

install.packages("BiocManager")
BiocManager::install(c("graph", "Rgraphviz", "RBGL"))
install.packages("gRain")

Overview

bnmonitor provides a suite of function to investigate either a data-learnt or an expert elicited BN. Its functions can be classified into the following main areas:

  • Parametric sensitivity analysis: Investigate the effect of changes in some of the parameter values in a Bayesian network and quantify the difference between the original and perturbed Bayesian networks using dissimilarity measures (both for discrete and Gaussian BNs).

  • Robustness to data: Verify how well a Bayesian network fits a specific dataset that was used either for learning or for testing (only for discrete BNs).

  • Node influence: Quantify how much the nodes of a Bayesian network influence an output node of interest (only for discrete BNs).

  • Edge strength: Assess the strength of the edges of a Bayesian network (only for discrete BNs).

  • Other investigations: Including the diameter of the conditional probability tables, measures of asymmetric independence, and level amalgamation.

Refer to the articles section for case studies showcasing the use of the bnmonitor functions.

Papers where bnmonitor is used

  • Görgen, C., & Leonelli, M. (2020). Model-preserving sensitivity analysis for families of Gaussian distributions. Journal of Machine Learning Research, 21(84), 1-32.

  • Leonelli, M., & Riccomagno, E. (2022). A geometric characterization of sensitivity analysis in monomial models. International Journal of Approximate Reasoning, 151, 64-84.

  • Leonelli, M., Ramanathan, R., & Wilkerson, R. L. (2023). Sensitivity and robustness analysis in Bayesian networks with the bnmonitor R package. Knowledge-Based Systems, 278, 110882.

  • Leonelli, M., Smith, J. Q., & Wright, S. K. (2024). The diameter of a stochastic matrix: A new measure for sensitivity analysis in Bayesian networks. arXiv preprint arXiv:2407.04667.

Copy Link

Version

Install

install.packages('bnmonitor')

Monthly Downloads

429

Version

0.2.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Manuele Leonelli

Last Published

September 20th, 2024

Functions in bnmonitor (0.2.1)

KL.bn.fit

KL Divergence for bn.fit
covariation_matrix

Co-variation matrices
cachexia

Bayesian networks for a cachexia study
diabetes

Pima Indian Diabetes Data
chds

Christchurch Health and Development Study
covariation

Co-variation schemes
Fro.CI

Frobenius norm for CI
CD

CD-distance
covariance_var

Standard variation of the covariance matrix
bn2

Integration with bn.fit objects from bnlearn
plot

Plotting methods
fire_alarm

Bayesian network on fire alarm system
diameter

Diameters in a Bayesian network
ewi

Edge-weigthed influence
bnmonitor

bnmonitor: A package for sensitivity analysis and robustness in Bayesian networks
global_monitor

Global monitor
KL

KL Divergence
dwi

Distance-weigthed influence
amalgamation

Amalgamation of levels
influential_obs

Influential observations
print

Printing methods
asy_measure

Measures of asymmetric independence
edge_strength

Strength of edges in a Bayesian network
travel

Bayesian network on travel survey
synthetic_cbn

A synthetic continuous Bayesian network
KL_bounds

Bounds for the KL-divergence
.onAttach

Message for the User
mutual_info

Mutual information
psd_check

Check for positive semi-definiteness after a perturbation
mathmarks

Math Marks Data
seq_pa_ch_monitor

Sequential parent-child node monitors
final_node_monitor

Final node monitors
synthetic_bn

A synthetic Bayesian network
node_monitor

Node monitor
mean_var

Standard variation of the mean vector
sensitivity

Sensitivity function
seq_node_monitor

Sequential node monitors
sensquery

Sensitivity of probability query
model_pres_cov

Model-Preserving co-variation
KL.GBN

KL Divergence for GBN
KL.CI

KL Divergence for CI
Jeffreys

Jeffreys Divergence
Jeffreys.GBN

Jeffreys Divergence for GBN
Fro.GBN

Frobenius norm for GBN
Jeffreys.CI

Jeffreys Divergence for CI
Fro

Frobenius norm