# Bayesian Networks

## with Examples in R

M. Scutari and J.-B. Denis (2014).
Texts in Statistical Science, Chapman & Hall/CRC.
ISBN-10: 1482225581
ISBN-13: 978-1482225587
CRC Website
Amazon Website The web page for the 2nd edition of this book is here.

## Errata Corrige

• page 15: in equation (1.11), “ntek/n” should be just “ntek”, otherwise the expression defines mutual information instead of the G2 test.
• page 16: the correct result for `ci.test("T", "E", c("O", "R"), test = "x2", data = survey)` is `8.24` for the test statistic and `0.4106` for the p-value.
• page 17: the correct result for `ci.test("T", "O", "R", test = "x2", data = survey)` is `3.7988` for the test statistic and `0.4339` for the p-value.
• page 17:`E x T`” and “`O x T`” (which denote two-dimensional contingency tables) can be better read as “`E → T`” and “`O → T`” (the arcs from which the contingency tables arise).
• page 39: in Figure 2.1, `C` | `N` ~ N(...) should be `C` | `N`, `W` ~ N(...).
• page 43: in Table 2.1, “07v” should be “0.7v” in the probability distribution of `W` | `C`.
• page 90: at the end of the `R` code snippet, the value returned by the last command should be `TRUE` and not `"Different arc sets"`.
• page 99: “αij + nijk” in Equation (4.16) should be “αijk + nijk”.
• page 105: the sentence “As a result, the marginal dependence test between `V` and `N` is significant at α = 0.05 while the same test conditional on `C` is not.” should be phrased the other way round, since the marginal test is not significant while the conditional test is significant.
• page 116:`joung`” should be “`young`” in the R code.
• page 129: the output of `compare()` reports `tp`, `fp` and `fn` equal to `1`, `4` and `8`, which is incorrect. They should be equal to `0`, `5` and `9`.
• page 148: the output `"Different number of directed/undirected arcs"` is incorrect, it should be `TRUE` since `avg.boot` and `avg.start` are equivalent.
• page 211: the solution to the last point of Exercise 4.3 is missing. It should read:
```for (size in c(0.005, 0.01, 0.1, 0.5, 1)) {

subset = sample(nrow(survey), nrow(survey) * size)
subsample = survey[subset, ]
print(score(dag.hc3, subsample, type = "bic") /
score(dag.hc3, subsample, type = "bde"))

}#FOR
```

## 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 and a link to the CRAN/BioConductor homepage are reported for each package.

• Rgraphviz version 2.4.1 [ BioConductor ]
• graph version 1.38.3 [ BioConductor ]
• igraph version 0.7.1 [ CRAN ]
• bnlearn version 3.5 [ CRAN ]
• grBase version 1.6-12 [ CRAN ]
• gRain version 1.2-2 [ CRAN ]
• catnet version 1.14.2 [ CRAN ]
• deal version 1.2-37 [ CRAN ]
• penalized version 0.9-42 [ CRAN ]
• pcalg version 2.0-2 [ CRAN ]
• corpcor version 1.6.6 [ CRAN ]
• rbmn version 0.9-2 [ CRAN ]
• rjags version 3-13 [ 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 ]
• Survey data (Chapter 1). [ link ]
• Sachs' raw observational data. [ link ]
• Sachs' discretised observational data. [ link ]
• Sachs' complete pre-processed data. [ link ]
• JAGS model files for Chapter 3. [ 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. ### More Complex Cases: Hybrid Bayesian Networks

1. Introductory Example: Reinforcing Steel Rods
1. Mixing Discrete and Continuous Variables
2. Discretising Continuous Variables
3. Using Different Probability Distributions
2. Pest Example with JAGS
1. Modelling
2. Exploring
Exercises
4. ### 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
7. Causal Bayesian Networks
Exercises
5. ### Software for Bayesian Networks

1. An Overview of R Packages
1. The deal package
2. The catnet package
3. The pcalg package
2. BUGS Software Packages
1. Probability Distributions
2. Complex Dependencies
3. Inference Based on MCMC Sampling
3. Other Software Packages
1. BayesiaLab
2. Hugin
3. GeNIe
Exercises
6. ### 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