Probability+distribution
-
Upload
nilanjan-bhaumik -
Category
Data & Analytics
-
view
189 -
download
2
Transcript of Probability+distribution
Basic Probability Concepts
Probability – the chance that an uncertain event will occur (always between 0 and 1)
Impossible Event – an event that has no chance of occurring (probability = 0)
Certain Event – an event that is sure to occur (probability = 1)
Assessing Probability
There are three approaches to assessing the probability of an uncertain event:
1. a priori -- based on prior knowledge of the process
2. empirical probability
3. subjective probability
outcomeselementaryofnumbertotal
occurcaneventthewaysofnumber
T
X ==
based on a combination of an individual’s past experience, personal opinion, and analysis of a particular situation
outcomeselementaryofnumbertotal
occurcaneventthewaysofnumber=
Assuming all outcomes are equally likely
probability of occurrence
probability of occurrence
Example of a priori probability
Find the probability of selecting a face card (Jack, Queen, or King) from a standard deck of 52 cards.
cards ofnumber total
cards face ofnumber Card Face ofy Probabilit ==
T
X
13
3
cards total52
cards face 12 ==
T
X
Example of empirical probability
Taking Stats Not Taking Stats
Total
Male 84 145 229
Female 76 134 210
Total 160 279 439
Find the probability of selecting a male taking statistics from the population described in the following table:
191.0439
84
people ofnumber total
stats takingmales ofnumber ===Probability of male taking stats
Events
Each possible outcome of a variable is an event.
Simple event An event described by a single characteristic e.g., A red card from a deck of cards
Joint event An event described by two or more characteristics e.g., An ace that is also red from a deck of cards
Complement of an event A (denoted A’) All events that are not part of event A e.g., All cards that are not diamonds
Sample Space
The Sample Space is the collection of all possible events
e.g. All 6 faces of a die:
e.g. All 52 cards of a bridge deck:
Visualizing Events
Contingency Tables
Decision Trees
Red 2 24 26
Black 2 24 26
Total 4 48 52
Ace Not Ace Total
Full Deck of 52 Cards
Red Card
Black Card
Not an Ace
Ace
Ace
Not an Ace
Sample Space
Sample Space2
24
2
24
Visualizing Events
Venn Diagrams Let A = aces Let B = red cards
A
B
A ∩ B = ace and red
A U B = ace or red
DefinitionsSimple vs. Joint Probability
Simple Probability refers to the probability of a simple event. ex. P(King) ex. P(Spade)
Joint Probability refers to the probability of an occurrence of two or more events (joint event). ex. P(King and Spade)
Mutually Exclusive Events
Mutually exclusive events Events that cannot occur simultaneously
Example: Drawing one card from a deck of cards
A = queen of diamonds; B = queen of clubs
Events A and B are mutually exclusive
* Diamonds & Hearts are red in color, while clubs & spades are black
Collectively Exhaustive Events
Collectively exhaustive events One of the events must occur The set of events covers the entire sample space
example: A = aces; B = black cards;
C = diamonds*; D = hearts*
Events A, B, C and D are collectively exhaustive (but not mutually exclusive – an ace may also be a heart)
Events B, C and D are collectively exhaustive and also mutually exclusive
Computing Joint and Marginal Probabilities
The probability of a joint event, A and B:
Computing a marginal (or simple) probability:
Where B1, B2, …, Bk are k mutually exclusive and collectively exhaustive events
outcomeselementaryofnumbertotal
BandAsatisfyingoutcomesofnumber)BandA(P =
)BdanP(A)BandP(A)BandP(AP(A) k21 +++=
Joint Probability Example
P(Red and Ace)
BlackColor
Type Red Total
Ace 2 2 4
Non-Ace 24 24 48
Total 26 26 52
52
2
cards of number total
ace and red are that cards of number ==
Marginal Probability Example
P(Ace)
BlackColor
Type Red Total
Ace 2 2 4
Non-Ace 24 24 48
Total 26 26 52
52
4
52
2
52
2)BlackandAce(P)dReandAce(P =+=+=
P(A1 and B2) P(A1)
TotalEvent
Marginal & Joint Probabilities In A Contingency Table
P(A2 and B1)
P(A1 and B1)
Event
Total 1
Joint Probabilities Marginal (Simple) Probabilities
A1
A2
B1 B2
P(B1) P(B2)
P(A2 and B2) P(A2)
Probability Summary So Far
Probability is the numerical measure of the likelihood that an event will occur
The probability of any event must be between 0 and 1, inclusively
The sum of the probabilities of all mutually exclusive and collectively exhaustive events is 1
Certain
Impossible
0.5
1
0
0 ≤ P(A) ≤ 1 For any event A
1P(C)P(B)P(A) =++If A, B, and C are mutually exclusive and collectively exhaustive
General Addition Rule
P(A or B) = P(A) + P(B) - P(A and B)
General Addition Rule:
If A and B are mutually exclusive, then
P(A and B) = 0, so the rule can be simplified:
P(A or B) = P(A) + P(B)
For mutually exclusive events A and B
General Addition Rule Example
P(Red or Ace) = P(Red) +P(Ace) - P(Red and Ace)
= 26/52 + 4/52 - 2/52 = 28/52Don’t count the two red aces twice!
BlackColor
Type Red Total
Ace 2 2 4
Non-Ace 24 24 48
Total 26 26 52
Quiz Time!
Tickets numbered 1 to 20 are mixed up and then a ticket is drawn at random. What is the probability that the ticket drawn has a number which is a multiple of 3 or 5?
A bag contains 2 red, 3 green and 2 blue balls. Two balls are drawn at random. What is the probability that none of the balls drawn is blue?
What is the probability of getting a sum 9 from two throws of a dice? Two dice are thrown simultaneously. What is the probability of getting two
numbers whose product is even? From a pack of 52 cards, two cards are drawn together at random. What is
the probability of both the cards being kings? A card is drawn from a pack of 52 cards. What is the probability of getting a
queen of club or a king of heart? You are supposed to attend 3 job interviews. For the first company, there are
12 candidates for one position; for the second, there are 15 candidates for two positions, while for the third there are 20 candidates for 4 positions. What are the chances that you will get at least one offer?
Computing Conditional Probabilities
A conditional probability is the probability of one event, given that another event has occurred:
P(B)
B)andP(AB)|P(A =
P(A)
B)andP(AA)|P(B =
Where P(A and B) = joint probability of A and B
P(A) = marginal or simple probability of A
P(B) = marginal or simple probability of B
The conditional probability of A given that B has occurred
The conditional probability of B given that A has occurred
What is the probability that a car has a CD player, given that it has AC ?
i.e., we want to find P(CD | AC)
Conditional Probability Example
Of the cars on a used car lot, 70% have air conditioning (AC) and 40% have a CD player (CD). 20% of the cars have both.
Conditional Probability Example
No CDCD Total
AC 0.2 0.5 0.7
No AC 0.2 0.1 0.3
Total 0.4 0.6 1.0
Of the cars on a used car lot, 70% have air conditioning (AC) and 40% have a CD player (CD). 20% of the cars have both.
0.28570.7
0.2
P(AC)
AC)andP(CDAC)|P(CD ===
(continued)
Conditional Probability Example
No CDCD Total
AC 0.2 0.5 0.7
No AC 0.2 0.1 0.3
Total 0.4 0.6 1.0
Given AC, we only consider the top row (70% of the cars). Of these, 20% have a CD player. 20% of 70% is about 28.57%.
0.28570.7
0.2
P(AC)
AC)andP(CDAC)|P(CD ===
(continued)
Using Decision Trees
Has AC
Does not have AC
Has CD
Does not have CD
Has CD
Does not have CD
P(AC)= 0.7
P(AC’)= 0.3
P(AC and CD) = 0.2
P(AC and CD’) = 0.5
P(AC’ and CD’) = 0.1
P(AC’ and CD) = 0.2
7.
5.
3.
2.
3.
1.
AllCars
7.
2.
Given AC or no AC:
ConditionalProbabilities
Using Decision Trees
Has CD
Does not have CD
Has AC
Does not have AC
Has AC
Does not have AC
P(CD)= 0.4
P(CD’)= 0.6
P(CD and AC) = 0.2
P(CD and AC’) = 0.2
P(CD’ and AC’) = 0.1
P(CD’ and AC) = 0.5
4.
2.
6.
5.
6.
1.
AllCars
4.
2.
Given CD or no CD:
(continued)
ConditionalProbabilities
Conditional Probability Example
In AGBS Bangalore, 65% of MBA students took up Marketing as their specialization, while 50% took up Finance. It is also known that 20% of the students opted for Marketing but did not take Finance.
What is the probability that a student takes Marketing, given that he takes Finance?
Conditional Probability Example
A machine produces parts that are either good (90%), slightly defective (2%), or obviously defective (8%). Produced parts get passed through an automatic inspection machine, which is able to detect any part that is obviously defective and discard it.
What is the probability that a ‘good’ part makes it through the inspection machine and gets shipped?
Conditional Probability Example
Your neighbor has 2 children. You learn that he has a son, Joe.
What is the probability that Joe’s sibling is a brother?
Joe again!
Your neighbor has 2 children. He picks one of them at random and comes by your house; he brings a boy named Joe (his son). What is the probability that Joe’s sibling is a brother?
This is not the same as the previous problem. How?!
P(Second also a boy given that first one turned up to be a boy when randomly selected) = P(1st one boy & 2nd one boy)/P(first one is a boy on random selection)
= (1/2*1/2)/(1/2) = 1/2
Independence
Two events are independent if and only if:
Events A and B are independent when the probability of one event is not affected by the fact that the other event has occurred
P(A)B)|P(A =
Multiplication Rules
Multiplication rule for two events A and B:
P(B)B)|P(AB)andP(A =
P(A)B)|P(A =Note: If A and B are independent, thenand the multiplication rule simplifies to
P(B)P(A)B)andP(A =
Example 1
Suppose that five good fuses and two defective ones have been mixed up. To find the defective fuses, we test them one-by-one, at random and without replacement. What is the probability that we are lucky and find both of the defective fuses in the first two tests?
Example 2
If six cards are selected at random (without replacement) from a standard deck of 52 cards, what is the probability there will be no pairs? (two cards of the same denomination)?
Marginal Probability
Marginal probability for event A:
Where B1, B2, …, Bk are k mutually exclusive and collectively exhaustive events
)P(B)B|P(A)P(B)B|P(A)P(B)B|P(A P(A) kk2211 +++=
Solve this!
The probability that each relay closes in the circuit shown below is p. Assuming that each relay functions independently of the others, find the probability that current can flow from L to R.
Now solve this!
A high school conducts random drug tests on its students. Of the student body, it is known that 8% use marijuana regularly; 17% use it occasionally; and 75% never use it. The testing regime is not perfect: regular marijuana users falsely test negative 5% of the time; occasional users falsely test negative 13% of the time; and non-users falsely test positive 11% of the time. What percentage of the student body will test positive for marijuana use?
Bayes’ Theorem
Bayes’ Theorem is used to revise previously calculated probabilities based on new information.
Developed by Thomas Bayes in the 18th Century.
It is an extension of conditional probability.
Bayes’ Theorem
where:
Bi = ith event of k mutually exclusive and collectively
exhaustive events
A = new event that might impact P(Bi)
))P(BB|P(A))P(BB|P(A))P(BB|P(A
))P(BB|P(AA)|P(B
k k 2 2 1 1
i i i +⋅⋅⋅++
=
Bayes’ Theorem Example 1
A drilling company has estimated a 40% chance of striking oil for their new well.
A detailed test has been scheduled for more information. Historically, 60% of successful wells have had detailed tests, and 20% of unsuccessful wells have had detailed tests.
Given that this well has been scheduled for a detailed test, what is the probability that the well will be successful?
Let S = successful well
U = unsuccessful well
P(S) = 0.4 , P(U) = 0.6 (prior probabilities)
Define the detailed test event as D
Conditional probabilities:
P(D|S) = 0.6 P(D|U) = 0.2
Goal is to find P(S|D)
Bayes’ Theorem Example 1(continued)
0.6670.120.24
0.24
(0.2)(0.6)(0.6)(0.4)
(0.6)(0.4)
U)P(U)|P(DS)P(S)|P(D
S)P(S)|P(DD)|P(S
=+
=
+=
+=
Bayes’ Theorem Example 1(continued)
Apply Bayes’ Theorem:
So the revised probability of success, given that this well has been scheduled for a detailed test, is 0.667
Bayes’ Theorem Example 2
Urn 1 contains 5 white balls and 7 black balls. Urn 2 contains 3 whites and 12 black. A fair coin is flipped; if it is Heads, a ball is drawn from Urn 1, and if it is Tails, a ball is drawn from Urn 2. Suppose that this experiment is done and you learn that a white ball was selected. What is the probability that this ball was in fact
taken from Urn 2? (i.e., that the coin flip was Tails)
Bayes’ Theorem Example 2
Urn 1 contains 5 white balls and 7 black balls. Urn 2 contains 3 whites and 12 black. A fair coin is flipped; if it is Heads, a ball is drawn from Urn 1, and if it is Tails, a ball is drawn from Urn 2. Suppose that this experiment is done and you learn that a white ball was selected. What is the probability that this ball was in fact
taken from Urn 2? (i.e., that the coin flip was Tails)
Bayes’ Theorem Example 3
Bob can decide to go to work by one of three modes of transportation, car, bus, or commuter train. Because of high traffic, if he decides to go by car, there is a 50% chance he will be late. If he goes by bus, which has special reserved lanes but is sometimes overcrowded, the probability of being late is only 20%. The commuter train is almost never late, with a probability of only 1%, but is more expensive than the bus.
(a) Suppose that Bob is late one day, and his boss wishes to estimate the probability that he drove to work that day by car. Since he does not know which mode of transportation Bob usually uses, he gives a prior probability of 1/3 to each of the three possibilities. What is the boss’ estimate of the probability that Bob drove to work?
Bayes’ Theorem Example 3
Bob can decide to go to work by one of three modes of transportation, car, bus, or commuter train. Because of high traffic, if he decides to go by car, there is a 50% chance he will be late. If he goes by bus, which has special reserved lanes but is sometimes overcrowded, the probability of being late is only 20%. The commuter train is almost never late, with a probability of only 1%, but is more expensive than the bus.
(b) Suppose that a coworker of Bob’s knows that he almost always takes the commuter train to work, never takes the bus, but sometimes, 10% of the time, takes the car. What is the coworkers probability that Bob drove to work that day, given that he was late?
Bayes’ Theorem Example 4
A company has two plants to manufacture motorcycles. 70% motor cycles are manufactured at the first plant, while 30% are manufactured at the second plant. At the first plant, 80% motorcycles are rated of the standard quality while at the second plant, 90% are rated of standard quality. A motorcycle, randomly picked up, is found to be of standard quality.
Find the probability that it has come out from the second plant..
Bayes’ Theorem Example 5
A manufacturing firm produces steel pipes in three plants A,B and C with daily production of 500,1000 and 2000 units respectively. The fractions of defective steel pipes output produced by the plants A,B and C are respectively .005, .008 and .010.
If a pipe is selected from a day's total production and found to be defective, find out the probability that it came from the first plant.
The chance that the defective pipe came from a particular plant is the highest for which plant?
Bayes’ Theorem Example 6
At a certain university, 4% of men are over 6 feet tall and 1% of women are over 6 feet tall. The total student population is divided in the ratio 3:2 in favour of women.
If a student is selected at random from among all those over six feet tall, what is the probability that the student is a woman?
Bayes’ Theorem Example 7
Suppose that we have two identical boxes: box 1 and box 2. Box 1 contains 5 red balls and 3 blue balls. Box 2 contains 2 red balls and 4 blue balls. A box is selected at random and exactly one ball is drawn from the box.
Given that the selected ball is blue, what’s the probability that it came from box 2?
Bayes’ Theorem Example 8
An insurance company divides its policy holders into three categories: low risk, moderate risk, and high risk. The low-risk policy holders account for 60% of the total number of people insured by the company. The moderate-risk policy holders account for 30%, and the high-risk policy holders account for 10%. The probabilities that a low-risk, moderate-risk, and high-risk policy holder will file a claim within a given year are respectively .01, .10, and .50
Given that a policy holder files a claim this year, what is the probability that the person is a high-risk policy holder??
Counting Rules
Rules for counting the number of possible outcomes
Counting Rule 1: If any one of k different mutually exclusive and
collectively exhaustive events can occur on each of n trials, the number of possible outcomes is equal to
Example If you roll a fair die 3 times then there are 63 = 216 possible
outcomes
kn
Counting Rules
Counting Rule 2: If there are k1 events on the first trial, k2 events on the
second trial, … and kn events on the nth trial, the number of possible outcomes is
Example: You want to go to a park, eat at a restaurant, and see a
movie. There are 3 parks, 4 restaurants, and 6 movie choices. How many different possible combinations are there?
Answer: (3)(4)(6) = 72 different possibilities
(k1)(k2)…(kn)
(continued)
Counting Rules
Counting Rule 3: The number of ways that n items can be arranged in
order is
Example: You have five books to put on a bookshelf. How many
different ways can these books be placed on the shelf?
Answer: 5! = (5)(4)(3)(2)(1) = 120 different possibilities
n! = (n)(n – 1)…(1)
(continued)
Counting Rules
Counting Rule 4: Permutations: The number of ways of arranging X
objects selected from n objects in order is
Example: You have five books and are going to put three on a
bookshelf. How many different ways can the books be ordered on the bookshelf?
Answer: different possibilities
(continued)
X)!(n
n!Pxn −
=
602
120
3)!(5
5!
X)!(n
n!Pxn ==
−=
−=
Counting Rules
Counting Rule 5: Combinations: The number of ways of selecting X
objects from n objects, irrespective of order, is
Example: You have five books and are going to select three are to
read. How many different combinations are there, ignoring the order in which they are selected?
Answer: different possibilities
(continued)
X)!(nX!
n!Cxn −
=
10(6)(2)
120
3)!(53!
5!
X)!(nX!
n!Cxn ==
−=
−=