Introduction
In our last lesson, you implemented a direct, kinematics-based tally to score collision kerma, a significant step towards performing full dosimetric calculations with your Monte Carlo code. However, like any result from a stochastic simulation, this kerma value is a statistical estimate. A crucial question remains: how reliable is this estimate? A single number without a measure of its uncertainty is of limited value.
This lesson addresses that question directly. We will delve into the methods for assessing the statistical convergence and reliability of Monte Carlo tallies. You will learn how to compute the variance and relative error of your results, grounding these practical metrics in their theoretical underpinnings: the Law of Large Numbers and the Central Limit Theorem. By the end of this lesson, you will not only be able to quantify the uncertainty in your simulations but also understand the potential pitfalls of relying solely on simple statistical measures.
The Statistical Foundation of Monte Carlo Estimation
At its core, a Monte Carlo simulation is a numerical experiment. Each particle history contributes a "score" to a tally. The final tally result is the average of these scores over all histories. The Law of Large Numbers guarantees that as the number of histories, , approaches infinity, this sample average will converge to the true expected value of the quantity you are trying to measure.
More practically, the Central Limit Theorem (CLT) describes how this convergence happens. It states that for a sufficiently large number of histories, the distribution of the sample mean itself will be approximately a normal (Gaussian) distribution, regardless of the shape of the distribution of the individual history scores. This is a profoundly powerful result that forms the statistical basis for uncertainty estimation in all Monte Carlo methods.
To build a strong intuition for the CLT, please watch the following video from the StatQuest channel. It provides an excellent visual explanation of how sample means tend towards a normal distribution, even when drawing from non-normal populations.
The Central Limit Theorem, Clearly Explained!!!
This video, "The Central Limit Theorem, Clearly Explained!!!", visualizes the core concept of the CLT using animated examples.
Watch the video from the beginning to the end (full video). Pay close attention to how the distribution of sample means becomes Gaussian, first for a uniform distribution (uniform distribution example) and then for an exponential distribution (exponential distribution example).
The key takeaway is that because the mean is normally distributed, we can use the properties of the normal distribution—namely, its standard deviation—to define a confidence interval for our result.
Quantifying Uncertainty: Variance and Relative Error
Let's formalize this. Suppose we run a simulation with particle histories, and for a particular tally bin, the score from the -th history is . The estimated mean, , is simply:
The variance of the individual scores, , is estimated as:
According to the Central Limit Theorem, the quantity we are truly interested in is the variance of the mean, . This is related to the score variance by a crucial factor of :
The standard deviation of the mean, often called the standard error, is therefore . This is the statistical uncertainty of our tally result. The fact that the uncertainty decreases with the square root of the number of histories is the single most important rule in Monte Carlo statistics. To get 10 times more precision, you need to run 100 times more histories.
The following presentation slides provide a concise summary of these concepts.
[PDF] Introduction to the Monte Carlo simulation of radiation transport
These slides from a CERN course on Monte Carlo methods clearly illustrate the statistical nature of the results and the 1/\sqrt{N} convergence.
Read the section A numerical experiment (slides 19-23), which visually demonstrates the CLT in action, much like the video you just watched. Next, focus on the slides titled "Sum of IID random variables" and "Central Limit Theorem" (slides 25-27). This section provides the core mathematical result: uncertainty decreases as 1/sqrt(N). The slide explicitly links this behavior to the Central Limit Theorem.
A more convenient metric for practical use is the relative error, , defined as the standard error divided by the mean:
This expresses the uncertainty as a fraction of the estimated value, which is often more intuitive. The following images visually demonstrate this convergence.


