Learn R Programming

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

bnRep

The R package bnRep includes the largest repository of Bayesian networks, which were all collected from recent academic literature in a variety of fields! If you are using any Bayesian network from bnRep you should cite:

Leonelli, M (2024). “bnRep: A repository of Bayesian networks from the academic literature.” arXiv preprint arXiv:2409.19158.

@Article{,
    title = {bn{R}ep: A repository of {B}ayesian networks from the academic literature},
    author = {Manuele Leonelli},
    journal = {arXiv preprint arXiv:2409.19158},
    year = {2024}
  }

Go to https://manueleleonelli.shinyapps.io/bnRep/ to explore the repository online!

Contribution

If you are interested in having your Bayesian network included in bnRep you must prepare three objects:

  • the Bayesian network as a bn.fit object (if not created with bnlearn you can always use import functions, such as read.bif());

  • an R file with the same name of the bn.fit object reporting the documentation of the Bayesian network;

  • a vector/excel file with the required details to include in the bnRep_summary object.

You can submit the required objects directly via github (e.g fork/pull), or via email.

If you struggle with any of these steps, please get in touch and I will try to help!

Overview

bnRep includes over 200 Bayesian networks from more than 150 academic publications. It includes discrete, Gaussian and conditional linear Gaussian Bayesian networks, all stored as appropriate bn.fit objects from bnlearn. They can be exported for use to other software (e.g. Phython libraries) using functions from bnlearn such as write.bif(). Recall that in order to plot the associated DAG, one must first convert it to a graph object with bn.net() from the bnlearn package.

Installation

# Install stable version from CRAN:
install.packages("bnRep")

# Or the development version from GitHub:
remotes::install_github("manueleleonelli/bnRep")

Usage

We will use the lawschool Bayesian network as an example. To load it in the environment simply call data(lawschool) and to then plot it (for instance using graphviz.plot from the bnlearn package)

library(bnRep)
library(bnlearn)
library(qgraph)
data("lawschool")
qgraph::qgraph(bn.net(lawschool))

Notice that the function bn.net function must be used in order to plot the network.

Exploring bnRep

bnRep includes two features to explore the Bayesian networks in the repository:

  • bnRep_summary: a dataframe with important details about each network in the repository.

  • bnRep_app: a Shiny app to interactively explore bnRep_summary and filter the networks according to various criteria. The app is also available online at https://manueleleonelli.shinyapps.io/bnRep/.

Here’s the columns of bnRep_summary:

#>  [1] "Name"                   "Type"                   "Structure"             
#>  [4] "Probabilities"          "Graph"                  "Area"                  
#>  [7] "Nodes"                  "Arcs"                   "Parameters"            
#> [10] "Avg. Parents"           "Max Parents"            "Avg. Levels"           
#> [13] "Max Levels"             "Average Markov Blanket" "Year"                  
#> [16] "Journal"                "Reference"

An overview of the Bayesian networks in bnRep

The following plots show some summary statistics of the repository.

Copy Link

Version

Install

install.packages('bnRep')

Monthly Downloads

284

Version

0.0.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Manuele Leonelli

Last Published

October 1st, 2024

Functions in bnRep (0.0.2)

agropastoral3

agropastoral Bayesian Networks
agropastoral1

agropastoral Bayesian Networks
aircrash

aircrash Bayesian Network
agropastoral4

agropastoral Bayesian Networks
agropastoral2

agropastoral Bayesian Networks
agropastoral5

agropastoral Bayesian Networks
algal1

algal Bayesian Networks
algal2

algal Bayesian Networks
algalactivity2

algalactivity Bayesian Networks
algalactivity1

algalactivity Bayesian Networks
algorithms5

algorithms Bayesian Networks
argument

argument Bayesian Network
asia

asia Bayesian Network
algorithms1

algorithms Bayesian Networks
algorithms3

algorithms Bayesian Networks
arcticwaters

arcticwaters Bayesian Network
algorithms4

algorithms Bayesian Networks
beam1

beams Bayesian Network
augmenting

augmenting Bayesian Network
bank

bank Bayesian Network
aspergillus

aspergillus Bayesian Network
bankruptcy

bankruptcy Bayesian Network
beam2

beams Bayesian Network
algorithms2

algorithms Bayesian Networks
beatles

beatles Bayesian Network
bnRep_summary

