bnlearn is an R package for learning the graphical structure of Bayesian networks. It implements the following costraint-based algorithms:

  • Grow-Shrink (GS)
  • Incremental Association Markov Blanket (IAMB)
  • Fast Incremental Association (Fast-IAMB)
  • Interleaved Incremental Association (Inter-IAMB)

the following score-based algorithms:

  • Hill Climbing (HC)
  • Tabu Search (Tabu)

and the following hybrid algorithms:

  • Max-Min Hill Climbing (MMHC)
  • General 2-Phase Restricted Maximization (RSMAX2)

Both discrete (multinomial) and continuous (multivariate normal) data sets are supported.
Each costraint-based algorithm can be used with several conditional independence tests:

  • discrete case (multinomial distribution)
    • mutual information (both parametric and permutation tests)
    • shrinkage-estimator for the mutual information
    • Pearson's X^2 (both parametric and permutation tests)
    • Akaike Information Criterion test
  • continuous case (multivariate normal distribution)
    • linear correlation (both parametric and permutation tests)
    • Fisher's Z (both parametric and permutation tests)
    • mutual information (both parametric and permutation tests)

and each score-based algorithm can be used with several score functions:

  • discrete case (multinomial distribution)
    • the multinomial loglikelihood
    • the Akaike Information Criterioni (AIC)
    • the Bayesian Information Criterion (BIC)
    • a score equivalent Dirichlet posterior density (BDe)
    • the logarithm of the K2 score
  • continuous case (multivariate normal distribution)
    • the multivariate Gaussian loglikelihood
    • the corresponding Akaike Information Criterion (AIC)
    • the corresponding Bayesian Information Criterion (BIC)
    • a score equivalent Gaussian posterior density (BGe)

Package installation

It's available on CRAN and can be downloaded from its web page in the Packages section (here).
It can be installed with a simple:

install.packages("bnlearn")

The only suggested package not hosted on CRAN is Rgraphviz, which can be installed from Bioconductor:

source("http://bioconductor.org/biocLite.R")
biocLite("Rgraphviz")

following the instructions present on its web page.