KAHIBARO
Discord Login Register

28.6. Statistical Uncertainties

Understanding Statistical Uncertainties in Geant4

Statistical uncertainties are inherent in any Monte Carlo simulation, including Geant4. Every result you obtain from a finite number of simulated events carries a random fluctuation. In this chapter you learn how to recognize, quantify, and interpret these fluctuations so that you can decide when a simulation has been run long enough and how reliable your numbers are.

Why Statistical Uncertainties Appear

Geant4 uses Monte Carlo techniques. Each event is one random realization of the underlying physics. Even if your geometry, physics list, and source definition are perfect, repeated runs with different random seeds will not produce exactly the same results. The spread between these repeated runs reflects the statistical uncertainty.

This type of uncertainty is different from systematic uncertainties, such as incorrect material definitions or bad physics choices. Systematic effects do not average out with more events, but statistical fluctuations do. Statistical uncertainties shrink when you simulate more events, which makes them controllable.

Event Counts and Poisson Statistics

Many quantities in a Geant4 simulation are simple event counts. Examples are the number of photons that pass through a shield, the number of events that hit a detector, or how many protons stop inside a certain volume. For these counts, the underlying statistics are usually Poissonian.

If $N$ is the number of counts in a bin or in a detector, the standard statistical uncertainty on that count is
$$
\sigma_N = \sqrt{N}.
$$

The relative statistical uncertainty is then
$$
\frac{\sigma_N}{N} = \frac{1}{\sqrt{N}}.
$$

This tells you that if you want to reduce the relative uncertainty by a factor of 2, you need 4 times more counts in that bin.

For a count $N$ that follows Poisson statistics, the standard uncertainty is $\sigma_N = \sqrt{N}$ and the relative uncertainty is $\sigma_N / N = 1 / \sqrt{N}$.

For very small counts, especially $N \lesssim 10$, these simple formulas become less accurate, and more careful methods can be used, but for an introductory level they are adequate. The important idea is that uncertainties on pure counts are closely related to the square root of the number of counts.

Averages and Their Uncertainties

In many Geant4 analyses you are not just counting events, you are averaging a quantity over events or over steps. Typical examples are mean deposited energy per event, mean depth of interaction, or mean path length.

Suppose you have $N$ independent events, and for each event $i$ you measure a quantity $x_i$, such as the deposited energy in a detector. The sample mean is
$$
\bar{x} = \frac{1}{N} \sum_{i=1}^{N} x_i.
$$
The sample variance is
$$
s^2 = \frac{1}{N - 1} \sum_{i=1}^{N} (x_i - \bar{x})^2.
$$
The standard deviation is $s = \sqrt{s^2}$, and the uncertainty on the mean, also called the standard error, is
$$
\sigma_{\bar{x}} = \frac{s}{\sqrt{N}}.
$$

For $N$ independent samples $x_i$ with mean $\bar{x}$ and sample standard deviation $s$, the standard uncertainty on the mean is
$$
\sigma_{\bar{x}} = \frac{s}{\sqrt{N}}.
$$

In Geant4 you typically accumulate sums and sums of squares in your analysis code, for example in RunAction or EventAction. From these, after the run you can compute the mean and its uncertainty using the formulas above.

Histograms and Bin Uncertainties

When you use the Geant4 analysis system to create histograms, each bin collects contributions from many events. If you are simply counting entries, bin contents follow the Poisson approximation and the standard deviation of a bin with content $N$ is about $\sqrt{N}$.

If you fill a histogram with weighted entries, for example when each event has a weight or when you store energy that varies event by event, the situation is slightly different. In that case, the bin content is a sum of weights,
$$
S = \sum_{i=1}^{N_{\text{bin}}} w_i,
$$
and you can accumulate also the sum of squared weights
$$
Q = \sum_{i=1}^{N_{\text{bin}}} w_i^2.
$$
The variance of the bin content is then
$$
\sigma_S^2 = Q.
$$
The standard uncertainty on the bin content is
$$
\sigma_S = \sqrt{Q}.
$$

