You are on page 1of 49

Sfm 2003 biostatistics

lecture 4: probability

Dr. Ellie Teo, JSAK


outcome

At the end of this lecture, you should be able to

• Apply the rules of probability


• Construct tree diagrams
• Apply Bayes’ theorem
Introduction- what is probability
what is probability

How likely something is to happen

Many events can’t be predicted with total certainty. The best way we can
say is how likely they are to happen.
examples
CASE 1: Tossing a coin CASE 2: Throwing a dice

• When a coin is tossed, how many • When a dice is tossed, how many possible
possible outcomes are there? outcomes are there?
Two possible outcomes  Heads (H) Six possible outcomes
 Tail (T) 1, 2, 3, 4, 5, 6
Probability of coin landing on H? 1/2 Probability of any one of the outcome?
Probability of coin landing on T? 1/2
1/6
Probability
In general:
  𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑤𝑎𝑦𝑠 𝑖𝑡 𝑐𝑎𝑛 h𝑎𝑝𝑝𝑒𝑛
𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑜𝑓 𝑎𝑛 𝑒𝑣𝑒𝑛𝑡 h𝑎𝑝𝑝𝑒𝑛𝑖𝑛𝑔 =
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑜𝑢𝑡𝑐𝑜𝑚𝑒𝑠

Example

There are 5 marbles in a bag: 4 are blue and 1 is red. What is the probability that a
blue marble gets picked?

Number of ways it can happen: 4 (there are 4 blues)


  4
Total number of outcomes: 5 (there are 5 marbles 𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦=
5
in total)
Basis of probability
Definitions

• Sample space S is the possible outcomes


If we toss a coin, possible outcome is either head (H) or tail (T), so sample
is {H,T} and sample size is 2.

• An event A is a set of outcome or a subset of the sample space.


If P (A) denotes the probability of an event A occurring, then
P(A´) denotes probability that A will not occur.
• Probability is always between 0 and 1.

• The sum of all probabilities of all elementary events E1, E2, E3, …..for
an experiment is always 1.
 1)+ 2)+ 3)+…….=1
Probability of an event
Concept of probability
• Probability of an event is the numerical measure of likelihood that
an event occurs.
• There are three conceptual approaches to probability:
i) classical probability
ii) probability as relative frequency
iii) subjective probability
classical probability

• Probability based on situations where occurrence of outcomes are equally likely

• Probability of an event is equal to the number of outcomes favorable to the event


divided by total number of outcomes
Example
  A fair dice is rolled.

The sample space is S= {1, 2, 3, 4, 5, 6}


Total number of elements in S, denoted by n(S), is 6

Each score is equally likely to occur because the dice is fair.

Let E be the event that the score is greater than 4, then E= {5, 6}
The number of elements in the set E, n(E) = 2

Probability of an event E, P(E) = =

The probability that the score is greater than 4 in a roll of a fair dice is
probability as relative frequency

• When the outcomes of an experiment are not equally likely, the probability of
an event is taken as the proportion of times the outcomes favouring the event
occurs in the long run
EXAMPLE

In a large batch of manufactured products, tests conducted on a


sample of 100 items shows 2 are defective.

 Proportion of defective items

Probability of randomly selected item from the batch being defective is


approximately 0.02.
subjective probability

• Without objective information, the probability of an event is taken to


be the degree of belief that the event will occur
• A person has his/her own personal probability of almost any event
Properties of Probability
(a) 0 ≤ P(event) ≤ 1
• In words, this means that the probability of an event must be a
number between 0 and 1 (inclusive).
(b) P(impossible event) = 0
• In words: The probability of an impossible event is 0.
(c) P(certain event) = 1
• In words: The probability of an absolutely certain event is 1.
Types of event
Types of events
• Complementary Events
 Event A, complement of event A´
 A´ is the event that includes all the outcomes in the sample space that are not in A
 A and A´ are complementary events

  𝑃 ( 𝐴 ´ ) =1 − 𝑃 ( 𝐴 )
• Exhaustive Event
 Two or more events are said to be exhaustive if it is certain at least one of them
