# 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

• nlme version 3.1-150 [ CRAN ]
• setRNG version 2013.9-1 [ CRAN ]
• tframe version 015.12-1.1 [ CRAN ]
• tfplot version 2015.12-1 [ CRAN ]
• dse version 2020.2-1 [ CRAN ]

## R Code and Data Files

• R code, Chapter 1. [ link ]
• R code, Chapter 2. [ link ]
• R code, Chapter 3. [ link ]
• R code, Chapter 4. [ link ]
• R code, Chapter 5. [ link ]
• R code, Chapter 6. [ link ]
• R code, Chapter 7. [ link ]
• R code, Chapter 8. [ link ]
• Survey data (Chapter 1). [ 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 ]

1. ### The Discrete Case: Multinomial Bayesian Networks

1. Introductory Example: Train Use Survey
2. Graphical Representation
3. Probabilistic Representation
4. Estimating the Parameters: Conditional Probability Tables
5. Learning the DAG Structure: Tests and Scores
1. Conditional Independence Tests
2. Network Scores
6. Using Discrete BNs
1. Using the DAG Structure
2. Using the Conditional Probability Tables
1. Exact Inference
2. Approximate Inference
7. Plotting BNs
1. Plotting DAGs
2. Conditional Probability Distributions
Exercises
2. ### The Continuous Case: Gaussian Bayesian Networks

1. Introductory Example: Crop Analysis
2. Graphical Representation
3. Probabilistic Representation
4. Estimating the Parameters: Correlation Coefficients
5. Learning the DAG Structure
1. Conditional Independence Tests
2. Network Scores
6. Using Gaussian Bayesian Networks
1. Exact Inference
2. Approximate Inference
7. Plotting Gaussian Bayesian Networks
1. Plotting DAGs
2. Plotting Conditional Probability Distributions
8. More Properties
Exercises
3. ### The Mixed Case: Conditional Gaussian Bayesian Networks

(NEW)
1. Introductory Example: Healthcare Costs (NEW)
2. Graphical and Probabilistic Representation (NEW)
3. Estimating the Parameters: Mixtures of Regressions (NEW)
4. Learning the DAG Structure: Tests and Scores (NEW)
5. Using Conditional Gaussian Bayesian Networks (NEW)
Exercises
4. ### Time Series: Dynamic Bayesian Networks

(NEW)
1. Introductory Example: Domotics (NEW)
2. Graphical Representation (NEW)
3. Probabilistic Representation (NEW)
4. Learning a Dynamic Bayesian Network (NEW)
5. Using Dynamic Bayesian Networks (NEW)
6. Plotting Dynamic Bayesian Networks (NEW)
Exercises
5. ### More Complex Cases: Hybrid Bayesian Networks

(NEW)
1. Introductory Example: A&E Waiting Times (NEW)
2. Graphical and Probabilistic Representation (NEW)
3. Building the Model in Stan (NEW)
1. Generating Data (NEW)
2. Exploring the Variables (NEW)
4. Estimating the Parameters in Stan (NEW)
Exercises
6. ### Theory and Algorithms for Bayesian Networks

1. Conditional Independence and Graphical Separation
2. Bayesian Networks
3. Markov Blankets
4. Moral Graphs
5. Bayesian Network Learning
1. Structure Learning
1. Constraint-based Algorithms
2. Score-based Algorithms
3. Hybrid Algorithms
2. Parameter Learning
6. Bayesian Network Inference
1. Probabilistic Reasoning and Evidence
2. Algorithms for Belief Updating
1. Exact Inference Algorithms (NEW)
2. Approximate Inference Algorithms (NEW)
7. Causal Bayesian Networks
8. Evaluating a Bayesian Network (NEW)
Exercises
7. ### Software for Bayesian Networks

1. An Overview of R Packages
1. The deal package
2. The catnet package
3. The pcalg package
4. The abn package (NEW)
2. Stan and BUGS Software Packages (NEW)
1. Stan: a Feature Overview (NEW)
2. Inference Based on MCMC Sampling (NEW)
3. Other Software Packages
1. BayesiaLab
2. Hugin
3. GeNIe (NEW)
Exercises
8. ### Real-World Applications of Bayesian Networks

1. Learning Protein-Signalling Networks
1. A Gaussian Bayesian Network
2. Discretising Gene Expressions
3. Model Averaging
4. Choosing the Significance Threshold
5. Handling Interventional Data
6. Querying the Network
2. Predicting the Boby Composition
1. Aim of the Study
2. Designing the Predictive Approach
1. Assessing the Quality of a Predictor
2. The Saturated BN
3. Convenient BNs
3. Looking for Candidate BNs
1. ### Graph Theory

1. Graphs, Nodes and Arcs
2. The Structure of a Graph
2. ### Probability Distributions

1. General Features
2. Marginal and Conditional Distributions
3. Discrete Distributions
4. Continuous Distributions
5. Conjugate Distributions