Bayesian
todo
- model comparison
- ch7, 9, 13(power analysis and sample size) + beta distributions
- sec 23.1
Probability, the frequency of the event occurring
- join probability
- marginal probability
. -
conditional probability
- tell the relation between two different, but related conditionals
the joint probability of the two events over marginal probability of the conditioned- take
and multiply it by => - respectively
- equate the two alternative representations of the joint
=> - divide by
=>
- conditional probability with many events
- where,
- and
- tell the relation between two different, but related conditionals
From prior to updated posterior belief
- Let’s say there is a hypothesis
and some data to support/oppose it.- The prior (prevalence)
the strength of our belief in without the data . - The posterior (precision)
is the strength of our belief in when tha data is taken into account. - The likelihood (sensitivity, power)
is the probability that the data could be generated by the model with param values . - The evidence (marginal likelihood)
is the probability of the data according to the model, determined by summing across all possible param values weighted by the strength of belief in those param values. - This is a relation between the prior/subjective belief (the expert opinion on the hypothesis)
and the posterior/updated belief once there is some data to consider.
- The prior (prevalence)
-
Posterior with two independent events:
- since
and are independent events => - the denominator requires attention too:
- since
Tables
- notes True/False Positive/Negative here refers to the test result (e.g. False Negative means that the test have been incorrectly negative (should have been positive, and that a sick person without disease have a negative test)
- LR+ Positive Likelihood ratio: How much the odds of having a disease increase when test is positive
- LR- Negative Likelihood ratio: How much the odds of not having a disease increase when test is negative
- Power of a binary hypothesis is the probability that a test correctly rejects the
when a specific is true = .
Examples
- Example with a disease with
and . What is the of having a disease when the test is positive (what is the Precision) given that TP rate (Sensitivity) is 0.99, FP rate (Type I error)= 0.09 and Prevalence is 0.02?
test \ disease | marginal |
||
---|---|---|---|
Y = positive |
0.99* 0198 0.0198 |
0.09** 0882 0.0882 |
—- 1080 0.1080 |
Y = negative |
0.01 0002 0.0002 |
0.91 8918 0.8918 |
—- 8920 0.8920 |
marginal |
1.00 0200 0.02*** |
1.00 9800 0.98 |
—- 10000 1.00 |
- * likelihood
= // True Positive Rate - **
= // False Positive Rate - *** prior belief
- evidence
= $(0.990.02) + (0.090.98) = 0.1080$ - posterior
= -
conditional
= - Example with coin flipping: prior belief of getting heads is 0.5 half the time (50%) with chances of skewness (0.25 and 0.75) the other half of the time(25% of the time it is 0.25, and 25% of the time it is 0.75); testing data shows 3 heads out of 12 flips; => what is the probability of getting a head on a given flip?
- prior is
half the time, and the other half of the time. - Note: for those beliefs, the predicted probability for heads is (using the evidence formula):
- $= (0.250.25)+(0.50.5)+(0.25*0.75) = 0.5$
- Note: for those beliefs, the predicted probability for heads is (using the evidence formula):
- likelihood is
- for
the likelihood is - for
the likelihood is - for
the likelihood is
- for
- evidence is
// sum of all joint probabilities- $= (0.00120.25)+(0.00020.5)+(1.60933E-06*0.75) = 0.000417$
- posterior is:
- for
the posterior is - for
the posterior is - for
the posterior is
- for
- prior is
Bibliography
- Kruschke - Doing Bayesian data analysis - 2010
- based on Kruschke:
- http://tinyheero.github.io/2016/03/20/basic-prob.html
- http://tinyheero.github.io/2016/04/21/bayes-rule.html
- http://tinyheero.github.io/2017/03/08/how-to-bayesian-infer-101.html
- https://commons.wikimedia.org/wiki/File:Preventive_Medicine_Statistics_Sensitivity_TPR,_Specificity_TNR,_PPV,_NPV,_FDR,_FOR,_ACCuracy,_Likelihood_Ratio,_Diagnostic_Odds_Ratio_2_Final.png
- https://eli.thegreenplace.net/2018/conditional-probability-and-bayes-theorem/