occurs
exhaustive events
• Sample space = S = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
• Let an event x = {1, 2, 3}
• Event y = {4, 5, 6}
• Event z = {7, 8, 9, 10}
• Event x, y, z are mutually exclusive events because;
• Xyz=ø
• Now check whether the events are exhaustive events or not?
• For this, take the union of all events;
• x  y  z = {1, 2, 3} u {4, 5, 6} u {7, 8, 9, 10} = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} = S
• Event x, y & z are exhaustive events, because they form a complete sample space
itself.
• Mutually Exclusive Events

 Two or more events are said to be mutually exclusive if at most one of them can
occur

 For example, there are 7 competitors in a race.

The event ‘athlete A’ wins the race Mutually exclusive events


because two athletes cannot
The event ‘athlete B’ wins the race both win the race
Simple probability & conditional
probability
Simple probability
Samples of conventionally grown food and organic food are checked to determine whether they
contain pesticides residues. The two way classification table below, also known as contingency table
shows the food type and pesticide status for 1000 samples of food items.

Present Absent
Conventional 720 270
organic 2 8

What is the probability of the food item selected does not contain pesticide residue?

  278
𝑃 ( 𝐴 )=
1000

This is an example of simple probability, where A denotes the event that the food item does not
contain pesticide residue.
CONDITIONAL PROBABILITY
What is the probability that the food item selected does not contain pesticide
residue, knowing that the selected food item is an organic food?
Conditional
probability
function   𝑃 (𝐴 ∩𝑂)
𝑃 ( 𝐴 |𝑂 ) =
𝑃 (𝑂 )
  8
¿
10

This is an example of conditional probability, where A|O denotes the event that
the food item does not contain pesticides residue, given that the selected food
item is an organic food.
The rule of Probability
Rule of addition-mutually exclusive events
 When events A and B cannot occur together, they are mutually exclusive
 Example: We have to travel to a place and there are only two choices, either by bus or by taxi
 In this case, it is not possible to go by bus and taxi at the same time.
 So, the events are mutually exclusive

Probability of Event A or
Venn Diagram Event B occurs is equal to
probability that Event A
occurs plus probability that
A B Event B occurs.

 P
example
There are 25 students in a class. Five of them scored A and 10 of them scored B while the others
scored C for calculus. If a student is selected at random, what is the probability that the selected
student scored A or B in calculus?
Solution:
S A
5
B C
10 10

  probability of students scoring A in calculus


Let
Let probability of students scoring B in calculus

P(A)
    ( 𝐴 ∪ 𝐵 )=𝑃 ( 𝐴 )+ 𝑃 (𝐵)
𝑃

P(B)   1 2 3
  ¿ + =
5 5 5
Rule of addition-non mutually exclusive events
 If events A and B are non-mutually exclusive events, there is possibility that events A and event B
will occur at the same time.
 Example: All students are allowed to take either Mathematics or Statistics or both subjects this
semester.
 In this case, events of taking Mathematics and statistics are non-mutually exclusive as both events
can occur at the same time

Probability of Event A or
Venn Diagram Event B occurs is equal to
probability that Event A
occurs plus probability that
A A∩B B Event B occurs minus the
probability that both Events
A and B occur.

 P
Combining events
• The set theory notations of union (∪) and intersection (∩) provide a
useful shorthand for writing expressions involving events.
• For two events A and B,
• A ∪ B represents “A or B occurs” (where “or” is used in the inclusive
sense of A or B or both),
• A ∩ B represents “both A and B occur”.
example
 A tourist guide is meeting two tourists at the Butterworth station, one arriving by train from Bangkok
and the other arriving by train from Singapore. Both trains are scheduled to arrive at 1300. let B and
S be the respective events the trains arrive between 1255 and 1305. from the past records, it is
known that P(B) = 0.86, P(S)= 0.91 and what is the probability that at least one train will arrive
between 1255 and 1305?

Therefore, the probability that at least one train will arrive between 1255 and 1305 is 0.95
EXAMPLE
A student goes to the library. The probability that she checks out (a) a work of fiction is 0.40, (b) a work of
non-fiction is 0.30, and (c) both fiction and non-fiction is 0.20. What is the probability that the student checks
out a work of fiction, non-fiction, or both?

