stats chapter 6
DESCRIPTION
TRANSCRIPT
Chapter 6
Probability and Simulation
6.1 SIMULATION
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”
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
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’
Penultimate Last thoughts
• Make sure you follow through all 5 steps when you perform a simulation
• It may be helpful to list all possible outcomesCoin 1 Coin 2 OutcomeHeads Heads HHHeads Tails HTTails Heads THTails Tails TT
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 outcome16 42 failure17 12 success
Assignment 6.1
Pg. 397 #1, 3, 5, 9, 13, 19
6.2 PROBABILITY MODELS
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
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)
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’
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
Tree Diagram
Tree Diagram
Event #1‘Heads’ or ‘Tails’
Tree Diagram
Event #2#1 - #6Notice that each of the outcomes from Event #1 branches to all outcomes of Event #2
Tree Diagram
Sample Space
It does not matter what order the events are placed in the tree!
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
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
Assignment 6.2A
• Pg 411 #23, 24, 27-29, 33, 35, 36
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
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
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!
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)
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)
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 = { }”
THE FOUR RELATIONS
• Two events can be related in one of four ways:
1. Complimentary Events2. Disjoint Events3. Implied Events4. Independent Events
Terminology
Complimentary Events A and AC - Either A occurs or AC
occurs
B (or AC )
Terminology
Disjoint EventsIf A occurs, then B does not occur.If B occurs, then A does not occur.
Terminology
Implied Events• All the outcomes for one event are
contained in another event• If B happens, then A also happens
SA
B
Terminology
Independent Events• Events share outcomes• It is possible that an outcome
qualifies event A and event B
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)
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 AA
# of outcomes in S# of outcomes in A
P
k
Equally likely outcomes
• What is the probability of drawing a ‘King’ from a standard deck of cards
• Let A = drawing a kingA = {King of Spades, King of Diamonds, King of Clubs, King of Hearts}
# of outcomes in AA
# of outcomes in S4 1
52 13
P
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
Multiplication Rule
• If A and B are independent events, thenP(A and B) = P(A) x P(B)
• Ex. A = 3 on a die, B = HeadsP(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!
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)
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)
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)
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)
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)
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)
Assignment 6.2B
• Pg 423 #37, 39, 43, 44
6.3 GENERAL PROBABILITY RULES
Rules of Probability
1. 0 < P(A) < 12. P(S) = 13. 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)
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
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 )
A
BA and B
Ac and Bc
P(A) P(AC)
P(B)
P(BC)
General Addition Rule
If A and B are overlapping setsP(A or B) = P(A) + P(B) – P(A and B)
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)
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!
General Addition Rule
• Implied eventsP(A or B) = P(A) + P(B) – P(A and B)
SA
B
General Addition Rule
• Implied eventsP(A or B) = P(A) + P(B) – P(A and B)
SA
B
General Addition Rule
• Implied eventsP(A or B) = P(A) + P(B) – P(A and B)
SA
B
Added Twice! We must subtract it out.
Assignment 6.3A
• Page 430 #45-49 odd, 61, 66, 67, 69
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”
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!
Conditional Probability
• After rearranging the previous equation, we arrive at the definition for conditional probability:
A and B(B | A)
A
PP
P
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).
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
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?
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.
Tree Diagrams and Probability
Tree Diagrams and Probability
Branches from the samenode add to ‘1’
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
Tree Diagrams and Probability
• P(B) = P(A and B) + P(AC and B)P(B) = .00085 + .000095P(B) = .000945
summarize:“.09% of all high school male athletes become professionals”
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.
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.
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?
Two way tables and probability
• Lets assume our population is 10000!
Positive
Negative
Total
Rawr
No Rawr
Total 10000
Two way tables and probability
• 4% of the population has Rawr.
Positive
Negative
Total
Rawr 400
No Rawr 9600
Total 10000
Two way tables and probability
• 98% of the “Rawrs” will test positive
Positive
Negative
Total
Rawr 392 8 400
No Rawr 9600
Total 10000
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
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
Two way tables and probability
1- What percent of the population will get a positive test result?488/10000 = .0488
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?
Assignment 6.3B
• P441 #70-73, 80-83, 86(a)-(d), 87, 90, 91