





























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






























introduction)
Lecture 12: Bayesian Inference (a very brief introduction) Review – Bayes’ Rule Example – Medical Test Theory – Posterior Distribution Example – Apples in a Frequentist’s Bag Maximum Likelihood Estimate Maximum A Posteriori Estimate Example – Apples in a Bayesian’s Bag More continuous distributions Binomial likelihood with Beta prior Bayesian vs Frequentist Example – Kevin’s IQ Credible Interval Normal likelihood with Normal prior
1 (^2 ) (^10) B
3 10 A B
For two events A and B, calculate the following: I (^) P (A) = (^35) I (^) P (B) = (^25) I (^) P (A|B) = (^14) I (^) P (B|A) = (^16) Note: P (A\B) = 12 , P (B\A) = 103 and P (A and B) = 101.
For two events A and B, P (A|B) = P (B|A)
1 (^2 ) (^10) B
3 10 A B
I (^) And 14 = 16 × 64 //^1010 In words: the conditional probability of A given B is the conditional probability of B given A scaled by the relative probability of A compared to B.
The probability of a certain medical test being positive (+) is 90% if a patient has a disease, D. 1% of the population have the disease, and the test records a false positive 5% of the time. If a patient has a positive test result, what is the probability the patient has the disease? P (+|D) = 0. 9 , P (D) = 0. 01 , P (+| D¯) = 0. 05 , we want P (D|+)
Substituting in the numbers: P (D|+) = 0. 153846. So in fact there is a high chance that a positive result is a false alarm.
Suppose the patient takes the same test again and the result is again positive. What is the revised probability that the patient has the disease?
Assume that parameter(s) θ describe (part of) the distribution of the data. Then by Bayes’ rule:
P (θ|) =
P (|θ)P (θ) P ()
where I (^) P (θ) is called the prior probability; I (^) P (|θ) is called the likelihood (or sampling distribution); I (^) P (θ|) is called the posterior probability; I (^) P () is the normalising constant. Note that P () is a constant in the equation above so as a consequence, we may only need the prior distribution and the likelihood and use
P (θ|) ∝ P (|θ)P (θ).
There are four steps involved:
Image: Wikimedia Commons CC BY-SA 3.
I (^) So far the majority of what you have been learning in this course is the frequentist approach to statistical inference. I (^) Frequentist approach was popularised by Fisher, Neyman and Pearson in the early 20th century. I (^) Bayesian approach uses the rule/theorem by Thomas Bayes at its foundation. I (^) Bayesian inference, unlike Frequentist inference, makes distributional assumptions on the parameters.
Ronald Fisher’s Image: Wikimedia Commons CC BY 2.0 (^) 13/
A Bayesian is one who, vaguely expecting a horse, and catching a glimpse of a donkey, strongly believes he has seen a mule.
If [Bayesians] would only do as [Bayes] did and publish posthumously we should all be saved a lot of trouble.
The only good statistics is Bayesian Statistics
The probability that I draw one apple from the four samples (with replacement) given there is equal probability p of drawing an apple is given in the plot below. p = seq(0, 1, 0.01) plot(p, dbinom(1, 4, p), ylab = "Probability", type = "l") abline(v = 0.25, col = "red")
0.0 0.2 0.4 0.6 0.8 1.
p
Probability
This curve is the likelihood function L(p|) = P (|p). (^) 16/
I (^) An estimate of pˆ = 0. 25 seems good. I (^) This is in fact called the maximum likelihood (ML) estimate (we will not cover this in-depth for this course). I (^) Formally,
θ^ ˆML = arg max θ
L(θ|) = arg max θ
f (|θ).
where θ is the parameter(s) and X is the data, as before. I (^) Here pˆML = 0. 25. I (^) A possible estimate of the number of apples in the bag is N pˆML = 12 × 0 .25 = 3. I (^) ML estimate is a frequentist approach.
Now suppose that Ellis has a bag of N = 12 pieces of fruit. I know he likes apples and would eat at least 6 apples a day. Suppose I draw a fruit from his bag (with permission!), record what it is, put it back in his bag. I repeat this 4 times and (again) have in my record 1 apple and 3 oranges. How many apples are in Ellis’s bag?
I (^) The ML estimate will be 3 apples as before. I (^) Because I don’t think Ellis will have less than 6 apples, I may assume a prior distribution p ∼ U ( 126 = 0. 5 , 1), i.e. f (p) = 1/ 0 .5 = 2 for 0. 5 < p < 1 (otherwise f (p) = 0).
f (p|X = 1) = f (X|p)f (p) f (X)
{ (^) f (X|p)· 2 f (X) ∝^ f^ (X|p)^0.^5 < p <^1 0 otherwise
I (^) The likelihood function is monotonically decreasing for 0. 5 < p < 1 , so here p ˆMAP = 0. 5 and therefore we estimate N pˆMAP = 6 apples in Ellis’s bag.