P(F ∪ N) = P(F) + P(N) - P(F ∩ N)


P(F ∪ N) = 0.40 + 0.30 - 0.20 = 0.50
The multiplication rule- independent event
  When two events occur successively, calculating the probability of event A and event B
occurring depends on whether the two events are statistically independent.
 Statistically independent – when the occurrence of one event is not affected by the result
of the other event
 Example
 A coin is tossed
 Probability of getting heads in the first event is
 Probability of getting heads in second toss is also ( the first outcome doesn’t matter).

 𝑃 ( 𝐴 ∩ 𝐵 )= 𝑃 ( 𝐴 ) × 𝑃 (𝐵 )

When two events are statistically independent, the probability that event A and event B
will occur is the product of separate probabilities
example
If a couple wants to have two children, what is the probability of getting a boy and a girl?

SOLUTION

 Let probability of getting a boy


  probability of getting a girl

  ( 𝐵 )= 1
𝑃
2

  ( 𝐺 )= 1
𝑃
2

𝑃
  ( 𝐵 ∩𝐺 )=𝑃 ( 𝐵 ) × 𝑃(𝐺)
 

  1
¿
4
The multiplication rule-NON- independent event
 Non-independent events- when the occurrence of one event is affected by the occurrence of another event
 This usually happens in sampling without replacement
 Example
We want to draw 3 balls from a bag containing 3 green balls and 4 black balls.
 Probability of drawing a green ball =  Probability of drawing a black ball =

When no replacement is allowed, given the first ball is black.

 Probability of drawing a green ball =  Probability of drawing a black ball =

  𝑃 ( 𝐴 ∩ 𝐵)
𝑃 ( 𝐵 / 𝐴 )=   or
𝑃 (𝐴 )

When two events A and B are non-independent events, probability of A and B occurring is
the product of probability of A occurring and probability of B occurring, given that A has
occurred.
example
An English class consists of 12 male and 18 female students. Three of the male students
and five of the female students are non-bumiputras. A student is randomly selected. Find
the

12 male, 3 non bumi


18 female, 5 non bumi

a) Probability of selecting non-bumiputera student


b) Probability of selecting a male student given that the student is non-bumiputera
c) Probability of selecting either a male or non-bumiputera student
SOLUTION
12
  =2
 Let = probability of a male student 30 5
18
  =3
  = probability of a female student 30 5
 8 = 4
  = probability of a non-bumiputera student 30 15

  = probability of a non-bumiputera student given the student is male  3 = 1


12 4

  = probability of a non-bumiputera student given the student is female  5


18

a) Probability of selecting non-bumiputera student


  =

b) Probability of selecting a male student given that the student is non-bumiputera


  =

c) Probability of selecting either a male or non-bumiputera student


  ( 𝑀 ∪ 𝑁 )=𝑃 ( 𝑀 ) + 𝑃 ( 𝑁 ) − 𝑃 ( 𝑀 ∩ 𝑁 )
𝑃

  2 + 4 − 1 = 17
¿
5 15 10 30
Tree diagram
Tree diagram

• Used to display the outcomes of an experiment which consist


of a series of activities
• To ensure that all logical possibilities are considered
• To display all possible outcomes in a clearer way
Example
If a coin is tossed twice, the possible outcomes are

{ (H ∩ H), (H ∩ T), (T ∩ H), (T ∩ T)}


Using a tree diagram, the possible outcomes can be displayed in a clearer way

Let H = head
T= tail Complete outcome Probability

H ( H ∩ H) 1/4
H ( H ∩ T)
T 1/4
H ( T ∩ H) 1/4
T
T ( T ∩ T) 1/4
EXAMPLE
Three companies, A, B and C are competing for a contract to build a condominium. The probabilities
that companies A, B and C will win the contract are 0.25, 0.45 and 0.3 respectively. If company A, B and
C win the contract, the probability that they will make profits are 0.8, 0.9 and 0.7 respectively.

a. Construct a tree diagram based on information given in the question.


b. What is the probability that the companies will make profit?
c. If the contract is found to be profitable, find the probability that the contract was given to
company A.
solution
Let A = Company A B= Company B C= Company U=profitable U´= unprofitable
 
a.
P(U/A)=0.8 U P(A) x P(U/A) = 0.25 x 0.8 = 0.2

A
U´ P(A) x P(U´/A) = 0.25 x 0.2 = 0.05
P(A)=0.25 P(U´/A)=0.2

P(U/B)=0.9 U P(B) x P(U/B) = 0.45 x 0.9 = 0.405


P(B)=0.45
B
U´ P(B) x P(U´/B) = 0.45 x 0.1 = 0.045
P(U´/B)=0.1

P(C)=0.3 P(U/C)=0.7 U P(C) x P(U/C) = 0.3 x 0.7 = 0.21

P(U´/C)=0.3 U´ P(C) x P(U´/C) = 0.3 x 0.3 = 0.09


b. The probability that profit will be made by the companies is

𝑃
  ( 𝑈 ) =𝑃 ( 𝐴 ∩ 𝑈 ) 𝑜𝑟 𝑃 ( 𝐵 ∩ 𝑈 ) 𝑜𝑟 𝑃(𝐶 ∩ 𝑈 )
 ¿ 0.2 +0.405 +0.21

¿  0.815

c., the probability that the contract will be given to the company A,

If the contract is found to be profitable.


    𝑃 ( 𝐴 ∩ 𝐵)
𝑃 ( 𝐵 / 𝐴 )=
𝑃 (𝐴 )
0.2
¿ 
0.815

¿  0.245
Bayes’ theorem
Bayes’ theorem

• Describes probability of an event, based on prior knowledge of conditions that might be related to the
event

 P(Ai)P(B/Ai)
P(Ai/B) =
 ∑[P(Ai)P(B/Ai)]

Where A1 ,…………….. An is an all inclusive set of possible outcomes, given that event B occurs.
Example
Company K sells cars which are manufactured at three different factories X,
Y and Z with proportions of 35%, 25% and 40% respectively. Records show
that the proportions of mechanical malfunctions of cars manufactured at X,
Y and Z are 1%, 2% and 1% respectively.

a. Draw a tree diagram based on the information given.


b. If one car was selected at random and found to have a mechanical
malfunction, what is the probability that the car was produced at Y?
a. Draw a tree diagram based on the information given.
Company K sells cars which are manufactured at three different factories X, Y and Z with proportions of
35%, 25% and 40% respectively. Records show that the proportions of mechanical malfunctions of cars b. If one car was selected at random and found to have a mechanical
manufactured at X, Y and Z are 1%, 2% and 1% respectively. malfunction, what is the probability that the car was produced at Y?

Let X= factory X, Y= factory Y, Z= factory Z D=mechanical malfunction, D´= no mechanical malfunction

a. Tree diagram  

P(D/X)= 0.01 P(X) x P(D/X) =0.35 x 0.01= 0.0035


D
X
P(X)=0.35
P(D´/X)= 0.99 D´ P(X) x P(D´/X) =0.35 x 0.99= 0.3465
P(D/Y)= 0.02 D P(Y) x P(D/Y) =0.25 x 0.02= 0.005
P(Y)=0.25
Y
P(Y) x P(D´/Y) =0.25 x 0.98= 0.245
P(D´/Y)= 0.98 D´
P(D/Z)= 0.01 D P(Z) x P(D/Z) =0.4 x 0.01= 0.004
P(Z)=0.4 Z

P(D´/Z)= 0.99 D´ P(Z) x P(D´/Z) =0.4 x 0.99= 0.396


b. Using Bayes’ formula,

P(Y)P(D/Y)  P(Ai)P(B/Ai)
P(Y/D) = P(Ai/B) =
P(X)P(D/X) + P(Y)P(D/Y) + P(Z)P(D/Z)  ∑[P(Ai)P(B/Ai)]

  =

¿  0.4

https://brilliant.org/wiki/bayes-theorem/
THE END

You might also like