The Central Idea

Suppose an experiment is repeated \(n\) times and an event \(A\) occurs \(x\) times.

The observed relative frequency is

\[ \boxed{ \widehat P(A)=\frac{x}{n} }. \]

This value is an empirical probability: a probability estimate based on observed outcomes rather than a theoretical model alone.

Theoretical Probability

A theoretical probability is obtained from a probability model.

For a fair coin,

\[ P(H)=\frac12. \]

This value comes from the assumed model of a fair coin.

It does not require us to toss the coin first.

Empirical Probability

Empirical probability is calculated from actual or simulated observations.

If a coin is tossed \(100\) times and heads occurs \(47\) times, then

\[ \widehat P(H) = \frac{47}{100} = \boxed{0.47}. \]

The hat in

\[ \widehat P \]

emphasizes that this is an estimate rather than the exact theoretical probability.

Theoretical and Empirical Probabilities Need Not Match Exactly

Even if the true model has

\[ P(H)=0.5, \]

a finite set of tosses rarely produces exactly half heads.

Results such as

\[ 47/100,\qquad 52/100,\qquad 493/1000 \]

are all possible empirical outcomes.

Random variation is expected.

Relative Frequency

The relative frequency of an event is

\[ \boxed{ \text{relative frequency} = \frac{\text{number of event occurrences}} {\text{number of trials}} }. \]

Relative frequency is the basic numerical bridge between repeated observations and probability.

Example: Empirical Die Probability

A die is rolled \(240\) times.

The result \(6\) occurs \(34\) times.

The empirical probability of rolling a \(6\) is

\[ \widehat P(6) = \frac{34}{240} = \boxed{\frac{17}{120}\approx0.1417}. \]

Empirical Probability Is Data-Dependent

If the experiment is repeated again, the empirical probability may change.

For example, one batch of \(100\) trials might give

\[ \widehat P(A)=0.46, \]

while another gives

\[ \widehat P(A)=0.53. \]

Empirical probability is a statistic computed from a particular set of observations.

What Is a Simulation?

A simulation imitates a random experiment using another controlled random mechanism.

A simulation may use:

The simulation mechanism must reproduce the probabilities and dependencies of the target experiment.

Simulation as a Model of a Model

A simulation is not automatically the real process itself.

Instead, it represents the probability structure of a chosen model.

A good simulation preserves:

Example: Simulating a Fair Coin

A fair coin toss can be simulated using a random digit from

\[ \{0,1,\ldots,9\}. \]

Assign

\[ 0,1,2,3,4\longrightarrow H \]

and

\[ 5,6,7,8,9\longrightarrow T. \]

Five of the ten equally likely digits represent heads and five represent tails, so the simulation preserves the probability

\[ P(H)=P(T)=\frac12. \]

Example: Simulating a Biased Coin

Suppose

\[ P(H)=0.7, \qquad P(T)=0.3. \]

Using random digits \(0\) through \(9\), assign seven digits to heads:

\[ 0,1,2,3,4,5,6\longrightarrow H \]

and three digits to tails:

\[ 7,8,9\longrightarrow T. \]

The mapping reproduces the \(0.7/0.3\) model.

Probability Must Match the Random-Number Allocation

If equally likely random digits are used, the proportion of assigned digits must match the desired probability.

For a probability of

\[ 0.4, \]

four of ten digits can represent success.

For a probability of

\[ 0.37, \]

two-digit numbers from \(00\) through \(99\) provide a convenient scale: assign \(37\) of the \(100\) values to success.

Example: Simulating a \(37\%\) Event

Generate a random integer from

\[ 00,01,\ldots,99. \]

Define success as

\[ 00\text{ through }36. \]

There are \(37\) success values among \(100\) equally likely values.

Therefore,

\[ P(\text{success})=\frac{37}{100}=0.37. \]

Simulation of Multistage Experiments

A multistage random experiment requires several simulated random choices per trial.

For example, two coin tosses require two simulated coin outcomes.

A single simulation trial might produce

\[ HT. \]

The complete pair, not each individual toss, is one trial of the two-toss experiment.

Example: Simulating Two Dice

Two fair dice can be simulated by generating two independent random integers from

\[ \{1,2,3,4,5,6\}. \]

One generated pair such as

\[ (3,5) \]

represents one simulated two-dice trial.

Repeating the process produces empirical estimates of events such as sums, doubles, or maximum values.

Example: Estimating the Probability of Sum Seven

Suppose a simulation of two fair dice runs \(10{,}000\) trials.

A sum of \(7\) occurs \(1{,}641\) times.

Then

\[ \widehat P(\text{sum }7) = \frac{1641}{10000} = \boxed{0.1641}. \]

The theoretical probability is

\[ \frac16\approx0.1667. \]

The simulation estimate is close but not identical.

Simulation Error from Random Variation

A simulation estimate generally differs from the model probability because only finitely many random trials were generated.

This difference is often called simulation error or Monte Carlo error.

It is not necessarily a programming or arithmetic mistake.

More Trials Usually Produce Greater Stability

Small simulations can fluctuate substantially.

As the number of trials grows, relative frequencies often become more stable around the model probability.

For a fair coin, empirical proportions might look like:

\[ \frac7{10}=0.70, \] \[ \frac{54}{100}=0.54, \] \[ \frac{497}{1000}=0.497, \] \[ \frac{5008}{10000}=0.5008. \]

These values illustrate stabilization, not guaranteed monotonic movement.

Convergence Does Not Mean Steady Improvement

Relative frequency does not have to move closer to the theoretical probability after every additional trial.

It may move above, below, toward, or away from the target over short stretches.

Long-run stabilization is a large-scale pattern, not a step-by-step rule.

Example: Running Relative Frequency

Suppose heads occurs:

The running empirical probabilities are

\[ 0.60,\qquad0.55,\qquad0.48,\qquad0.51. \]

The sequence fluctuates around the theoretical value \(0.5\).

Running Frequency Versus Batch Frequency

A running relative frequency uses all observations collected so far.

A batch relative frequency uses only one separate group of trials.

These summaries answer different questions.

Running frequencies are especially useful for visualizing stabilization over time.

Simulation Can Approximate Difficult Probabilities

Some probabilities are difficult to calculate exactly.

Simulation can provide a practical approximation:

\[ \boxed{ P(A) \approx \frac{\text{simulated occurrences of }A} {\text{number of simulated trials}} }. \]

The approximation improves in reliability as the simulation design and number of trials improve.

Simulation Does Not Make an Invalid Model Correct

A large number of simulated trials cannot repair a poorly constructed model.

If the simulation assigns the wrong probabilities or dependencies, it will accurately approximate the wrong model.

Model design comes before trial count.

Example: Incorrect Simulation Mapping

Suppose an event should occur with probability

\[ \frac13. \]

A student uses one random digit from \(0\) through \(9\) and assigns

\[ 0,1,2\longrightarrow\text{success}. \]

This gives

\[ P(\text{success})=\frac3{10}=0.3, \]

not

\[ \frac13. \]

The simulation mapping is biased relative to the intended model.

Exact Simulation with Appropriate Random Units

To simulate a probability of \(1/3\) exactly, use a random mechanism with a number of equally likely outcomes divisible by \(3\).

For example, roll a fair six-sided die and assign

\[ 1,2\longrightarrow\text{success} \]

and

\[ 3,4,5,6\longrightarrow\text{failure}. \]

Then

\[ P(\text{success})=\frac26=\frac13. \]

Rejection Methods

Sometimes a convenient random device contains more outcomes than needed.

Extra outcomes can be rejected and redrawn.

For example, to simulate a fair six-sided die using random decimal digits:

The accepted values are equally likely.

Simulation of Dependence

If the target process contains dependence, the simulation must reproduce that dependence.

For draws without replacement, the probabilities must change after each simulated selection.

Treating every stage as independent would simulate a different experiment.

Example: Simulating Without Replacement

A bag contains \(3\) red and \(2\) blue objects. Two objects are drawn without replacement.

A correct simulation must remove the first simulated object before the second draw.

If the first draw is red, the second-stage composition becomes

\[ 2\text{ red},\quad2\text{ blue}. \]

If the first draw is blue, it becomes

\[ 3\text{ red},\quad1\text{ blue}. \]

The conditional probabilities differ by branch.

Simulation of Independent Trials

For independent repeated trials, each new trial uses the same probability model regardless of previous outcomes.

A simulation should therefore generate each trial independently from the same distribution.

Empirical Probability from Real Data

Empirical probability need not come from a simulation.

It can be calculated from observed real-world data.

If \(12\) of \(300\) inspected items are defective, then the empirical defect rate is

\[ \widehat P(\text{defective}) = \frac{12}{300} = \boxed{0.04}. \]

Observed Data and Simulated Data Are Different

Simulated data are generated from an assumed model.

Observed data come from the process being studied.

Simulation helps explore the consequences of a model.

Observed data help assess whether a model is plausible for the real process.

Model Checking with Empirical Frequencies

Suppose a model predicts

\[ P(A)=0.5. \]

Observing

\[ \widehat P(A)=0.48 \]

after many trials may be reasonably compatible with the model.

Observing

\[ \widehat P(A)=0.90 \]

over the same number of trials would raise stronger questions.

Formal statistical methods quantify such discrepancies more carefully.

Difference Between an Estimate and a Model Parameter

A model probability such as

\[ p=0.4 \]

is treated as a fixed parameter within the model.

An empirical estimate such as

\[ \widehat p=0.43 \]

changes from one sample or simulation run to another.

Sampling Variability

Different samples from the same model generally produce different empirical probabilities.

This phenomenon is called sampling variability.

It is an inherent consequence of randomness, not necessarily evidence that the model changed.

Example: Several Simulation Runs

Five simulations of \(100\) fair coin tosses might produce head proportions:

\[ 0.46,\qquad0.54,\qquad0.51,\qquad0.48,\qquad0.56. \]

All were generated from the same theoretical probability

\[ p=0.5. \]

The differences reflect sampling variability.

Larger Samples Usually Reduce Relative Variability

An empirical proportion based on \(10\) trials can vary widely.

One based on \(100{,}000\) trials is typically much more stable.

Increasing sample size does not eliminate randomness, but it reduces the scale of relative fluctuations in many standard settings.

Absolute Counts Can Vary More Even as Proportions Stabilize

A larger experiment can have a larger numerical difference between observed and expected counts while still having a more accurate proportion.

For example:

Yet the corresponding proportions are

\[ 0.60 \]

and

\[ 0.501. \]

The second proportion is much closer to \(0.5\).

Expected Count as a Benchmark

If an event has probability \(p\) and an experiment is repeated \(n\) times, a natural benchmark for the number of occurrences is

\[ \boxed{np}. \]

This is the expected count in the standard repeated-trial model.

The actual count need not equal \(np\).

Example: Expected Versus Observed Count

Suppose

\[ p=0.30 \]

and

\[ n=200. \]

The expected count is

\[ np=200(0.30)=60. \]

An observed count of \(57\), \(62\), or \(66\) may all occur in repeated experiments.

Simulation Can Approximate Expected Values

Although this section focuses on event probability, simulation can also estimate numerical averages.

Repeatedly simulate a random variable, record its values, and calculate the sample mean.

With enough trials under appropriate conditions, the sample mean often stabilizes near the theoretical expected value.

Monte Carlo Methods

Monte Carlo methods use random sampling to approximate mathematical quantities.

They can estimate:

Example: Estimating \(\pi\)

Generate points uniformly in the square

\[ [-1,1]\times[-1,1]. \]

Count the points satisfying

\[ x^2+y^2\le1. \]

The theoretical probability of landing inside the unit disk is

\[ \frac{\pi}{4}. \]

Therefore,

\[ \boxed{ \pi \approx 4 \left( \frac{\text{points inside disk}} {\text{total simulated points}} \right) }. \]

Simulation Is Useful When Exact Analysis Is Hard

Exact probability formulas may be difficult because of:

Simulation offers an approximate numerical route when analytic methods are inconvenient or unavailable.

Simulation Can Also Verify an Exact Calculation

Even when an exact probability is known, simulation can provide an independent reasonableness check.

If a theoretical calculation gives

\[ P(A)=0.25 \]

but a well-designed million-trial simulation repeatedly produces values near

\[ 0.70, \]

the model, code, or theoretical calculation should be reexamined.

Random Number Generators

Computer simulations typically use pseudorandom number generators.

These algorithms generate sequences designed to behave like random samples for statistical purposes.

The sequence is algorithmic, but it can still be suitable for many simulation tasks when the generator is appropriate.

Random Seeds

Many pseudorandom generators begin from an initial value called a seed.

Using the same seed can reproduce the same simulated sequence.

Reproducibility is useful for debugging, teaching, scientific comparison, and verifying computational results.

Reproducibility Versus Independent Replication

Reusing the same random seed reproduces a simulation.

Changing the seed produces another realization of the same model.

Both are useful:

Simulation Output Should Be Summarized

A simulation produces raw outcomes, but probability analysis requires summaries.

Useful summaries include:

Empirical Probability from a Frequency Table

Suppose observations are summarized as:

Outcome Frequency
A 42
B 31
C 27
Total 100

Then

\[ \widehat P(A)=0.42, \] \[ \widehat P(B)=0.31, \]

and

\[ \widehat P(C)=0.27. \]

Empirical Probabilities Form a Distribution

Relative frequencies across mutually exclusive exhaustive outcome categories sum to \(1\).

In the previous table,

\[ 0.42+0.31+0.27=1. \]

Thus empirical frequencies can define an observed probability distribution over the recorded categories.

Conditional Empirical Probability

Empirical conditional probability can be estimated from observed counts.

If \(B\) occurred \(80\) times and \(A\cap B\) occurred \(28\) times, then

\[ \widehat P(A\mid B) = \frac{28}{80} = \boxed{0.35}. \]

The denominator is the observed number of \(B\) cases.

Empirical Independence

Data can be examined for whether two events appear approximately independent.

Compare

\[ \widehat P(A\cap B) \]

with

\[ \widehat P(A)\widehat P(B). \]

Exact equality is not expected in finite data even if the underlying model is independent.

Approximate Agreement Is More Realistic in Data

Theoretical independence is an exact model statement:

\[ P(A\cap B)=P(A)P(B). \]

Empirical frequencies fluctuate.

Therefore, data analysis usually asks whether discrepancies are small enough to be compatible with sampling variation.

Formal statistical inference develops this question further.

Bias in Simulation Design

A simulation can be biased if its random mechanism systematically favors some outcomes.

Examples include:

Bias and Random Variation Are Different

Random variation causes estimates to fluctuate around the model target.

Bias systematically shifts the simulation or data-generating process away from the intended target.

More trials reduce random variation, but more trials do not remove a persistent design bias.

Example: More Trials Do Not Fix Bias

Suppose a “fair coin” simulation actually generates heads with probability

\[ 0.55. \]

As the number of simulated trials becomes large, the empirical head proportion will tend to stabilize near

\[ 0.55, \]

not \(0.50\).

Large sample size makes the wrong simulation more precisely wrong.

Simulation Assumptions Should Be Explicit

A high-quality simulation description should state:

Example: A Complete Simulation Plan

Estimate the probability of at least one \(6\) in four fair die rolls.

  1. Generate four independent random integers from \(1\) through \(6\).
  2. Call this group of four values one trial.
  3. Record success if at least one value equals \(6\).
  4. Repeat for a large number \(N\) of trials.
  5. Let \(X\) be the number of successful trials.
  6. Estimate the probability with \(X/N\).

The theoretical probability for comparison is

\[ 1-\left(\frac56\right)^4. \]

Simulation with a Stopping Rule

Some experiments continue until a specified event occurs.

A simulation must reproduce that stopping rule exactly.

For example, “toss until the first head” does not have a fixed number of tosses per trial.

Example: Toss Until First Head

One simulation trial proceeds:

  1. generate one fair coin result;
  2. if it is heads, stop;
  3. if it is tails, generate another result;
  4. continue until the first head;
  5. record the number of tosses required.

Repeating this trial estimates probabilities such as

\[ P(\text{first head occurs on toss }4). \]

Simulation Can Reveal Entire Distributions

Instead of recording only success or failure, a simulation can record a numerical outcome.

Repeated trials then produce an empirical distribution of those values.

This allows estimation of probabilities such as

\[ P(X\le x), \]

averages, quantiles, and other distribution features.

Common Error: Treating Empirical Probability as Exact

If an event occurs \(47\) times in \(100\) trials, then

\[ \widehat P(A)=0.47. \]

This does not prove that the true probability is exactly

\[ 0.47. \]

It is an estimate based on finite data.

Common Error: Expecting Exact Theoretical Proportions

A fair coin need not produce exactly \(50\) heads in \(100\) tosses.

Theoretical probability describes the model, not a rigid quota for every finite sample.

Common Error: Believing Outcomes Must “Catch Up”

If a fair coin produces many tails early, the next toss is still modeled with

\[ P(H)=\frac12. \]

The coin does not owe the experiment extra heads to force the cumulative proportion back toward \(0.5\).

This mistaken belief is related to the gambler's fallacy.

Common Error: Using Too Few Trials

A simulation with very few trials may produce a highly unstable estimate.

Small samples can still be useful for demonstration, but strong numerical conclusions generally require more evidence.

Common Error: Increasing Trials Without Checking the Model

More trials improve precision only for the model actually being simulated.

They do not correct:

Common Error: Confusing Simulation with Observation

Simulated outcomes come from an assumed probability mechanism.

Observed outcomes come from the real process under study.

The two can be compared, but they should not be treated as the same source of evidence.

Common Error: Ignoring Dependence

If later outcomes depend on earlier outcomes, generating all stages independently creates the wrong simulation.

Conditional structure must be modeled explicitly.

Common Error: Misreading Relative Frequency

A frequency of

\[ 18 \]

is a count.

A relative frequency of

\[ \frac{18}{60}=0.30 \]

is a proportion.

Probability comparisons should use the appropriate scale.

A Reliable Procedure for Empirical Probability

  1. Define the event of interest.
  2. Count the total number of observed trials.
  3. Count the number of trials in which the event occurred.
  4. Divide event count by total trial count.
  5. Report the value as an empirical estimate.
  6. Keep the sample size visible when interpreting the estimate.

A Reliable Procedure for Designing a Simulation

  1. State the target probability experiment.
  2. Identify the elementary random choices.
  3. Choose a random device or generator.
  4. Map generated values to outcomes with the correct probabilities.
  5. Preserve dependence, independence, replacement, and stopping rules.
  6. Define what counts as one complete trial.
  7. Define the event or numerical quantity to record.
  8. Repeat for many trials.
  9. Summarize with relative frequencies or other statistics.
  10. Compare with theory or observed data when appropriate.

Example: Full Empirical Workflow

A manufacturing process is observed for \(500\) items.

\(23\) items are defective.

The empirical defect probability is

\[ \widehat P(D) = \frac{23}{500} = \boxed{0.046}. \]

This estimates the defect probability for the process under the conditions represented by the observed data.

Example: Full Simulation Workflow

Estimate the probability of getting exactly two heads in three fair coin tosses.

  1. Generate three independent fair coin outcomes per trial.
  2. Record success when exactly two of the three outcomes are heads.
  3. Repeat for \(N\) trials.
  4. Let \(X\) be the number of successful trials.
  5. Estimate the probability with \(X/N\).

The theoretical probability is

\[ \frac38=0.375. \]

A large simulation should typically produce an estimate near this value.

Practice 1: Empirical Probability

An event occurs \(37\) times in \(125\) trials.

Find the empirical probability.

Practice 2: Frequency from an Empirical Probability

An event has empirical probability

\[ 0.24 \]

over \(200\) trials.

How many times did the event occur?

Practice 3: Fair Coin Simulation

Using random digits \(0\) through \(9\), give one valid mapping that simulates a fair coin.

Practice 4: Biased Event Simulation

Using random integers \(00\) through \(99\), describe a simulation mapping for an event with probability

\[ 0.28. \]

Practice 5: Compare Theory and Simulation

A theoretical model gives

\[ P(A)=0.40. \]

A \(1000\)-trial simulation produces \(A\) in \(417\) trials.

Find the empirical probability and the difference from the theoretical value.

Practice 6: Two-Dice Simulation

A simulation of two fair dice produces \(980\) doubles in \(6000\) trials.

Find the empirical probability of doubles.

Practice 7: Expected Count

An event has theoretical probability

\[ 0.15. \]

What is the expected count in \(800\) repeated trials?

Practice 8: Conditional Empirical Probability

Event \(B\) occurs \(90\) times in observed data.

Both \(A\) and \(B\) occur together \(27\) times.

Find the empirical estimate of

\[ P(A\mid B). \]

Practice 9: Detect a Simulation Error

A student wants to simulate an event with probability \(1/2\) using a fair six-sided die.

The student assigns

\[ 1,2\longrightarrow\text{success} \]

and

\[ 3,4,5,6\longrightarrow\text{failure}. \]

Is the mapping correct?

Practice 10: At Least One Success Simulation

Describe one simulation trial for estimating the probability of at least one head in four fair coin tosses.

Practice 11: Random Variation

Two independent simulations of \(100\) fair coin tosses produce head proportions \(0.46\) and \(0.55\).

Does this difference by itself imply that one simulation is invalid?

Practice 12: Identify the Error

A student says:

“I ran \(20\) trials and got an empirical probability of \(0.70\), so the true probability must be \(0.70\).”

Explain the error.

Practice Answers

Practice 1

\[ \widehat P(A) = \frac{37}{125} = \boxed{0.296}. \]

Practice 2

\[ x=0.24(200)=\boxed{48}. \]

Practice 3

One valid mapping is

\[ 0,1,2,3,4\longrightarrow H \]

and

\[ 5,6,7,8,9\longrightarrow T. \]

Each outcome receives \(5\) of the \(10\) equally likely digits.

Practice 4

Assign

\[ 00\text{ through }27 \]

to success and

\[ 28\text{ through }99 \]

to failure.

There are \(28\) success values among \(100\), so the success probability is \(0.28\).

Practice 5

\[ \widehat P(A) = \frac{417}{1000} = \boxed{0.417}. \]

The difference from the theoretical value is

\[ 0.417-0.400=\boxed{0.017}. \]

Practice 6

\[ \widehat P(\text{doubles}) = \frac{980}{6000} = \boxed{\frac{49}{300}\approx0.1633}. \]

Practice 7

\[ np = 800(0.15) = \boxed{120}. \]

Practice 8

\[ \widehat P(A\mid B) = \frac{27}{90} = \boxed{0.30}. \]

Practice 9

No. The proposed success probability is

\[ \frac26=\frac13, \]

not \(1/2\).

A correct fair-coin mapping could assign three die faces to success and three to failure.

Practice 10

Generate four independent fair coin outcomes. Record the trial as a success if at least one of the four outcomes is heads, and as a failure only if all four are tails.

Practice 11

No. Different empirical proportions are expected because of random variation. Both simulations may be valid realizations of the same \(p=0.5\) model.

Practice 12

An empirical probability from \(20\) trials is an estimate based on a small sample. Random variation can make it differ substantially from the underlying theoretical or long-run probability.

The result

\[ 0.70 \]

does not prove that the true probability is exactly \(0.70\).

What to Remember

Empirical probability is based on observed relative frequency:

\[ \boxed{ \widehat P(A) = \frac{\text{number of observed occurrences of }A} {\text{number of trials}} }. \]

Simulation generates repeated artificial trials from a stated probability model.

The most important habit is: separate the probability model from the finite random data generated by that model.

Where We Go Next

Simulation shows that empirical frequencies fluctuate from trial to trial but often become increasingly stable when many observations are accumulated.

The next lesson, Long-Run Frequency, examines this stabilization more carefully and develops the interpretation of probability as a limiting pattern in repeated random experiments.