3. What is Simulation (stats)
• Define a scenario whose probabilistic
outcomes are know
• Use a mathematical model to carry out a
number of likely outcomes for the
scenario
• Compare the distribution of the outcomes
with “alternative models”
4. Steps to Simulation
1. State the problem and the random
phenomenon
(What are we trying to determine?)
2. State assumptions
(what are the probabilities involved?)
3. Create a mathematical model
(use your calculator or table B)
4. Carry out many repetitions of trial
(don‟t forget to record outcomes!)
5. State your conclusions
5. Creating a mathematical model
• Using a calculator, most probabilities can be
computed with the outcomes 1-100
– RandInt(1,100)
• Using the table, probabilities can be
computed with digits 00-99
– Like with exp design, you should use ID‟s with
the same number of digits
– You may treat 00 as 100
• You may want to simplify your model into
two outcomes
– „Success‟ or „Failure‟
6. Penultimate Last thoughts
• Make sure you follow through all 5 steps
when you perform a simulation
• It may be helpful to list all possible
outcomes
Coin 1 Coin 2 Outcome
Heads Heads HH
Heads Tails HT
Tails Heads TH
Tails Tails TT
7. Last thoughts
• You will not receive credit for calculator notation
– Record your mathematical model
(i.e. #1-32 is a success, #33-99 and 00 are failures)
– Record your method of producing random integers
“I will use my calculator”
“I will use line 131 from table B”
• Record your observations (when possible)
– Create a table with „trial #‟ „observation‟ and
„outcome‟
trial# observation outcome
16 42 failure
17 12 success
10. The idea of probability
• Random behavior does not mean
“haphazard”
• Random behavior is:
– Unpredictable in the short term
– Has a regular and predictable pattern in the long
run
• Observation of random behavior to
determine probability model is “empirical
probability”
• Remember- the regular predictable pattern
only appears after many repetitions
11. Probability Models
• A list of all possible outcomes of a random
phenomenon is called the “Sample Space” or „S‟
• An event is a one or more set of outcomes for
the random phenomenon, it is a subset of the
sample space
– It‟s helpful to think of events in terms of “success”
or “failure”
• A Probability Model describes the random
phenomenon. Consists of two parts:
– Sample Space (S)
– Probability for each event (P)
12. Probability Model- Coins
S = {H, T}
P(H) = 0.5, P(T) = 0.5
• Notice that the sum of probabilities for
the sample space is 1.00
• This model also assumes that the coin is
„fair‟
13. Tree Diagrams
• Using a tree is helpful when there is more
than one „event‟ or mechanism for each
event
• These outcomes must be independent
– The outcome of one event does not effect
the outcome of the next event
18. Probability Model
• Provided that the outcomes of each event
are equally likely, then the probability of
each outcome is the same: 1/n
• Multiplication Principle
– If the Sample Space consists two events,
event 1 has n1 outcomes,
event 2 has n2 outcomes,
then the Sample Space has n1 x n2 outcomes
– I like to call this the menu principle
19. Confusions and Clarification
• The concepts of “events” and “outcomes”
easily confused.
• Outcome
– The product of some mechanism- dice, cards,
etc.
• Event
– An outcome or set of outcomes with significance
• Many times, the “event of interest” is the
result of many outcomes
21. With or Without Replacement
Many events involve some kind of repeated
sampling- think of drawing cards from a deck
• Sampling with Replacement
– After a sample, the card is put back into the deck
– The probability model for the second card is the
same as the probability model for the first card
• Sampling without Replacement
– The card is not put back in the deck
– The probability model for the second card is not the
same as the probability model for the first card
22. Probability RULZ
Suppose a sample space „S‟ has events „A‟
and „B‟
1. 0 < P(A) < 1
-The probability of an event is between 0
and 1
-P(A) = 0 means the event never happens
-P(A) = 1 means the event always happens
23. Probability RULZ
Suppose a sample space „S‟ has events
„A‟ and „B‟
2. P(A) + P(B) + … +P(n) = 1
-or-
P(S) = 1
-The sum of all possible outcomes is 1.
-One of the outcomes in the S must
happen!
24. Probability RULZ
Suppose a sample space „S‟ has events
„A‟ and „B‟
-Two events are „disjoint‟ or „mutually
exclusive‟ if they have no common
outcomes
3. If events A and B are disjoint, then
P(A or B) = P(A) + P(B)
(more on disjoint events later)
25. Probability RULZ
Suppose a sample space „S‟ has events „A‟
and „B‟
4. P(A) + P(AC) = 1
-The probability of an event occurring plus
the probability that an event does not
occur is „1‟
-“Either an event happens, or it doesn‟t”
-Also P(A) = 1 - P(AC)
26. Terminology
• “Union,” “OR,” “U”
– “A U B”
– “Either A or B or both”
• “Intersect,” “AND,” “∩”
– “A∩B”
– Both A and B occurred simultaneously
• Empty set
– Event has no outcomes!
– i.e. “A∩B = ” or “A∩B = { }”
27. THE FOUR RELATIONS
• Two events can be related in one of four
ways:
1. Complimentary Events
2. Disjoint Events
3. Implied Events
4. Independent Events
32. Terminology
Independent Events
• Events share outcomes
• It is possible that an outcome qualifies event A
and event B
• I like this diagram:
A
BA and B
Ac and Bc
P(A) P(AC)
P(B)
P(BC)
33. Equally likely outcomes
• If a random phenomenon has k equally
likely outcomes, then the probability of
each outcome is 1/k.
• For an event A:
# of outcomes in A
A
# of outcomes in S
# of outcomes in A
P
k
34. Equally likely outcomes
• What is the probability of drawing a
„King‟ from a standard deck of cards
• Let A = drawing a king
A = {King of Spades, King of Diamonds,
King of Clubs, King of Hearts}
# of outcomes in A
A
# of outcomes in S
4 1
52 13
P
35. Multiplication rule
• Two events are independent if the
outcome of the first trial does not affect
the outcome of the second trial.
• This is not the same as „disjoint‟
– If two events are disjoint, then by definition
the outcome of the first event affects the
outcome of the second event
36. Multiplication Rule
• If A and B are independent events, then
P(A and B) = P(A) x P(B)
• Ex. A = 3 on a die, B = Heads
P(3 and Heads) = P(A and B)
=P(A) x P(B)
=(1/6) x (1/2)
=1/12
• Always check that the events are
independent before using the multiplication
rule!
37. Multiplication Rule
• If we think in terms of the Venn Diagram,
then the probability for independent
events is just the area of the appropriate
rectangle
A
BA and B
Ac and Bc
P(A) P(AC)
P(B)
P(BC)
38. Using the diagram
• In fact, this diagram can be used for all
four of the relations! (pay attention to
the zeros)
• COMPLIMENTS:
A
B0
0
P(A) P(AC)
P(B)
P(BC)
39. Using the diagram
• In fact, this diagram can be used for all
four of the relations! (pay attention to
the zeros)
• Disjoint:
A
B0
AC and Bc
P(A) P(AC)
P(B)
P(BC)
40. Using the diagram
• In fact, this diagram can be used for all
four of the relations! (pay attention to
the zeros)
• Implied:
0
BA and B
AC and Bc
P(A) P(AC)
P(B)
P(BC)
41. Using the diagram
• This is the “Normal” diagram.
• Multiply the edges to find the small box
probabilities
A
BA and B
AC and Bc
P(A) P(AC)
P(B)
P(BC)
42. Using the diagram
• This is the “Normal” diagram.
• All four boxes add to 1
A and Bc
Ac and BA and B
AC and Bc
P(A) P(AC)
P(B)
P(BC)
45. Rules of Probability
1. 0 < P(A) < 1
2. P(S) = 1
3. If A and B are disjoint,
P(A or B) = P(A) + P(B)
4. P(AC) = 1 – P(A)
5. If A and B are independent
P(A and B) = P(A) x P(B)
46. General Addition Rule
• For any two events:
P(A or B) = P(A) + P(B) – P(A and B)
Let‟s examine this by looking at the four
possible event pairs
47. General Addition Rule
P(A or B) = P(A) + P(B) – P(A and B)
If the events are disjoint or
complimentary, P(A and B) = 0
B (or
AC )
48. A
BA and B
Ac and Bc
P(A) P(AC)
P(B)
P(BC)
General Addition Rule
If A and B are overlapping sets
P(A or B) = P(A) + P(B) – P(A and B)
49. A
BA and B
Ac and Bc
P(A) P(AC)
P(B)
P(BC)
General Addition Rule
If A and B are overlapping sets
P(A or B) = P(A) + P(B) – P(A and B)
50. A
BA and B
Ac and Bc
P(A) P(AC)
P(B)
P(BC)
General Addition Rule
P(A or B) = P(A) + P(B) – P(A and B)
If A and B are overlapping sets
Added twice!
Need to subtract
one of these!
55. Conditional Probability
• When two events are not independent,
then their probabilities are known as
“conditional”
• Notation: P(A | B)
reads “the probability of A given B”
this is “the probability that event A
occurs, if event B has already occurred”
56. Conditional Probability
• P(A and B) = P(A) x P(B|A)
• This should make sense:
“the probability that A and B occurs is the
probability of A occurs times the
probability that B occurs if A has
occurred.
• Really, this is just the multiplication
principle again!
57. Conditional Probability
• After rearranging the previous equation,
we arrive at the definition for conditional
probability:
A and B
(B | A)
A
P
P
P
58. Conditional Probability
• We also surmise a mathematical
definition for “independent events”
Two events are said to be independent if
both of the following are true
(1) P(B|A) = P(B)
and
(2) P(A|B) = P(A).
59. Tree Diagrams and Probability
• When multiple events occur, many times a
tree diagram is helpful in computing the
probabilities for each outcome of the
sample space.
• Outcomes are written on the “nodes”
• Probabilities are written on the “branches”
• Probabilities for all branches from the same
node must add to „1‟
• Probabilities of each outcome in the sample
space is a product of each branch in the
pathway
60. Tree Diagram and Probability
Of all high school male athletes who
attend college, 1.7% will become
professional athletes. Of the high school
male athlete who does not go to college,
.01% will go on to become professionals.
5% of all high school male athletes go to
college. What percent of high school
male athletes become professional
athletes?
61. Tree Diagrams and Probability
• Let‟s define events:
A = “a high school male athlete goes to
college”
B = “becomes a professional”
• Notice what AC and BC are.
64. Probability is product of the branches
P(A and B)
.05 x .017
.00085
P(A and BC)
.04915
P(ACand BC)
.949905
P(AC and B)
.000095
65. Tree Diagrams and Probability
• P(B) = P(A and B) + P(AC and B)
P(B) = .00085 + .000095
P(B) = .000945
summarize:
“.09% of all high school male athletes
become professionals”
66. Two way tables and probability
• An alternate way to work on these
problems is to use a two way table.
• Choose a sufficiently large number for
your population
• Use the multiplication property and the
complementary sets to complete the
table.
67. Two way tables and probability
A new test for disease “rawr” is
developed. If a patient has rawr the test
will give a positive result (the patient has
rawr) 98% of the time. Unfortunately, if
a patient does not have rawr, the test
will give a positive 1% of the time.
Approximately 4% of the population has
rawr.
68. Two way tables and probability
1- What percent of the population will get
a positive test result?
2- What is the probability that patient has
rawr if he gets a positive result?
69. Two way tables and probability
• Lets assume our population is 10000!
Positive Negative Total
Rawr
No Rawr
Total 10000
70. Two way tables and probability
• 4% of the population has Rawr.
Positive Negative Total
Rawr 400
No Rawr 9600
Total 10000
71. Two way tables and probability
• 98% of the “Rawrs” will test positive
Positive Negative Total
Rawr 392 8 400
No Rawr 9600
Total 10000
72. Two way tables and probability
• 1% of the “no Rawrs” will test positive
Positive Negative Total
Rawr 392 8 400
No Rawr 96 9504 9600
Total 10000
73. Two way tables and probability
• Do some quick addition
Positive Negative Total
Rawr 392 8 400
No Rawr 96 9504 9600
Total 488 9512 10000
74. Two way tables and probability
1- What percent of the population will get
a positive test result?
488/10000 = .0488
75. Two way tables and probability
2- What is the probability that patient has
rawr if he gets a positive result?
• P(rawr | positive result)
– Look at the table!
– 392/488 = .8033
• Conditional probability becomes conditional
distribution problem from chapter 4!
• These results of this example should worry
you. Why?