# BayesiaLab

## Inference: Diagnosis, Prediction, and Simulation

The inherent ability of Bayesian networks to explicitly model uncertainty makes them suitable for a broad range of real-world applications. In the Bayesian network framework, diagnosis, prediction, and simulation are identical computations. They all consist of observational inference conditional upon evidence:

- Inference from effect to cause: diagnosis or abduction.
- Inference from cause to effect: simulation or prediction.

This distinction, however, only exists from the perspective of the researcher, who would presumably see the symptom of a disease as the effect and the disease itself as the cause. Hence, carrying out inference based on observed symptoms is interpreted as “diagnosis.”

### Observational Inference

One of the central benefits of Bayesian networks is that they compute inference “omni-directionally.” Given an observation with any type of evidence on any of the networks’ nodes (or a subset of nodes), BayesiaLab can compute the posterior probabilities of all other nodes in the network, regardless of arc direction. Both exact and approximate observational inference algorithms are implemented in BayesiaLab.

#### Types of Evidence

**Hard Evidence**: no uncertainty regarding the state of the variable (node), e.g.*P(Smoker=True)=100%*(Figure 3.10).**Probabilistic Evidence (or Soft Evidence)**, defined by marginal probability distributions:*P(Bronchitis=True)=66.67%*(Figure 3.11).**Numerical Evidence**, for numerical variables, or for categorical/symbolic variables that have associated numerical values. BayesiaLab computes a marginal probability distribution to generate the specified expected value: E(*Age*)=*39*(Figure 3.12).**Likelihood Evidence**(or**Virtual Evidence**), defined by a likelihood of each state, ranging from 0%, i.e. impossible, to 100%, which means that no evidence reduces the probability of the state. To be valid as evidence, the sum of the likelihoods must be greater than 0. Also, note that the upper boundary for the sum of the likelihoods equals the number of states.

## Causal Inference

Beyond observational inference, BayesiaLab can also perform causal inference for computing the impact of *intervening* on a subset of variables instead of merely *observing* these variables. Both Pearl’s **Do-Operator** and Jouffe’s **Likelihood Matching** are available for this purpose. We provide a detailed discussion of causal inference in Chapter 10 of our book, Bayesian Networks and BayesiaLab.

## Effects Analysis

Many research activities focus on estimating the size of an effect, e.g. to establish the treatment effect of a new drug or to determine the sales boost from a new advertising campaign. Other studies attempt to decompose observed effects into their causes, i.e. they perform attribution.

BayesiaLab performs simulations to compute effects, as parameters as such do not exist in this nonparametric framework. As all the dynamics of the domain are encoded in discrete **CPTs**, effect sizes only manifest themselves when different conditions are simulated. Total Effects Analysis, Target Mean Analysis, and several other functions offer ways to study effects, including nonlinear effects and variables interactions.

## Optimization

BayesiaLab’s ability to perform inference over all possible states of all nodes in a network also provides the basis for searching for node values that optimize a target criterion. BayesiaLab’s **Target Dynamic Profile** and **Target Optimization** are a set of tools for this purpose.

Using these functions in combination with **Direct Effects** is of particular interest when searching for the optimum combination of variables that have a nonlinear relationship with the target, plus co-relations between them. A typical example would be searching for the optimum mix of marketing expenditures to maximize sales. BayesiaLab’s **Target Optimization **will search, within the specified constraints, for those scenarios that optimize the target criterion. An example of **Target Dynamic Profile** is presented in Chapter 8 of our book, Bayesian Networks & BayesiaLab.