1 of 56

Introduction to probability and statistics

Sep 16th 2021

Slides by Prof. Sushmita Roy

Some of the material covered is adapted from BMI/CS 576 from Prof. Mark Craven

BMI 826-23 Computational Network Biology�Fall 2021

Anthony Gitter

https://compnetbiocourse.discovery.wisc.edu

2 of 56

Goals for today

  • Introductory concepts in probability and statistics
  • Introduction to probabilistic graphical models: Bayesian networks

3 of 56

RECAP from last time

  • A graph has a node set and edge set
  • Graphs can be undirected, weighted, directed
  • Graph traversal
  • Molecular networks
    • Nodes are biological molecules
      • Genes, proteins, metabolites, etc.
    • Edges represent interaction between molecules
    • Graph representations often have additional information such as sign, directionality, weight
  • Example molecular networks
    • Transcriptional regulatory networks, protein-protein interaction networks, signaling networks

4 of 56

Goals for today

  • Introductory concepts in probability and statistics
  • Introduction to probabilistic graphical models: Bayesian networks

5 of 56

A few key concepts

  • Sample spaces
  • Random variables
  • Discrete and continuous distributions
  • Joint, conditional, and marginal distributions
  • Statistical independence
  • Bayes Rule

6 of 56

Definition of probability

  • Intuitively, we use “probability” to refer to our degree of confidence in an event of an uncertain nature.

  • Always a number in the interval [0,1]

0 means “never occurs”

1 means “always occurs”

7 of 56

Sample space

  • Sample space: a set of possible outcomes for an experiment
  • Examples
    • Flight to Chicago: {on time, late}
    • Lottery: {ticket 1 wins, ticket 2 wins,…,ticket n wins}
    • Weather tomorrow:

{rain, not rain} or

{sun, rain, snow} or

{sun, clouds, rain, snow, sleet}

    • Roll of a die: {1,2,3,4,5,6}
    • Coin toss: {Heads, Tail}

8 of 56

Random variables

  • Random variable: maps the outcome of an uncertain experiment to a real-valued number
  • A random variable can be
    • Discrete/Categorical: Outcomes take a fixed set of values
      • Roll of die, flight to Chicago, weather tomorrow
    • Continuous: Outcomes take continuous values
      • Height, weight

9 of 56

Notation

  • Uppercase letters and words denote random variables
    • X, Y
  • Lowercase letters and words denote values
    • x, y
  • Probability that X takes value x

  • We will also use the shorthand form

  • For Boolean random variables, we will use the shorthand

10 of 56

Discrete probability distributions

  •  

sun

clouds

rain

snow

sleet

0.2

0.3

0.1

11 of 56

Joint probability distributions

  • Joint probability distribution: the function given by P(X = x, Y = y)
  • Read “X equals x and Y equals y
  • Example

x, y

P(X = x, Y = y)

sun, on-time

0.20

rain, on-time

0.20

snow, on-time

0.05

sun, late

0.10

rain, late

0.30

snow, late

0.15

probability that it’s sunny

and my flight is on time

12 of 56

Marginal probability distributions

  • The marginal distribution of X is defined by

“the distribution of X ignoring other variables”

  • This definition generalizes to more than two variables, e.g.

13 of 56

Marginal distribution example

x, y

P(X = x, Y = y)

sun, on-time

0.20

rain, on-time

0.20

snow, on-time

0.05

sun, late

0.10

rain, late

0.30

snow, late

0.15

x

P(X = x)

sun

0.3

rain

0.5

snow

0.2

joint distribution

marginal distribution for X

14 of 56

Conditional distributions

  • The conditional distribution of X given Y is defined as:

  • Or in short

  • The distribution of X given that we know the value of Y

  • Intuitively, how much does knowing Y tell us about X?

15 of 56

Conditional distribution example

x, y

P(X = x, Y = y)

sun, on-time

0.20

rain, on-time

0.20

snow, on-time

0.05

sun, late

0.10

rain, late

0.30

snow, late

0.15

x

P(X = x|Y=on-time)

sun

0.20/0.45 = 0.444

rain

0.20/0.45 = 0.444

snow

0.05/0.45 = 0.111

joint distribution

conditional distribution for X

given Y=on-time

16 of 56

Independence

  • Two random variables, X and Y, are independent if

  • Another way to think about this is knowing X does not tell us anything about Y 

