probability calculations
TRANSCRIPT
-
8/10/2019 Probability Calculations
1/42
ProbabilityMirza Amin ul Haq
-
8/10/2019 Probability Calculations
2/42
ProbabilityThe calculated likelihood that a given eventwill occur
-
8/10/2019 Probability Calculations
3/42
Methods of Determining ProbabilityEmpirical
Experimental observationExample Process control
TheoreticalUses known elementsExample Coin toss, die rolling
Subjective AssumptionsExample I think that . . .
-
8/10/2019 Probability Calculations
4/42
Probability Components
Experiment An activity with observable results
Sample Space A set of all possible outcomes
Event A subset of a sample space
Outcome / Sample Point The result of an experiment
-
8/10/2019 Probability Calculations
5/42
ProbabilityWhat is the probability of a tossed coin
landing heads up?
Probability Tree
Experiment
Sample Space
Event
Outcome
-
8/10/2019 Probability Calculations
6/42
-
8/10/2019 Probability Calculations
7/42
Relative FrequencyThe number of times an event will occur
divided by the number of opportunities= Relative frequency of outcome x
= Number of events with outcome x
= Total number of events
x
x
n f N
Expressed as a number between 0 and 1fraction, percent, decimal, odds
Total frequency of all possible events totals 1
x f
xn
N
-
8/10/2019 Probability Calculations
8/42
Probability
x x
a
F P F
What is the probability of a tossed coin
landing heads up?
How many possibleoutcomes? 2
How many desirableoutcomes? 1
12
P .5 50%
Probability Tree
What is the probability of the coinlanding tails up?
-
8/10/2019 Probability Calculations
9/42
Probability
x x
a
F P
F
How many possibleoutcomes?
How many desirableoutcomes? 1
14
P
What is the probability of tossing a coin
twice and it landing heads up both times?
4
HH
HT
TH
TT
.25 25%
-
8/10/2019 Probability Calculations
10/42
Probability
x x
a
F P
F
How many possibleoutcomes?
How many desirableoutcomes? 3
38
P
What is the probability of tossing
a coin three times and it landingheads up exactly two times?
8
1 st
2nd
3 rd HHH
HHT
HTH
HTT
THH
THT
TTH
TTT
.375 37.5%
-
8/10/2019 Probability Calculations
11/42
Law of Large Numbers
Trial 1: Toss a single coin 5 timesH,T,H,H,TP = .600 = 60%
Trial 2: Toss a single coin 500 timesH,H,H,T,T,H,T,T,T P = .502 = 50.2%
Theoretical Probability = .5 = 50%
The more trials that are conducted, the closer
the results become to the theoretical probability
-
8/10/2019 Probability Calculations
12/42
Probability
Independent events occurring simultaneouslyProduct of individual probabilities
If events A and B are independent, then theprobability of A and B occurring is:
P = P(A) P(B)
AND (Multiplication)
-
8/10/2019 Probability Calculations
13/42
Probability AND (Multiplication)What is the probability of rolling a 4 on a single die?
How many possible outcomes?How many desirable outcomes? 1
6 416
P
What is the probability of rolling a 1 on a single die?
How many possible outcomes?How many desirable outcomes? 1
6 116
P
What is the probability of rolling a 4 and then a1 using two dice?
4 1P = (P )(P ) 1 1=
6 6
1.0278
36
2.78%
-
8/10/2019 Probability Calculations
14/42
Probability
Independent events occurring individuallySum of individual probabilities
If events A and B are mutually exclusive, thenthe probability of A or B occurring is:
P = P(A) + P(B)
OR (Addition)
-
8/10/2019 Probability Calculations
15/42
ProbabilityOR (Addition)What is the probability of rolling a 4 on a single die?
How many possible outcomes?How many desirable outcomes? 1
6 416
P
What is the probability of rolling a 1 on a single die?
How many possible outcomes?How many desirable outcomes? 1
6 116
P
What is the probability of rolling a 4 or a 1 on asingle die?
4 1( ) ( ) P P P 1 1
6 6
2 .3333 33 3 %6
. 3
-
8/10/2019 Probability Calculations
16/42
Probability
Independent event not occurring1 minus the probability of occurrence
P = 1 - P(A)
NOT
What is the probability of not rolling a 1 on a die?
11 P P 11 6 5 .8333 83 3 %
6. 3
-
8/10/2019 Probability Calculations
17/42
How many tens are in a deck?
ProbabilityTwo cards are dealt from a shuffled deck.
What is the probability that the first card is anace and the second card is a face card or aten?
How many cards are in a deck? 52
4
12
4
How many aces are in a deck?
How many face cards are in deck?
-
8/10/2019 Probability Calculations
18/42
Probability
What is the probability that the first card is an ace?4 1
.0769 7.69%52 13
12 4.2353 23.53%
51 17
Since the first card was NOT a face, what is theprobability that the second card is a face card?
Since the first card was NOT a ten, what is theprobability that the second card is a ten?
4.0784 7.84%
51
-
8/10/2019 Probability Calculations
19/42
ProbabilityTwo cards are dealt from a shuffled deck.
What is the probability that the first card is anace and the second card is a face card or aten?
1 4 4= +
13 17 51
A F 10P = P (P + P )
1 12 4= +
13 51 51
1 16=
13 51
.0241 2.41% If the first card is an ace, what is theprobability that the second card is a
face card or a ten? 31.37%
-
8/10/2019 Probability Calculations
20/42
-
8/10/2019 Probability Calculations
21/42
21
Contingency Table
A contingency table is a particular way to view a samplespace. Say we talk to 100 customers who just made apurchase in a store and not only do we note the gender ofthe customer we ask if they paid cash or used a credit card.
The responses are summarized on the next screen
-
8/10/2019 Probability Calculations
22/42
22
Contingency Table
Payment Method
Gender Cash Credit Card Total
Female 3 12 15
Male 17 68 85
Total 20 80 100
So, each of the 100 people observed had to be put in agender category and had to be given a payment method.If you divide each number in the table by the grand total(here 100 and this represents the total number of peopleobserved) the table is then called a joint probability table.
Lets do this and see what results on the next screen.
-
8/10/2019 Probability Calculations
23/42
23
Marginal Probabilities
The total column and the total row are called marginalprobabilities because the are written in the margins of thtable. But, note that adding across the Female row gives atotal of .15. This is the P(F), or the probability that you wouldselect a female when talking to someone involved in thestudy.
The other marginal probabilities are
P(M) = .85P(Cash) = .2 and P(Credit Card) = .8
-
8/10/2019 Probability Calculations
24/42
24
Joint Probability
Payment MethodGender Cash (B) CC (B) TotalFemale (A) P(A and B) P(A and B) P(A)Male (A) P(A and B) P(A and B) P(A)
Total P(B) P(B) 1.0From the example I have labeled the gender A and A andthe payment method B and B and then I have filled thetable out in definitional form.
-
8/10/2019 Probability Calculations
25/42
25
Joint Probability Table
Payment Method
Gender Cash Credit Card Total
Female .03 .12 .15
Male .17 .68 .85
Total .20 .80 1
-
8/10/2019 Probability Calculations
26/42
26
Marginal Probability
Note in the joint probability table on the previous screen(which is a contingency table that has been modified bydividing all numbers by the grand total!) that
1) In any row the marginal probability is the sum of the jointprobabilities in that row, and
2) In any column the marginal probability is the sum of the joint probabilities in that column.
(Also note that the sum of the probability of complementsequals 1 > for example P(A) + P(A c) = 1
-
8/10/2019 Probability Calculations
27/42
27
n on o ven s e eneraAddition Rule
Sometimes we want to ask a question about the probability of Aor B, written P(A or B) = P(A B).
By the general addition rule
P(A or B) = P(A) + P(B) P(A and B).In our example we have P(A or B) = .15 + 0.20 0.03 = 0.32.Lets think about this some more. How manyare Female? 3 +12 = 15! How many paid cash? 3 + 17 = 20! But 3 of thesewere in both A and B. So, when we ask a question about A orB we want to include all that are A or B, but we only want toinclude them once. If they are both we subtract out theintersection because it was included in both the row andcolumn total.
-
8/10/2019 Probability Calculations
28/42
28
Venn Diagram
A Venn diagram, named in honor of Mr. Venn, is anotherway to present the sample space for two variables.
A
B
The rectangle here
represents the samplespace. On one variable wehave event A and that takesup the space represented
by circle A. Ignoring circleB, all the rest of therectangle is A c (thecomplement of A). A similarinterpretation holds for B.This area represents the intersection
of A and B.
-
8/10/2019 Probability Calculations
29/42
-
8/10/2019 Probability Calculations
30/42
30
Conditional Probability
-
8/10/2019 Probability Calculations
31/42
31
Conditional Probability
As we have seen, P(A) refers to the probability that event A will occur. A newidea is that P(A|B) refers to the probability that A will occur but with the
understanding that B has already occurred and we know it. So, we say theprobability of A given B. The given B part means that it is known that B hasoccurred.
By definition
P(A|B) = P(A and B)/P(B).
Similarly
P(B|A) = P(A and B)/P(A).
Note P(A and B) = P(B and A)
-
8/10/2019 Probability Calculations
32/42
32
Now we have by definitionP(A|B) = P(A and B)/P(B).
In this definition, B has already occurred. The P(B) is the denominator ofP(A|B) and is thus the base of the conditional probability. The intersection of Aand B is in the numerator. Since B has occurred, the only way A can haveoccurred is if there is an overlap of A and B. So we have the ratio
probability of overlap/probability of known event.
Lets turn tothe example from above. The joint probability table is repeated onthe next slide.
-
8/10/2019 Probability Calculations
33/42
33
Joint Probability Table
Payment Method
Gender Cash Credit Card Total
Female .03 .12 .15
Male .17 .68 .85
Total .20 .80 1
Lets say you saw someone pay cash for a purchase, butyour view was blocked as to the gender of the person. TheP(femalecash) = .03/.20 = .15
-
8/10/2019 Probability Calculations
34/42
34
Joint Probability Table
Payment Method
Gender Cash Credit Card Total
Female .03 .12 .15
Male .17 .68 .85
Total .20 .80 1
Lets say you saw someone a female leave the store havingmade a purchase, but your view was blocked as to the typeof payment. The P( cashfemale) = .03/.15 = .20
-
8/10/2019 Probability Calculations
35/42
35
Independent Events
Events A and B are said to be independent ifP(A|B) = P(A) or P(B|A) = P(B).
In the example we have been using P(Female) = .15, and P(Female|Cash) = .15.
What is going on here? Well, in this example it turns out that the proportion offemales in the study is .15 and when you look at those who paid cash theproportion of females is still .15. So, knowing that the person paid cash doesnchange your view of the likelihood that the person is female.
But, in some case (not here) having information about B gives a different viewabout A. When P(A|B) P(A) we say events A and B are dependent events.Similarly, when P(B|A) P(B) events A and B are dependent.
-
8/10/2019 Probability Calculations
36/42
36
Does a coin have a memory? In other words, does a coin remember how manytimes it has come up heads and will thus come up tails if it came up heads a lotlately? Say A is heads on the third flip, B is heads on the first two flips. Is headson the third flip influenced by the first two heads. No, coins have no memory!
Thus A and B are independent. (Note I am not concerned here about theprobability of getting three heads!)
Have you ever heard the saying, Pink sky in the morning, sailors take warningpink sky at night sailors delight. I just heard about it recently. Apparently it irule of thumb about rain. Pink sky in the morning would serve as a warning for
rain that day. If A is rain in the day and B is pink sky in the morning, then it seemsthat the P(A|B) P(A) and thus the probability of rain is influenced by morning skycolor (color is really just an indicator of conditions).
-
8/10/2019 Probability Calculations
37/42
37
Lets think about one more example. If you watched a football team all yearyou could use the empirical approach to find the probability that it will throw apass on a given play. Say P(pass)=0.4. This means the probability it willpass on a given play is 0.4.
But, if there are 5 minutes left in the game and the team is down 14 points theteam will want to pass more. SO, P(pass|down 14 with 5 minutes left) = 0.75,for example. This means the probability of a pass depends on the score andtime remaining!
-
8/10/2019 Probability Calculations
38/42
38
I have used some examples to give you a feel about when events areindependent and when they are dependent.
By simple equation manipulation we change the conditional probability
definition to the rule called the multiplication law or rule for the intersectionof events:
P(A and B) = P(B)P(A B) or P(A and B) = P(A)P(B A) .
Now this rule simplifies if A and B are independent . The conditional
probabilities revert to regular probabilities. We would then haveP(A and B) = P(B)P(A) = P(A)P(B).
Does this hold in our running example? Sure it does!
Note the given part shows up in the other term.
-
8/10/2019 Probability Calculations
39/42
39
Say, as a new example, we have A and B with P(A)=.5, P(B)=.6 and P(A and B)=.4
Then
a. P(A B) = .4/.6 = .667
b. P(B A) = .4/.5 = .8
c. A and B are not independent because we do NOT have P(A B) = P(A), orP(B A) = P(B).
Say, as another example, we have A and B with P(A)=.3 and P(B)=.4 and here wewill say A and B are mutually exclusive. This means P(A and B) = 0 (in aVenn Diagram A and B have no overlap), then
a. P(A B) = 0/.4 = 0 Here A and B are not independent.
-
8/10/2019 Probability Calculations
40/42
40
Y
Y1 Y2 Totals
X X1 P(X1 and Y1) P(X1 and Y2) P(X1)
X2 P(X2 and Y1) P(X2 and Y2) P(X2)
Totals P(Y1) P(Y2) 1.00
Here I put the joint probability table again in general terms. Question X hasmutually exclusive and collectively exhaustive events X1 and X2. For Y we have
a similar set-up. Note here each has only two responses, but what we will seebelow would apply if there are more than 2 responses.
Lets review some of the probability rules we just went through and then we wadd one more rule.
-
8/10/2019 Probability Calculations
41/42
41
Inside the joint probability table we find joint probabilities (like P(X1 and Y1)and in the margins we find the marginal probabilities (like P(X1)).
Marginal Probability RuleP(X1) = P(X1 and Y1) + P(X1 and Y2)
General Addition RuleP(X1 or Y1) = P(X1) + P(Y1) P(X1 and Y1)
Conditional ProbabilityP(X1|Y1) = P(X1 and Y1) /P(Y1)
Multiplication RuleP(X1 and Y1) = P(X1|Y1)P(Y1)
-
8/10/2019 Probability Calculations
42/42
The new part is to view the marginal probability rule as taking each part anduse the multiplication rule. So,
Marginal Probability RuleP(X1) = P(X1 and Y1) + P(X1 and Y2)
=P(X1|Y1)P(Y1) + P(X1|Y2)P(Y2)Where Y1 and Y2 are mutually exclusive and collectively exhaustive.