BnRep Summary
building

building Bayesian Network
catchment

catchment Bayesian Network
charleston

charleston Bayesian Network
cachexia2

cachexia Bayesian Networks
cachexia1

cachexia Bayesian Networks
algorithms6

algorithms Bayesian Networks
cng

cng Bayesian Network
chds

chds Bayesian Network
concrete1

concrete Bayesian Networks
compaction

compaction Bayesian Network
concrete3

concrete Bayesian Networks
concrete4

concrete Bayesian Networks
conasense

conasense Bayesian Network
covid2

covid Bayesian Networks
criminal2

criminal Bayesian Networks
covid3

covid Bayesian Networks
coral5

coral Bayesian Networks
coral4

coral Bayesian Networks
bnRep_app

Launch the Bayesian Network Viewer App
bnRep

bnRep: A Repository of Bayesian Network Models
criminal3

criminal Bayesian Networks
case

case Bayesian Network
cardiovascular

cardiovascular Bayesian Network
concrete2

concrete Bayesian Networks
disputed4

disputed Bayesian Networks
.onAttach

Message for the User
disputed1

disputed Bayesian Networks
dioxins

dioxins Bayesian Network
corical

corical Bayesian Network
blacksea

blacksea Bayesian Network
blockchain

blockchain Bayesian Network
burglar

burglar Bayesian Network
engines

engines Bayesian Network
corrosion

corrosion Bayesian Network
enrollment

enrollment Bayesian Network
bullet

bullet Bayesian Network
covidtech

covidtech Bayesian Network
electrolysis

electrolysis Bayesian Network
consequenceCovid

consequenceCovid Bayesian Network
fire

fire Bayesian Network
firealarm

firealarm Bayesian Network
concrete7

concrete Bayesian Networks
crimescene

crimescene Bayesian Network
coral2

coral Bayesian Networks
emergency

emergency Bayesian Network
curacao1

curacao Bayesian Networks
covidtest

covidtest Bayesian Network
criminal1

criminal Bayesian Networks
concrete5

concrete Bayesian Networks
concrete6

concrete Bayesian Networks
constructionproductivity

constructionproductivity Bayesian Network
coral3

coral Bayesian Networks
corticosteroid

corticosteroid Bayesian Network
covid1

covid Bayesian Networks
curacao3

curacao Bayesian Networks
humanitarian

humanitarian Bayesian Network
greencredit

greencredit Bayesian Network
grounding

grounding Bayesian Network
healthinsurance

healthinsurance Bayesian Network
curacao4

curacao Bayesian Networks
disputed3

disputed Bayesian Networks
disputed2

disputed Bayesian Networks
nuisancegrowth

nuisancegrowth Bayesian Network
oildepot

oildepot Bayesian Network
curacao2

curacao Bayesian Networks
coral1

coral Bayesian Networks
covidfear

covidfear Bayesian Network
covidrisk

covidrisk Bayesian Network
curacao5

curacao Bayesian Networks
phdarticles

phdarticles Bayesian Network
pilot

pilot Bayesian Network
fluids3

fluids Bayesian Networks
electricvehicle

electricvehicle Bayesian Network
ecosystem

ecosystem Bayesian Network
darktriad

darktriad Bayesian Network
fundraising

fundraising Bayesian Network
inverters

inverters Bayesian Network
expenditure

expenditure Bayesian Network
estuary

estuary Bayesian Network
foodsecurity

foodsecurity Bayesian Network
foodallergy1

foodallergy Bayesian Networks
knowledge

knowledge Bayesian Network
gasifier

gasifier Bayesian Network
gasexplosion

gasexplosion Bayesian Network
fluids1

fluids Bayesian Networks
fluids2

fluids Bayesian Networks
criminal4

criminal Bayesian Networks
crypto

crypto Bayesian Network
dragline

dragline Bayesian Network
diabetes

ciabetes Bayesian Network
earthquake

earthquake Bayesian Network
drainage

drainage Bayesian Network
get_network_list

Get the list of available Bayesian network files
dustexplosion

dustexplosion Bayesian Network
diagnosis

diagnosis Bayesian Network
lexical

lexical Bayesian Network
gonorrhoeae

gonorrhoeae Bayesian Network
firerisk

firerisk Bayesian Network
lidar

lidar Bayesian Network
onlinerisk

onlinerisk Bayesian Network
seismic

