Bayes For Beginners: Luca Chech and Jolanda Malamud Supervisor: Thomas Parr 13 February 2019
Bayes For Beginners: Luca Chech and Jolanda Malamud Supervisor: Thomas Parr 13 February 2019
𝑃𝑀𝐹 ( 𝑋 )=1
∑ X P(X)
𝑋
1.8 m 0
1/100
P given by the area
1 2 … 100
X 1 .75 ≤ 𝑋 ≤ 1 .85
Probability
• Probability of A occurring: P(A)
0 0.5 0.1
Y 𝑃
( 𝑌 =1 )=0 . 1+0 .3=0 . 4
1 0.1 0.3
𝑃
( 𝑋=0 )=0 .1+0 . 5=0 .6
𝑃 ( 𝑋=𝑥 ) = ∑ 𝑃( 𝑋=𝑥 ,𝑌 = 𝑦 )
𝑦
Conditional probability
What is the probability of A occurring, given that B has occurred?
Probability of A given B?
Conditional Probability
joint probability : 𝑃
( 𝑋=0
𝑋= 0,𝑌
,𝑌 =1
=1)) =0.1
disease
x Conditional probability:
0 1 (( 𝑋
𝑃 0.3
0.3 3
𝑃 𝑋== 1|𝑌 =1 )
𝑋=1 𝑌 =1 ))=0.3 = =
symptoms
0.1+0.3
0.1+0.3 4
0 0.5 0.1
Y 0.1 1
1 0.1 0.3 𝑃 ((𝑋=
𝑃 𝑋=
𝑋=00
0|𝑌 =1
=1 )) =
=0.1 =
0.1+0.3
0.1+0.3 4
P(X|Y)=
Conditional probability: Example
(𝐶)= 1
𝑃 ( 𝑁𝐶 ) = 99
𝑃 (+ ¿𝐶 ) = 90
𝑃 (+ ¿ 𝑁𝐶 )= 8
𝑃
100 100 100 100
𝑃 ¿
𝑃 (+ ,𝐶 )
𝑃
𝑃¿¿
𝑃¿
𝑃
𝑃
((+¿𝐶 )=
+ ¿𝐶) =¿ 𝑃 ¿
𝑃 (𝐶 )
¿ ∑ ,+¿)¿( 𝑋 ,+¿)= 𝑃 ¿ ¿
𝑃(𝑋 𝑃
𝑃 ∑
𝑥 𝑥
𝑃(+ , 𝑁𝐶 ) (+ 8 99 792
𝑃 (+ ¿ 𝑁𝐶 )= 𝑃
+,,𝑁𝐶
𝑁𝐶)=𝑃 ( +¿𝑁𝐶
)=𝑃(+¿ ) ×𝑃(
𝑁𝐶)× 𝑃 𝑁𝐶
( 𝑁𝐶) )= × =
𝑃(𝑁𝐶 ) 100 100 10000
Conditional probability: Example
(𝐶)= 1
𝑃 ( 𝑁𝐶 ) = 99
𝑃 (+ ¿𝐶 ) = 90
𝑃 (+ ¿ 𝑁𝐶 )= 8
𝑃
100 100 100 100
𝑃 ¿
𝑃 ¿
Derivation of Bayes’ theorem
Bayes’ theorem
𝑃 (𝐵∨ 𝐴)× 𝑃( 𝐴)
𝑃 ( 𝐴|𝐵 ) =
𝑃 (𝐵)
𝑃𝑃(𝐴
(𝐴∩𝐵)
∩𝐵) 𝑃(𝐵∨𝐴 )× 𝑃 (𝐴 )
1 𝑃 ( 𝐴𝐴||𝐵𝐵) )=
= =
𝑃(𝐵)
𝑃(𝐵) 𝑃(𝐵)
( 𝐵| 𝐴 ) = ∩ 𝐴)
𝑃 (𝐵 ∩ 𝐴) 𝑃( 𝐴 ∩ 𝐵)
2 𝑃 =
𝑃( 𝐴)
𝐴) 𝑃( 𝐴)
𝑃
( 𝐴 ∩ 𝐵 )=𝑃 ( 𝐵| 𝐴 ) × 𝑃( 𝐴)
Bayes’ theorem, alternative form
𝑃 (𝐵∨ 𝐴)× 𝑃( 𝐴)
𝑃 ( 𝐴|𝐵 ) =
𝑃 (𝐵)
Bayes’ theorem problems
Example 1
10% of patients in a clinic have liver disease. Five percent of the clinic’s patients are alcoholics.
Amongst those patients diagnosed with liver disease, 7% are alcoholics. You are interested in knowing
the probability of a patient having liver disease, given that he is an alcoholic.
P(A) = probability of liver disease = 0.10
P(B) = probability of alcoholism = 0.05
P(B|A) = 0.07
P(A|B) = ?
In other words, if the patient is an alcoholic, their chances of having liver disease is 0.14 (14%)
Example 2
A disease occurs in 0.5% of the population
A diagnostic test gives a positive result in:
◦ 99% of people with the disease
◦ 5% of people without the disease (false positive)
We know:
= 0.99
= 0.005
= ???
Where:
chance of having the disease
chance of not having the disease
Remember:
chance of positive test given that disease is present
chance of positive test given that the disease isn’t present
Therefore:
Frequentist vs. Bayesian statistics
Frequentist models in practice
• Model:
• We assume there is a true set of parameters, or true model of the world, and we
are concerned with getting the best possible estimate
Prior distribution
• Observation of data
Measurement data D
Model evidence
Priors
Priors can be of different sorts, e.g.
• empirical (previous data)
• uninformed
• principled (e.g. positivity constraints)
• shrinkage
• 2nd Hypothesis: Both sides of the coin are heads, 100% Heads
Example: Coin flipping model
• 1st Hypothesis: Coin is fair, 50% Heads or Tails
• 2nd Hypothesis: Both sides of the coin are heads, 100% Heads
Example: Coin flipping model
•
Example: Coin flipping model
•
Example: Coin flipping model
•
0.1
Example: Coin flipping model
and we think a priori that the coin is fair: