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
Goals for today
RECAP from last time
Goals for today
A few key concepts
Definition of probability
0 means “never occurs”
1 means “always occurs”
Sample space
{rain, not rain} or
{sun, rain, snow} or
{sun, clouds, rain, snow, sleet}
Random variables
Notation
Discrete probability distributions
sun
clouds
rain
snow
sleet
0.2
0.3
0.1
Joint probability distributions
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
Marginal probability distributions
“the distribution of X ignoring other variables”
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
Conditional distributions
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
Independence
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?
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.
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?
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.
Conditional independence
“once you know the value of Z, knowing Y doesn’t tell you anything about X ”
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?
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.
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:
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.
Chain rule of probability
etc.
Common probability distributions
Example discrete distributions
The binomial distribution
P(X=x)
p=0.5
p=0.1
x
x
P(X=x)
The multinomial distribution
Continuous random variables
Continuous random variables
Example continuous distributions
Uniform distribution
a
b
x
Adapted from Wikipedia
Gaussian Distribution
From Wikipedia: Normal distribution, https://en.wikipedia.org/wiki/Normal_distribution
Bayes rule
Posterior
Prior
Data likelihood
Marginal likelihood
Example of using Bayes rule
Disease
Symptom
Goals for today
Probabilistic graphical models (PGMs)
Different types of probabilistic graphs
In each graph type we can assert different conditional independencies
Conditional independencies in PGMs
Conditional independence and PGMs
Bayesian networks (BN)
Bayesian networks compactly represent joint distributions
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
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
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
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:
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:
Learning problems in Bayesian networks
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
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
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)?
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)?
Plan for next lectures
References