Some analysis backends, such as ROOT, handle these details for you and store the errors of histogram bins automatically. The important point is that every histogram bin has an associated uncertainty that you must consider when you interpret peaks, valleys, or small differences between simulations.

Combining Statistical Uncertainties

Often you compare two results to see if they are significantly different, for instance two shielding materials or two physics lists. If you have two independent measurements, $A \pm \sigma_A$ and $B \pm \sigma_B$, and you want the uncertainty on their difference $D = A - B$, then the uncertainties combine in quadrature,
$$
\sigma_D = \sqrt{\sigma_A^2 + \sigma_B^2}.
$$

This is true only if the two measurements are statistically independent. Independent runs with different random seeds are a good approximation of this. If you form sums or ratios, similar rules apply.

For a sum $S = A + B$, the uncertainty is
$$
\sigma_S = \sqrt{\sigma_A^2 + \sigma_B^2}.
$$

For a product $P = A B$, the relative uncertainty is
$$
\left(\frac{\sigma_P}{P}\right)^2 = \left(\frac{\sigma_A}{A}\right)^2 + \left(\frac{\sigma_B}{B}\right)^2.
$$

For a ratio $R = A / B$, the relative uncertainty is
$$
\left(\frac{\sigma_R}{R}\right)^2 = \left(\frac{\sigma_A}{A}\right)^2 + \left(\frac{\sigma_B}{B}\right)^2.
$$

For independent quantities, uncertainties add in quadrature. For a sum or difference,
$$
\sigma_{A \pm B} = \sqrt{\sigma_A^2 + \sigma_B^2}.
$$
For a product or ratio, relative uncertainties add in quadrature,
$$
\left(\frac{\sigma_{A B}}{A B}\right)^2 = \left(\frac{\sigma_A}{A}\right)^2 + \left(\frac{\sigma_B}{B}\right)^2.
$$

These rules let you propagate statistical uncertainties from basic quantities, such as counts and sums, to more complex quantities, such as efficiencies or attenuation coefficients.

Confidence Intervals and Significance

A single standard deviation, often written as $1\sigma$, is a measure of spread, but it also relates to confidence levels if the distribution is approximately Gaussian. For a quantity with measured value $x$ and uncertainty $\sigma_x$, the interval $x \pm \sigma_x$ contains the true value with about 68 percent probability, assuming many repeated experiments and no systematic errors. The interval $x \pm 2\sigma_x$ corresponds to about 95 percent probability.

When you compare two results, the difference is often considered statistically significant if it exceeds a few times the combined uncertainty. For example, if $A - B$ is about $3 \sigma_D$ away from zero, many fields treat that as strong evidence that the two values are different.

You can apply this idea to Geant4 by asking whether differences between two simulated configurations are larger than the combined statistical uncertainties. If the differences are much smaller than the uncertainties, they are probably just random fluctuations.

Practical Use in Geant4 Runs

In practice, you will use these concepts in your Geant4 applications in a few common situations.

When you record a quantity per event, such as energy deposited in a detector, accumulate both the sum and the sum of squares over events, and keep track of the number of events. At the end of the run, compute the mean and its uncertainty using the formulas for sample mean and standard error. Print both value and uncertainty, for example as Edep = 1.23 MeV +/- 0.04 MeV.

When you analyze histograms, remember that each bin has an uncertainty. For simple count histograms, treat the standard uncertainty as the square root of the bin content. For histograms with weights, rely on your analysis backend to provide bin errors, or accumulate sums of weights and sums of squared weights yourself.

When you design a simulation, decide in advance how small the statistical uncertainty must be for your purpose. Then estimate how many events you need to reach that precision. The relation that statistical uncertainty scales roughly as $1/\sqrt{N}$ tells you that beyond a certain point, improving precision becomes expensive in terms of computing time. You must balance desired precision and available resources.

By systematically computing and reporting statistical uncertainties in your Geant4 simulations, you make your results more transparent and reliable, and you create a solid foundation for the validation steps that follow.

Views: 9

Comments

Please login to add a comment.

Don't have an account? Register now!