# Bayesian Networks

## with Examples in R

M. Scutari and J.-B. Denis (2021).

Texts in Statistical Science, Chapman & Hall/CRC, 2nd edition.

ISBN-10: 0367366517

ISBN-13: 978-0367366513

CRC Website

Amazon Website

The web page for the 1st edition of this book is here.

The web page for the Japanese translation by Wataru Zaitsu and published by Kyoritsu Shuppan is here.

## Errata Corrige

**page 68:**in Equation 3.3, “I = 100 + 500D + ε_{mild}” should be “I = 100 + 550D + ε_{mild}” to match the R code.**page 93:**the R command`dag = model2network("[I][A][S|I:A][O][B][W|S:O:B]")`

should be`dag = model2network("[I][A][S|I:A][O][T][W|S:O:T]")`

.**page 96:**the first equation in the page should read “T ~” instead of “B ~”.**page 132:**“MMHC is illustrated as an example in Algorithm 6.3” should read “SC is illustrated as an example in Algorithm 6.3”, since Algorithm 6.3 illustrates the Sparse Candidate algorithm.**page 236:**to clarify,`D`

has 12 parameters (“dD = 12”) because it has three means and three variances if`H == "any"`

and further three means and three variances if`H == "none"`

. All means and variances are equal to zero if`H == "none"`

, which written as`D == 0`

in Figure 3.1 for brevity.**page 247–248:**the text in the solution to second point of Question 6.5 should read “The two DAGs are identical. The respective BIC scores are therefore identical as well and suggest that the two learning approaches perform equally well for the data.”

## Reference Versions of the Relevant R Packages

The following R packages were used (or at least mentioned) in the book. The reference version used in the writing of the book is the current version as of November 12, 2020, when the book was last compiled. A link to the CRAN/BioConductor homepage is reported for each package. The reference version for R is 4.0.3.

### Dependencies

**pkgbuild**version 1.1.0 [ CRAN ]**pkgconfig**version 2.0.3 [ CRAN ]**igraph**version 1.2.6 [ CRAN ]**mvtnorm**version 1.1-1 [ CRAN ]**circular**version 0.4-93 [ CRAN ]**ggm**version 2.5 [ CRAN ]**bdsmatrix**version 1.3-4 [ CRAN ]**sfsmisc**version 1.1-7 [ CRAN ]**fastICA**version 1.2-2 [ CRAN ]**clue**version 0.3-57 [ CRAN ]**RcppParallel**version 5.0.2 [ CRAN ]**StanHeaders**version 2.21.0-6 [ CRAN ]**inline**version 0.3.16 [ CRAN ]**checkmate**version 2.0.0 [ CRAN ]**matrixStats**version 0.57.0 [ CRAN ]**loo**version 2.3.1 [ CRAN ]**coda**version 0.19-4 [ CRAN ]**corpcor**version 1.6.9 [ CRAN ]**entropy**version 1.2.1 [ CRAN ]**moments**version 0.14 [ CRAN ]**profileModel**version 0.6.0 [ CRAN ]**brglm**version 0.7.1 [ CRAN ]**V8**version 3.4.0 [ CRAN ]

### Graphical and Statistical Modelling Packages

**lme4**version 1.1-25 [ CRAN ]**graph**version 1.66.0 [ BioConductor ]**Rgraphviz**version 2.34.0 [ BioConductor ]**gRbase**version 1.8-6.7 [ CRAN ]**gRain**version 1.3-6 [ CRAN ]**deal**version 1.2-39 [ CRAN ]**catnet**version 1.15.7 [ CRAN ]**pcalg**version 2.7-0 [ CRAN ]**rjags**version 4-10 [ CRAN ]**abn**version 2.2.2 [ CRAN ]**rbmn**version 0.9-3 [ CRAN ]**rstan**version 2.21.2 [ CRAN ]**bnlearn**version 4.6.1 [ CRAN ]

### Additional Packages for Data Used in the Exercises

## R Code and Data Files

- Survey data (Chapter 1). [ link ]
- Crop data (Chapter 2). [ link | link ]
- Healthcare data (Chapter 3). [ link ]
- Domotics data (Chapter 4). [ link ]
- A&E waiting times data (Chapter 5). [ link ]
- Sachs' raw observational data. [ link ]
- Sachs' discretised observational data. [ link ]
- Sachs' complete pre-processed data. [ link ]
- Body composition data [ link ]