seismic Bayesian Network
projectmanagement

projectmanagement Bayesian Network
propellant

propellant Bayesian Network
load_network

Load a Bayesian network
intentionalattacks

intentionalattacks Bayesian Network
lithium

lithium Bayesian Network
intensification

intensification Bayesian Network
fingermarks1

fingermarks Bayesian Networks
fingermarks2

fingermarks Bayesian Networks
flood

flood Bayesian Network
orbital

orbital Bayesian Network
hydraulicsystem

hydraulicsystem Bayesian Network
income

income Bayesian Network
liquefaction

liquefaction Bayesian Network
perioperative

perioperative Bayesian Network
permaBN

permaBN Bayesian Network
shipping

shipping Bayesian Network
foodallergy2

foodallergy Bayesian Networks
soilliquefaction4

soilliquefaction Bayesian Networks
softwarelogs1

softwarelogs Bayesian Networks
ropesegment

ropesegment Bayesian Network
rockquality

rockquality Bayesian Network
simulation

simulation Bayesian Network
stocks

stocks Bayesian Network
foodallergy3

foodallergy Bayesian Networks
pneumonia

pneumonia Bayesian Network
liquidity

liquidity Bayesian Network
polymorphic

polymorphic Bayesian Network
tbm

tbm Bayesian Network
macrophytes

macrophytes Bayesian Network
turbine2

turbine Bayesian Networks
theft1

theft Bayesian Networks
soilliquefaction3

soilliquefaction Bayesian Networks
trajectories

trajectories Bayesian Network
twinframework

twinframework Bayesian Network
vaccine

vaccine Bayesian Network
soilliquefaction2

soilliquefaction Bayesian Networks
tastingtea

tastingtea Bayesian Network
urinary

urinary Bayesian Network
moodstate

moodstate Bayesian Network
medicaltest

medicaltest Bayesian Network
yangtze

yangtze Bayesian Network
suffocation

suffocation Bayesian Network
transport

transport Bayesian Network
redmeat

redmeat Bayesian Network
softwarelogs2

softwarelogs Bayesian Networks
oxygen

oxygen Bayesian Network
nanomaterials1

nanomaterial Bayesian Networks
resilience

resilience Bayesian Network
parkinson

parkinson Bayesian Network
mountaingoat

mountaingoat Bayesian Network
rainstorm

rainstorm Bayesian Network
nanomaterials2

nanomaterial Bayesian Networks
waterlead

waterlead Bayesian Network
softwarelogs3

softwarelogs Bayesian Networks
wheat

wheat Bayesian Network
metal

metal Bayesian Network
kosterhavet

kosterhavet Bayesian Network
nuclearwaste

nuclearwaste Bayesian Network
lawschool

lawschool Bayesian Network
navigation

navigation Bayesian Network
megacities

megacities Bayesian Network
soillead

soillead Bayesian Network
project

project Bayesian Network
ricci

ricci Bayesian Network
poultry

poultry Bayesian Network
rockburst

rockburst Bayesian Network
sallyclark

sallyclark Bayesian Network
theft2

theft Bayesian Networks
safespeeds

safespeeds Bayesian Network
windturbine

windturbine Bayesian Network
soilliquefaction1

soilliquefaction Bayesian Networks
rainwater

rainwater Bayesian Network
soil

soil Bayesian Network
softwarelogs4

softwarelogs Bayesian Networks
salmonella1

salmonella Bayesian Networks
vessel1

vessel Bayesian Networks
vessel2

vessel Bayesian Networks
titanic

titanic Bayesian Network
salmonella2

salmonella Bayesian Networks
student1

student Bayesian Networks
tubercolosis

tubercolosis Bayesian Network
student2

student Bayesian Networks
turbine1

turbine Bayesian Networks
witness

witness Bayesian Network
adversarialbehavior

adversarialbehavior Bayesian Network
adhd

adhd Bayesian Network
aerialvehicles

aerialvehicles Bayesian Network
APSsystem

APSsystem Bayesian Network
GDIpathway1

GDIpathway Bayesian Networks
GDIpathway2

GDIpathway Bayesian Networks
BOPfailure2

BOPfailure Bayesian Networks
BOPfailure1

BOPfailure Bayesian Networks
accidents

accidents Bayesian Network
BOPfailure3

BOPfailure Bayesian Networks