8  Appendix - Distributions

This chapter describes some common distributions used in Bayesian models

8.1 Binomial Distribution

Used when Y is a count outcome (e.g. the number of wins in a set of matches)

\(Y|\pi \sim Bin(n, \pi)\)

where \(\pi\) is the probability of success in a given trial

8.2 Multivariate Normal

A multivariate normal distribution is an abstraction of the univariate normal distribution. It’s parameterized by two components:

  • a mean vector, \(\mu\), and;
  • a covariance matrix, \(\Sigma\)

The diagonal of the covariance matrix describes each variable’s (e.g. \(x_i\)) variance, whereas all off-diagonal elements describe the covariance between, \(x_i\) and \(x_j\) or whatever you want to refer to the variables as.

If the off-diagonal elements are all 0, then all of the variables are independent. The code below shows an example of a multivariate normal distribution with 3 independent variables, all with a mean of 0 and a variance of 5.

using Distributions
using LinearAlgebra

p = 3

d = MvNormal(zeros(p), 5.0 * I)
IsoNormal(
dim: 3
μ: [0.0, 0.0, 0.0]
Σ: [5.0 0.0 0.0; 0.0 5.0 0.0; 0.0 0.0 5.0]
)

And the code below will do create a multivariate normal distribution where the variables are correlated

Σ = [[1.0, 0.8, 0.7] [0.8, 1.0, 0.9] [0.7, 0.9, 1.0]]

d2 = MvNormal(zeros(p), Σ)
FullNormal(
dim: 3
μ: [0.0, 0.0, 0.0]
Σ: [1.0 0.8 0.7; 0.8 1.0 0.9; 0.7 0.9 1.0]
)