## Table of Contents

### The Discrete Case: Multinomial Bayesian Networks

- Introductory Example: Train Use Survey
- Graphical Representation
- Probabilistic Representation
- Estimating the Parameters: Conditional Probability Tables
- Learning the DAG Structure: Tests and Scores
- Conditional Independence Tests
- Network Scores

- Using Discrete BNs
- Using the DAG Structure
- Using the Conditional Probability Tables
- Exact Inference
- Approximate Inference

- Plotting BNs
- Plotting DAGs
- Conditional Probability Distributions

- Further Reading

### The Continuous Case: Gaussian Bayesian Networks

- Introductory Example: Crop Analysis
- Graphical Representation
- Probabilistic Representation
- Estimating the Parameters: Correlation Coefficients
- Learning the DAG Structure
- Conditional Independence Tests
- Network Scores

- Using Gaussian Bayesian Networks
- Exact Inference
- Approximate Inference

- Plotting Gaussian Bayesian Networks
- Plotting DAGs
- Plotting Conditional Probability Distributions

- More Properties
- Further Reading

### The Mixed Case: Conditional Gaussian Bayesian Networks

(NEW)- Introductory Example: Healthcare Costs (NEW)
- Graphical and Probabilistic Representation (NEW)
- Estimating the Parameters: Mixtures of Regressions (NEW)
- Learning the DAG Structure: Tests and Scores (NEW)
- Using Conditional Gaussian Bayesian Networks (NEW)
- Further Reading (NEW)

### Time Series: Dynamic Bayesian Networks

(NEW)- Introductory Example: Domotics (NEW)
- Graphical Representation (NEW)
- Probabilistic Representation (NEW)
- Learning a Dynamic Bayesian Network (NEW)
- Using Dynamic Bayesian Networks (NEW)
- Plotting Dynamic Bayesian Networks (NEW)
- Further Reading (NEW)

### More Complex Cases: Hybrid Bayesian Networks

(NEW)- Introductory Example: A&E Waiting Times (NEW)
- Graphical and Probabilistic Representation (NEW)
- Building the Model in Stan (NEW)
- Generating Data (NEW)
- Exploring the Variables (NEW)

- Estimating the Parameters in Stan (NEW)
- Further Reading (NEW)

### Theory and Algorithms for Bayesian Networks

- Conditional Independence and Graphical Separation
- Bayesian Networks
- Markov Blankets
- Moral Graphs
- Bayesian Network Learning
- Structure Learning
- Constraint-based Algorithms
- Score-based Algorithms
- Hybrid Algorithms

- Parameter Learning

- Structure Learning
- Bayesian Network Inference
- Probabilistic Reasoning and Evidence
- Algorithms for Belief Updating
- Exact Inference Algorithms (NEW)
- Approximate Inference Algorithms (NEW)

- Causal Bayesian Networks
- Evaluating a Bayesian Network (NEW)
- Further Reading

### Software for Bayesian Networks

- An Overview of R Packages
- The
**deal**package - The
**catnet**package - The
**pcalg**package - The
**abn**package (NEW)

- The
- Stan and BUGS Software Packages (NEW)
- Stan: a Feature Overview (NEW)
- Inference Based on MCMC Sampling (NEW)

- Other Software Packages
- BayesiaLab
- Hugin
- GeNIe (NEW)

- An Overview of R Packages
### Real-World Applications of Bayesian Networks

- Learning Protein-Signalling Networks
- A Gaussian Bayesian Network
- Discretising Gene Expressions
- Model Averaging
- Choosing the Significance Threshold
- Handling Interventional Data
- Querying the Network

- Predicting the Boby Composition
- Aim of the Study
- Designing the Predictive Approach
- Assessing the Quality of a Predictor
- The Saturated BN
- Convenient BNs

- Looking for Candidate BNs

- Further Reading

- Learning Protein-Signalling Networks

### Graph Theory

- Graphs, Nodes and Arcs
- The Structure of a Graph
- Further Reading

### Probability Distributions

- General Features
- Marginal and Conditional Distributions
- Discrete Distributions
- Continuous Distributions
- Conjugate Distributions
- Further Reading

### A Note About Bayesian Networks