# Bayesian Networks in R

## with Applications in Systems Biology

R. Nagarajan, M. Scutari and S. Lèbre (2013).

Use R!, Vol. 48, Springer (US).

ISBN-10: 1461464455

ISBN-13: 978-1461464457

Springer Website

Amazon Website

## Errata Corrige

**page 3:**“if a node v_{i}precedes v_{j}, there can be no arc from v_{j}to v_{i}” should be “if a node v_{i}precedes v_{j}, there can be no path from v_{j}to v_{i}”.**page 3:**it's true that leaf nodes do not have any outgoing arc, but they are not required to have any incoming arc.**page 17:**“S_{AB}⊂ V” should be “S_{AB}⊂**V**”, where**V**is the node set.**page 22:**in Equation (2.12), the numerator of the ratio under the square root should be “*n*- |**Z**| - 2” and not “*n*- 2”.**page 35:****bnlearn**3.2 and later versions are more picky about setting arc directions; as a result`bn.gs`

is an undirected graph and must be extended into a DAG with`cextend()`

to conclude the example.**page 39:**at least in modern times,**deal**is unable to fit a network containing only continuous variables. A workaround is to include a dummy factor (e.g.`marks$XYZ <- factor(rep("xyz", nrow(marks)))`

) before calling`network()`

so that`jointprior()`

does not fail.**page 47:**“phopsholypids” should be “phospholipids”.**page 75:**“`coef(object)`

” should be “`coef(lasso.fit)`

”.**page 78, 79:**“`arth.edges`

” should be “`arth.arcs`

”.**page 89, 149:**“Cheng & Druzdel (2000)” should be “Cheng & Druzdzel (2000)”.**page 98:**the code to create and fit the dynamic Bayesian network inference example fails in modern versions of R and**bnlearn**. The following, slightly modified snipped works with an updated installation as of May 2015.

dbn2 = empty.graph(c("265768_at", "245094_at1", "258736_at", "257710_at", "255070_at", "245319_at", "245094_at")) dbn2 = set.arc(dbn2, "245094_at", "265768_at") for (node in names(coef(lasso.s))[-c(1, 6)]) dbn2 = set.arc(dbn2, node, "245094_at") dbn2 = set.arc(dbn2, "245094_at1", "245094_at") dbn2.data = as.data.frame(x[, nodes(dbn2)[1:6]]) dbn2.data[, "245094_at"] = y dbn2.data[, "245094_at1"] = arth12[2:(nrow(arth12) - 1), "245094_at"] dbn2.fit = bn.fit(dbn2, dbn2.data)

**page 104:**“a single operations” should be “a single operation”.

## 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 1.32.0 [ BioConductor ]**graph**version 1.32.0 [ BioConductor ]**igraph**version 0.6-2 [ CRAN ]**bnlearn**version 3.1 [ CRAN ]**grBase**version 1.3.4 [ CRAN ]**gRain**version 0.8.5 [ CRAN ]**catnet**version 1.13.4 [ CRAN ]**mugnet**version 0.13.5 [ CRAN ]**vars**version 1.5-0 [ CRAN ]**G1DBN**version 3.1 [ CRAN ]**deal**version 1.2-34 [ CRAN ]

**ARTIVA**version 1.2 [ CRAN ]**simone**version 1.0-1 [ CRAN Archive ]**GeneNet**version 1.2.5 [ CRAN ]**lars**version 1.1 [ CRAN ]**glmnet**version 1.8-2 [ CRAN ]**penalized**version 0.9-41 [ CRAN ]**EDISON**version 1.0 [ CRAN ]**rsprng**version 1.0 [ CRAN ]**Rmpi**version 0.5-8 [ CRAN ]**snow**version 0.3-3 [ CRAN ]**rpvm**version 1.0-4 [ CRAN Archive ]

## R Code and Data Files

## Table of Contents

### Introduction

### A Brief Introduction to Graph Theory

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

### The R Environment for Statistical Computing

- Base Distribution and Contributed Packages
- A Quick Introduction to R
- Further Reading

### Exercises

### Bayesian Networks in the Absence of Temporal Information

### Bayesian Networks: Essential Definitions and Properties

- Graph Structure and Probability Factorization
- Fundamental Connections
- Equivalent Structures
- Markov Blankets

### Static Bayesian Networks Modeling

- Constraint-Based Structure Learning Algorithms
- Score-Based Structure Learning Algorithms
- Hybrid Structure Learning Algorithms
- Choosing Distributions, Conditional Independence Tests, and Network Scores
- Parameter Learning
- Discretization

### Static Bayesian Networks Modeling with R

- Popular R Packages for Bayesian Network Modeling
- Creating and Manipulating Network Structures
- Plotting Network Structures
- Structure Learning
- Parameter Learning
- Discretization

### Pearlâ€™s Causality

### Applications to Gene Expression Profiles

- Model Averaging
- Choosing the Significance Threshold
- Handling Interventional Data

### Exercises

### Bayesian Networks in the Presence of Temporal Information

### Time Series and Vector Auto-Regressive Processes

- Univariate Time Series
- Multivariate Time Series

### Dynamic Bayesian Networks: Essential Definitions and Properties

- Definitions
- Dynamic Bayesian Network Representation of a VAR Process

### Dynamic Bayesian Network Learning Algorithms

- Least Absolute Shrinkage and Selection Operator
- Jamesâ€“Stein Shrinkage
- First-Order Conditional Dependencies Approximation
- Modular Networks

### Non-homogeneous Dynamic Bayesian Network Learning

### Dynamic Bayesian Network Learning with R

- Multivariate Time Series Analysis
- LASSO Learning: lars and simone
- Other Shrinkage Approaches: GeneNet, G1DBN
- Non-homogeneous Dynamic Bayesian Network Learning: ARTIVA

### Exercises

### Bayesian Network Inference Algorithms

### Reasoning Under Uncertainty

- Probabilistic Reasoning and Evidence
- Algorithms for Belief Updating: Exact and Approximate Inference
- Causal Inference

### Inference in Static Bayesian Networks

- Exact Inference
- Approximate Inference

### Inference in Dynamic Bayesian Networks

### Exercises

### Parallel Computing for Bayesian Networks

### Foundations of Parallel Computing

### Parallel Programming in R

### Applications to Structure and Parameter Learning

- Constraint-Based Structure Learning Algorithms
- Score-Based Structure Learning Algorithms
- Hybrid Structure Learning Algorithms
- Parameter Learning

### Applications to Inference Procedures

- Bootstrap
- Cross-Validation
- Conditional Probability Queries

### Exercises