# 1.2 Conditional probabilities and bayes' rule

 Page 1 / 1
This module introduces conditional probabilities and Bayes' rule.

If $A$ and $B$ are two separate but possibly dependent random events, then:

• Probability of $A$ and $B$ occurring together = $(,(A, B))$
• The conditional probability of $A$ , given that $B$ occurs = $(B, A)$
• The conditional probability of $B$ , given that $A$ occurs = $(A, B)$
From elementary rules of probability (Venn diagrams):
$(,(A, B))=(B, A)(B)=(A, B)(A)$
Dividing the right-hand pair of expressions by $(B)$ gives Bayes' rule:
$(B, A)=\frac{(A, B)(A)}{(B)}$
In problems of probabilistic inference, we are often trying to estimate the most probable underlying model for a randomprocess, based on some observed data or evidence. If $A$ represents a given set of model parameters, and $B$ represents the set of observed data values, then the terms in are given the following terminology:
• $(A)$ is the prior probability of the model $A$ (in the absence of any evidence);
• $(B)$ is the probability of the evidence $B$ ;
• $(A, B)$ is the likelihood that the evidence $B$ was produced, given that the model was $A$ ;
• $(B, A)$ is the posterior probability of the model being $A$ , given that the evidence is $B$ .
Quite often, we try to find the model $A$ which maximizes the posterior $(B, A)$ . This is known as maximum a posteriori or MAP model selection.

The following example illustrates the concepts of Bayesian model selection.

Problem:

Given a tub containing 100 six-sided dice, in which one die is known to be loaded towards the six to a specified extent,derive an expression for the probability that, after a given set of throws, an arbitrarily chosen die is the loaded one?Assume the other 99 dice are all fair (not loaded in any way). The loaded die is known to have the following pmf: ${p}_{L}(1)=0.05$ $\{{p}_{L}(2), \dots , {p}_{L}(5)\}=0.15$ ${p}_{L}(6)=0.35$ Here derive a good strategy for finding the loaded die from the tub.

Solution:

The pmfs of the fair dice may be assumed to be: $\forall i, i=\{1, \dots , 6\}\colon {p}_{F}(i)=\frac{1}{6}$ Let each die have one of two states, $S=L$ if it is loaded and $S=F$ if it is fair. These are our two possible models for the random process and they have underlying pmfs given by $\{{p}_{L}(1), \dots , {p}_{L}(6)\}$ and $\{{p}_{F}(1), \dots , {p}_{F}(6)\}$ respectively.

After $N$ throws of the chosen die, let the sequence of throws be ${\Theta }_{N}=\{{\theta }_{1}, \dots , {\theta }_{N}\}$ , where each ${\theta }_{i}\in \{1, \dots , 6\}$ . This is our evidence .

We shall now calculate the probability that this die is the loaded one. We therefore wish to find the posterior $({\Theta }_{N}, S=L)$ .

We cannot evaluate this directly, but we can evaluate the likelihoods , $(S=L, {\Theta }_{N})$ and $(S=F, {\Theta }_{N})$ , since we know the expected pmfs in each case. We also know the prior probabilities $(S=L)$ and $(S=F)$ before we have carried out any throws, and these are $\{0.01, 0.99\}$ since only one die in the tub of 100 is loaded. Hence we can use Bayes' rule:

$({\Theta }_{N}, S=L)=\frac{(S=L, {\Theta }_{N})(S=L)}{({\Theta }_{N})}$
The denominator term $({\Theta }_{N})$ is there to ensure that $({\Theta }_{N}, S=L)$ and $({\Theta }_{N}, S=F)$ sum to unity (as they must). It can most easily be calculated from:
$({\Theta }_{N})=(,({\Theta }_{N}, S=L))+(,({\Theta }_{N}, S=F))=(S=L, {\Theta }_{N})(S=L)+(S=F, {\Theta }_{N})(S=F)$
so that
$({\Theta }_{N}, S=L)=\frac{(S=L, {\Theta }_{N})(S=L)}{(S=L, {\Theta }_{N})(S=L)+(S=F, {\Theta }_{N})(S=F)}=\frac{1}{1+{R}_{N}}$
where
${R}_{N}=\frac{(S=F, {\Theta }_{N})(S=F)}{(S=L, {\Theta }_{N})(S=L)}$
To calculate the likelihoods, $(S=L, {\Theta }_{N})$ and $(S=F, {\Theta }_{N})$ , we simply take the product of the probabilities of each throw occurring in the sequence of throws ${\Theta }_{N}$ , given each of the two modules respectively (since each new throw is independent of all previous throws, giventhe model). So, after $N$ throws, these likelihoods will be given by:
$(S=L, {\Theta }_{N})=\prod_{i=1}^{N} {p}_{L}({\theta }_{i})$
and
$(S=F, {\Theta }_{N})=\prod_{i=1}^{N} {p}_{F}({\theta }_{i})$
We can now substitute these probabilities into the above expression for ${R}_{N}$ and include $(S=L)=0.01$ and $(S=F)=0.99$ to get the desired a posteriori probability $({\Theta }_{N}, S=L)$ after $N$ throws using .

We may calculate this iteratively by noting that

$(S=L, {\Theta }_{N})=(S=L, {\Theta }_{N-1}){p}_{L}({\theta }_{n})$
and
$(S=F, {\Theta }_{N})=(S=F, {\Theta }_{N-1}){p}_{F}({\theta }_{n})$
so that
${R}_{N}={R}_{N-1}\frac{{p}_{F}({\theta }_{n})}{\frac{{p}_{L}({\theta }_{n})}{}}$
where ${R}_{0}=\frac{(S=F)}{(S=L)}=99$ . If we calculate this after every throw of the current die being tested (i.e. as $N$ increases), then we can either move on to test the next die from the tub if $({\Theta }_{N}, S=L)$ becomes sufficiently small (say $<(10^{-4})$ ) or accept the current die as the loaded one when $({\Theta }_{N}, S=L)$ becomes large enough (say $>(0.995)$ ). (These thresholds correspond approximately to ${R}_{N}> 10^{4}$ and ${R}_{N}< 5E-3$ respectively.)

The choice of these thresholds for $({\Theta }_{N}, S=L)$ is a function of the desired tradeoff between speed of searching versus the probability of failure to findthe loaded die, either by moving on to the next die even when the current one is loaded, or by selecting a fair dieas the loaded one.

The lower threshold, ${p}_{1}=10^{-4}$ , is the more critical, because it affects how long we spend before discarding each fair die. The probability ofcorrectly detecting all the fair dice before the loaded die is reached is $(1-{p}_{1})^{n}\approx 1-n{p}_{1}$ , where $n\approx 50$ is the expected number of fair dice tested before the loaded one is found. So the failure probability due toincorrectly assuming the loaded die to be fair is approximately $n{p}_{1}\approx 0.005$ .

The upper threshold, ${p}_{2}=0.995$ , is much less critical on search speed, since the loaded result only occurs once, so it is a good idea to set it very close to unity. The failureprobability caused by selecting a fair die to be the loaded one is just $1-{p}_{2}=0.005$ . Hence the

In problems with significant amounts of evidence (e.g. large $N$ ), the evidence probability and the likelihoods can both get very very small, sufficientto cause floating-point underflow on many computers if equations such as and are computed directly. However the ratio of likelihood to evidenceprobability still remains a reasonable size and is an important quantity which must be calculatedcorrectly.

One solution to this problem is to compute only the ratio of likelihoods, as in . A more generally useful solution is to computelog(likelihoods) instead. The product operations in the expressions for the likelihoods then become sums oflogarithms. Even the calculation of likelihood ratios such as ${R}_{N}$ and comparison with appropriate thresholds can be done in the log domain. After this, it is OK to return tothe linear domain if necessary since ${R}_{N}$ should be a reasonable value as it is the ratio of very small quantities.

#### Questions & Answers

I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
what does nano mean?
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
How can I make nanorobot?
Lily
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!