STAT5002 Chap.6 Probability Rules and Simulation
Probability Rules and Simulation
Probability is the language every later topic in the unit is written in, from the box model to p-values, so this chapter makes the basic rules automatic. You start with the frequentist meaning of probability as a long-run proportion, then the set notation the notes use: the sample space, events, complements, unions and intersections. Four rules carry almost every calculation.
The complement rule turns hard "at least one" questions into easy "none" questions. Conditional probability, P(A | B) = P(A ∩ B) / P(B), restricts attention to the cases where B happened. The multiplication rule gives the chance that both events occur, and the addition rule gives the chance that at least one occurs once the overlap is subtracted.
The heart of the chapter is a clinic on two ideas that students routinely merge: mutually exclusive events cannot happen together, while independent events do not change each other's chances. A counter-example shows that two exclusive events with positive probability are always dependent, and a side-by-side grid lists which shortcut each condition allows. The last part moves to R.
You model a chance process as a box of tickets, draw from it with sample(), choose between replace = TRUE and replace = FALSE, wrap one experiment in a function and repeat it with replicate(). Taking mean() of the TRUE and FALSE results gives a simulated probability you can compare with the exact answer from the multiplication rule.
Along the way you will see the classic slip of multiplying unchanged chances when draws are made without replacement, and why the with-replacement answer is a different, larger number in that example. A library loans picture turns conditional probability into areas you can see. All scenarios and numbers are our own.
What this chapter covers
- 01
Frequentist definition of probability
- 02
Sample space, events, union, intersection and complement
- 03
Complement rule for at least one questions
- 04
Conditional probability as a share of the conditioning event
- 05
Multiplication rule, general and independent forms
- 06
Addition rule, general and mutually exclusive forms
- 07
Mutually exclusive versus independent events
- 08
Why exclusive events are dependent
- 09
Box models with and without replacement
- 10
Simulating probabilities in R with sample() and replicate()
Worked example · free
Bus then train: combining two chances that depend on each other
- +1Multiplication rule: P(both late) = P(bus late) × P(train late | bus late) = 0.2 × 0.5 = 0.10.
- +1Addition rule: P(at least one late) = 0.2 + 0.3 − 0.10 = 0.40. The overlap is subtracted once because it was counted in both terms.
- +1Complement: P(neither late) = 1 − 0.40 = 0.60.
- +1Independence check: P(train late | bus late) = 0.5 but P(train late) = 0.3. They differ, so the delays are not independent; equivalently 0.2 × 0.3 = 0.06, which is not 0.10.
- +1Conditional probability: P(bus late | train late) = P(both late) / P(train late) = 0.10 / 0.3 = 0.333.
Key terms
- Sample space
- The set of everything that can occur in a chance process, written Ω; every event is a subset of it.
- Complement
- The event that A does not occur, written Aᶜ, with probability 1 − P(A).
- Conditional probability
- The chance that A occurs given that B has occurred, equal to P(A ∩ B)/P(B) when P(B) is not zero.
- Mutually exclusive events
- Events that cannot occur together, so P(A ∩ B) = 0 and the addition rule reduces to P(A) + P(B).
- Independent events
- Events where one occurring does not change the chance of the other, so P(A ∩ B) = P(A)P(B), or equivalently P(A | B) = P(A).
- Sampling without replacement
- A way of drawing from a box where tickets are not put back, so each draw changes the box and the draws are dependent.
- Random seed
- A starting value set with set.seed() so that a simulation in R produces the same random draws every time it is run.
Probability Rules and Simulation FAQ
What is the difference between mutually exclusive and independent events?
Mutually exclusive events cannot both happen, so their joint probability is zero. Independent events can happen together, and knowing one occurred leaves the chance of the other unchanged. Two exclusive events that each have positive probability are therefore always dependent.
When can I just multiply two probabilities together?
Only when the events are independent, for example separate draws made with replacement. In general the multiplication rule is P(A) times P(B given A), so if the first outcome changes the second chance you must use the conditional value.
How do I work out the probability of at least one success?
Work out the chance of no successes and subtract it from one. With independent trials, the chance of none is the failure probability raised to the number of trials. Adding the single-trial chances overcounts, and can even exceed one.
Why should I call set.seed() before simulating in R?
Functions such as sample() produce different random draws on every run, so a simulated probability changes slightly each time. Setting a seed first fixes the starting point, which means you, a marker or a classmate can rerun the code and see exactly the same table and proportion.
What does replace = FALSE do in sample() in R?
It draws tickets from the box without putting them back, so each draw changes what is left and the draws become dependent. Use replace = TRUE to model repeated independent trials such as die rolls or coin tosses.
Exam move
Write the four rules (complement, conditional, multiplication, addition) on one card, each with its general form and its shortcut, and next to each shortcut write the condition it needs. Practise on two-way count tables you invent: compute a joint probability, both conditionals and the product of the marginals, then decide on independence from the numbers rather than from intuition.
For every pair of events you meet, ask separately whether they can overlap and whether one changes the chance of the other. In R, write a five-line simulation for a problem you can also solve exactly, run it with set.seed(), compare mean() of the results with your hand answer, then switch between replace = TRUE and replace = FALSE and explain the change in one sentence.
Working through Probability Rules and Simulation in STAT5002? Sia is AskSia’s AI Statistics tutor — ask any STAT5002 Probability Rules and Simulation question and get a clear, step-by-step explanation grounded in how STAT5002 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.
STAT5003 Computational Statistical Methods · DATA2002 Data Analytics: Learning from Data · QBUS5001 Foundation in Data Analytics for Business