17 of 56

Independence example #1

x, y

P(X = x, Y = y)

sun, on-time

0.20

rain, on-time

0.20

snow, on-time

0.05

sun, late

0.10

rain, late

0.30

snow, late

0.15

x

P(X = x)

sun

0.3

rain

0.5

snow

0.2

joint distribution

marginal distributions

y

P(Y = y)

on-time

0.45

late

0.55

Are X and Y independent here?

18 of 56

Independence example #1

x, y

P(X = x, Y = y)

sun, on-time

0.20

rain, on-time

0.20

snow, on-time

0.05

sun, late

0.10

rain, late

0.30

snow, late

0.15

x

P(X = x)

sun

0.3

rain

0.5

snow

0.2

joint distribution

marginal distributions

y

P(Y = y)

on-time

0.45

late

0.55

Are X and Y independent here?

NO.

19 of 56

Independence example #2

x, y

P(X = x, Y = y)

sun, fly-United

0.27

rain, fly-United

0.45

snow, fly-United

0.18

sun, fly-Northwest

0.03

rain, fly-Northwest

0.05

snow, fly-Northwest

0.02

x

P(X = x)

sun

0.3

rain

0.5

snow

0.2

joint distribution

marginal distributions

y

P(Y = y)

fly-United

0.9

fly-Northwest

0.1

Are X and Y independent here?

20 of 56

Independence example #2

x, y

P(X = x, Y = y)

sun, fly-United

0.27

rain, fly-United

0.45

snow, fly-United

0.18

sun, fly-Northwest

0.03

rain, fly-Northwest

0.05

snow, fly-Northwest

0.02

x

P(X = x)

sun

0.3

rain

0.5

snow

0.2

joint distribution

marginal distributions

y

P(Y = y)

fly-United

0.9

fly-Northwest

0.1

Are X and Y independent here?

YES.

21 of 56

Conditional independence

  • Two random variables X and Y are conditionally independent given Z if 

“once you know the value of Z, knowing Y doesn’t tell you anything about X

  • Alternatively

22 of 56

Conditional independence example

Flu

Fever

Headache

P

true

true

true

0.04

true

true

false

0.04

true

false

true

0.01

true

false

false

0.01

false

true

true

0.009

false

true

false

0.081

false

false

true

0.081

false

false

false

0.729

Are Fever and Headache independent?

23 of 56

Conditional independence example

Flu

Fever

Headache

P

true

true

true

0.04

true

true

false

0.04

true

false

true

0.01

true

false

false

0.01

false

true

true

0.009

false

true

false

0.081

false

false

true

0.081

false

false

false

0.729

Are Fever and Headache independent?

NO.

24 of 56

Conditional independence example

Flu

Fever

Headache

P

true

true

true

0.04

true

true

false

0.04

true

false

true

0.01

true

false

false

0.01

false

true

true

0.009

false

true

false

0.081

false

false

true

0.081

false

false

false

0.729

Are Fever and Headache conditionally independent given Flu:

25 of 56

Conditional independence example

Flu

Fever

Headache

P

true

true

true

0.04

true

true

false

0.04

true

false

true

0.01

true

false

false

0.01

false

true

true

0.009

false

true

false

0.081

false

false

true

0.081

false

false

false

0.729

Are Fever and Headache conditionally independent given Flu:

YES.

26 of 56

Chain rule of probability

  • For two variables

  • For three variables

etc.

  • to see that this is true, note that

27 of 56

Common probability distributions

  • Probability Distribution Explorer

28 of 56

Example discrete distributions

  • Binomial distribution

  • Multinomial distribution

29 of 56

The binomial distribution

  • Two outcomes per trial of an experiment
  • Distribution over the number of successes in a fixed number n of independent trials (with same probability of success p in each)

  • e.g. the probability of x heads in n coin flips

P(X=x)

p=0.5

p=0.1

x

x

P(X=x)

30 of 56

The multinomial distribution

 

31 of 56

Continuous random variables

  • When our outcome is a continuous number we need a continuous random variable
  • Examples: Weight, Height
  • We specify a density function for random variable X as

  • Probabilities are specified over an interval

  • Probability of taking on a single value is 0

32 of 56

Continuous random variables

  • To define a probability distribution for a continuous variable, we need to integrate f(x)

33 of 56

Example continuous distributions

  • Uniform distribution

  • Gaussian distribution