Practical Implementation: Batch Statistics
Calculating the variance by storing every single history score can be prohibitively expensive in terms of memory, especially for simulations with billions of histories. A standard and memory-efficient technique is to use batch statistics.
The simulation is divided into batches, each containing histories (so the total is ). A mean score is calculated for each batch, let's call it for . The overall mean is then the average of these batch means:
The variance of the batch means is then calculated:
Since each is itself a mean, the variance of the overall mean is simply . This approach gives the same convergence but only requires storing the batch means, not the individual scores.
The CERN slides and the following video both discuss this practical approach.
[PDF] Introduction to the Monte Carlo simulation of radiation transport
This section of the slides describes how production codes like FLUKA implement batch statistics.
Read the section titled Single-history vs batch statistics (slide 27). It provides the exact formula for variance estimation using cycles (batches). Note the crucial point that you need at least two batches to estimate a variance.
Computational Physics Video 31 - Writing a Monte Carlo Radiation Transport Code
In this segment of his tutorial, the presenter modifies his simple Monte Carlo code to run the entire simulation multiple times (i.e., in batches) to calculate the standard deviation of the result.
Watch the section from this timestamp. The presenter wraps his entire simulation in an outer loop to perform 10 "runs". He stores the result from each run in an array and then calculates the standard deviation of that array. This is a direct implementation of the batch statistics method.
As a rule of thumb, a relative error (or 10%) is often considered "generally reliable," while values between 10% and 20% are "questionable," and anything above 50% is "garbage." These are merely guidelines, but they provide a useful starting point for judging your results.
When a Low Relative Error Is Not Enough
It is tempting to believe that once the relative error drops below a certain threshold (e.g., 1%), the result is "converged" and therefore correct. This is a dangerous misconception. A low relative error is a necessary, but not sufficient, condition for a reliable result.
The problem arises in simulations where rare events make a disproportionately large contribution to the tally. If the simulation is not run long enough to adequately sample these rare, high-score events from the "long tail" of the score probability distribution, the simulation will underestimate the true variance. The calculated relative error will appear small and stable, giving a false sense of convergence, while the mean value itself is systematically wrong.
A seminal paper by Forster and Booth from Los Alamos National Laboratory addresses this exact problem. It is a more advanced text, but its core message is critical for any serious Monte Carlo practitioner.
[PDF] A NEWMETHODTO ASSESS MONTE CARLO CONVERGENCE ...
This technical report introduces a method for detecting incomplete sampling by analyzing the shape of the history score distribution.
First, read the Abstract to get a high-level overview of the problem and the proposed solution. Next, read Section VIII, MCNP Test Problem Results and Analysis. This section presents a striking example where a point detector tally appeared to be converged with a relative error of 4.1%, but the result was actually wrong by a factor of four. This is the cautionary tale. Finally, read the Concluding Remarks. The final sentence perfectly summarizes the issue: the most difficult problems are those where the tally has an important, but improbable, portion that has not yet been sampled.
The authors propose that to trust a result, one must not only check the relative error but also examine the shape of the empirical probability density function (PDF) of the history scores, . For the variance to be finite (a requirement of the CLT), the tail of this distribution must fall off sufficiently fast (specifically, faster than ). If a log-log plot of the score PDF doesn't show this decreasing trend, it's a clear warning sign that the simulation has not run long enough to "completely" sample the problem, and the calculated mean and variance cannot be trusted.
Practical Exercise
Let's apply these concepts to your kerma tally. You will modify your code to implement batch statistics and analyze the convergence of your result.
Task:
- Modify Your Code: Structure your main simulation loop to run in batches. For example, create an outer loop that runs for batches and an inner loop that simulates histories per batch (for a total of histories).
- Implement Batch Statistics:
- For each of the batches, calculate and store the average kerma in a specific spatial bin (e.g., one near the center of the slab).
- After all batches are complete, calculate the overall mean kerma and the standard error of the mean using the formulas for batch statistics.
- Compute the final relative error.
- Analyze Convergence:
- Create a plot showing the evolution of the relative error as a function of the number of total histories. To do this, after each batch , calculate the relative error based on the first batches and plot this value against the total number of histories run so far ().
- Plot this on a log-log scale. You should observe a trend with a slope of approximately -1/2, visually confirming the convergence.
This exercise will give you a robust framework for quantifying the uncertainty in any tally you implement and a diagnostic tool for checking the health of your simulation's convergence.
Conclusion
You have now moved beyond simply generating a result to critically assessing its statistical quality. This is a vital skill for anyone using Monte Carlo methods for serious analysis.
Key Takeaways:
- Monte Carlo results are statistical estimates governed by the Law of Large Numbers and the Central Limit Theorem (CLT).
- The statistical uncertainty of a tally, or standard error, is given by , meaning precision improves slowly with the number of histories.
- Relative error is a practical metric for quantifying uncertainty, and batch statistics is a memory-efficient way to calculate it.
- A low relative error is necessary but not sufficient to guarantee a correct result. Incomplete sampling of rare, high-impact events can lead to a misleadingly low error and a systematically wrong answer.
Preview of the Next Lesson:
We have identified a potential weakness in relying on relative error alone. The next logical step is to develop more sophisticated tools to diagnose these "pathological" convergence problems. In the next lesson, we will "Examine tally distribution shape and variance of the variance to verify the reliability of Monte Carlo results." This will involve implementing the check on the score distribution's shape proposed by Forster & Booth and exploring another statistical test to build a comprehensive toolkit for ensuring your simulation results are trustworthy.