34 of 56

Uniform distribution

  •  

a

b

 

x

 

Adapted from Wikipedia

35 of 56

Gaussian Distribution

  •  

From Wikipedia: Normal distribution, https://en.wikipedia.org/wiki/Normal_distribution

36 of 56

Bayes rule

Posterior

Prior

Data likelihood

Marginal likelihood

  • This allows us to incorporate evidence to inform our prior belief about a particular variable
  • Sometimes it is easier to compute P(B|A). Bayes rule can be used to compute P(A|B).

37 of 56

Example of using Bayes rule

  • It is harder to estimate P(Disease|Symptom) than P(Symptom|Disease)
  • If we can have P(Symptom|Disease) and P(Disease), we can estimate P(Disease|Symptom)

Disease

Symptom

38 of 56

Goals for today

  • Introductory concepts in probability and statistics
  • Introduction to probabilistic graphical models: Bayesian networks

39 of 56

Probabilistic graphical models (PGMs)

  • Combines probability and graph theory
  • Nodes on the graph represent random variables
  • Graph structure specifies statistical dependency structure
  • Graph parameters specify the nature of the dependency
  • PGMs can be directed or undirected
  • Examples of PGMs: Bayesian networks, Dependency networks, Markov networks, Factor graphs

40 of 56

Different types of probabilistic graphs

  • Correlation networks
  • Gaussian Graphical models
  • Dependency networks
  • Bayesian networks

In each graph type we can assert different conditional independencies

41 of 56

Conditional independencies in PGMs

  • The different classes of models we will see are based on a general notion of specifying statistical independence
  • Suppose we have two genes X and Y. We add an edge between X and Y if X and Y are not independent given a third set Z.
  • Depending upon Z we will have a family of different PGMs

42 of 56

Conditional independence and PGMs

  • Correlational networks
    • Z is the empty set
  • Markov networks
    • X and Y are not independent given all other variables
    • Gaussian Graphical models are a special case (later lectures)
  • Dependency networks
    • Approximate Markov networks
    • May not be associated with a valid joint distribution (later lectures)
  • First-order conditional independence models
    • Explain the correlation between two variables by a third variable
  • Bayesian networks
    • Generalize first-order conditional independence models

43 of 56

Bayesian networks (BN)

  • A special type of probabilistic graphical model
  • Has two parts:
    • A graph which is directed and acyclic
    • A set of conditional distributions
  • Directed Acyclic Graph (DAG)
    • The nodes denote random variables X1… XN
    • The edges
      • encode statistical dependencies between the random variables
      • establish parent child relationships
    • Each node Xi has a conditional probability distribution (CPD) representing P(Xi | Pa(Xi)); Pa: Parents
  • Provides a tractable way to represent large joint distributions

44 of 56

Bayesian networks compactly represent joint distributions

45 of 56

An example Bayesian network

Adapted from Kevin Murphy: Intro to Graphical models and Bayes networks: http://www.cs.ubc.ca/~murphyk/Bayes/bnintro.html

Cloudy (C)

Rain (R)

Sprinkler (S)

WetGrass (W)

P(C=f) P(C=t)

0.5 0.5

P(R=f) P(R=t)

0.8 0.2

t

0.2 0.8

P(S=f) P(S=t)

0.5 0.5

f

t

0.9 0.1

P(W=f) P(W=t)

1 0

f f

t f

0.1 0.9

C

f t

t t

0.1 0.9

0.01 0.99

C

f

S R

46 of 56

Compute probabilities using a Bayesian network

What is

P(C=f) P(C=t)

0.5 0.5

P(S=f) P(S=t)

0.5 0.5

f

t

0.9 0.1

C

P(R=f) P(R=t)

0.8 0.2

t

0.2 0.8

C

f

P(W=f) P(W=t)

1 0

f f

t f

0.1 0.9

f t

t t

0.1 0.9

0.01 0.99

S R

C

R

S

W

47 of 56

Compute probabilities using a Bayesian network

What is

P(C=f) P(C=t)

0.5 0.5

P(S=f) P(S=t)

0.5 0.5

f

t

0.9 0.1

C

P(R=f) P(R=t)

0.8 0.2

t

0.2 0.8

C

f

P(W=f) P(W=t)

1 0

f f

t f

0.1 0.9

f t

t t

0.1 0.9

0.01 0.99

S R

C

R

S

W

Bayes net allows us to write

48 of 56

Compute probabilities using a Bayesian network

What is

P(C=f) P(C=t)

0.5 0.5

P(S=f) P(S=t)

0.5 0.5

f

t

0.9 0.1

C

P(R=f) P(R=t)

0.8 0.2

t

0.2 0.8

C

f

P(W=f) P(W=t)

1 0

f f

t f

0.1 0.9

f t

t t

0.1 0.9

0.01 0.99

S R

C

R

S

W

Bayes net allows us to write

Plugging in the assignments for the variables:

49 of 56

Compute probabilities using a Bayesian network

What is

P(C=f) P(C=t)

0.5 0.5

P(S=f) P(S=t)

0.5 0.5

f

t

0.9 0.1

C

P(R=f) P(R=t)

0.8 0.2

t

0.2 0.8

C

f

P(W=f) P(W=t)

1 0

f f

t f

0.1 0.9

f t

t t

0.1 0.9

0.01 0.99

S R

C

R

S

W

Bayes net allows us to write

0.9*0.5*0.2*0.5

Looking up in the CPD

=0.045

Plugging in the assignments for the variables:

50 of 56

Learning problems in Bayesian networks

  • Given a Bayesian network B={G, Θ}
  • Parameter learning
    • Known graph structure G
    • Given a set of joint assignments of the random variables, estimate Θ, the parameters of the CPDs
  • Structure learning
    • Given a set of joint assignments of the random variables, estimate the graph structure, G and parameters Θ
  • Structure learning subsumes parameter learning

51 of 56

Estimating CPD from data

C

R

S

W

Supposed we had the following structure

t

f

t

t

t

t

f

t

t

t

f

t

f

f

t

t

f

f

t

f

f

t

f

f

f

f

t

f

C

S

R

W

And these observations for each variable

P(R=f) P(R=t)

? ?

f

t

? ?

C

52 of 56

Estimating CPD from data

C

R

S

W

Supposed we had the following structure

t

f

t

t

t

t

f

t

t

t

f

t

f

f

t

t

f

f

t

f

f

t

f

f

f

f

t

f

C

S

R

W

And these observations for each variable

P(R=f) P(R=t)

? ?

f

t

? ?

C

P(R=f|C=t)?

=2/3

Parameters estimated in this way would be called the Maximum Likelihood (ML) parameters

We could put priors on the parameters and estimate a more robust set of parameters

53 of 56

Estimating CPD from data

C

R

S

W

Supposed we had the following structure

t

f

t

t

t

t

f

t

t

t

f

t

f

f

t

t

f

f

t

f

f

t

f

f

f

f

t

f

C

S

R

W

And these observations for each variable

P(W=f) P(W=t)

f f

t f

f t

t t

S R

? ?

? ?

? ?

? ?

P(S=f) P(S=t)

? ?

f

t

? ?

C

P(W=t|S=t,R=f)?

54 of 56

Estimating CPD from data

C

R

S

W

Supposed we had the following structure

t

f

t

t

t

t

f

t

t

t

f

t

f

f

t

t

f

f

t

f

f

t

f

f

f

f

t

f

C

S

R

W

And these observations for each variable

P(W=f) P(W=t)

f f

t f

f t

t t

S R

? ?

? ?

? ?

? ?

=2/3

P(S=f) P(S=t)

? ?

f

t

? ?

C

P(W=t|S=t,R=f)?

55 of 56

Plan for next lectures

  • Representing regulatory networks as probabilistic graphical models
    • Bayesian networks
    • Module networks
    • Dependency networks
  • Expression-based network inference
    • Classes of methods
    • Strengths and weaknesses of different methods

56 of 56

References

  • Chapter 2 from Probabilistic Graphical Models. Principles and Techniques. Friedman & Koller
  • Slides adapted from Prof. Mark Craven’s lectures
  • Markowetz, Florian and Rainer Spang. "Inferring cellular networks-a review." BMC bioinformatics 8 Suppl 6 (2007): S5+.
  • https://www.cs.ubc.ca/~murphyk/Bayes/bnintro.html
  • All of Statistics, Larry Wasserman.
  • Chapter 3, The Elements of Statistical Learning, Hastie, Tibshirani, Friedman
  • Probability Distribution Explorer https://distribution-explorer.github.io/