Learn more from fewer runsLesson 48 of 76 · 9 min

Spread points with randomised Sobol sampling

Compare randomised quasi-Monte Carlo estimates using independent scrambles.

Quasi-Monte Carlo points are designed to cover a domain more evenly than ordinary independent random points. A scrambled Sobol sequence introduces randomisation while retaining useful structure. It is a different sampling design, so the ordinary iid point-level error formula is not automatically appropriate.

Use a power-of-two point count with random_base2 to preserve the sequence’s balance properties. Each independent scramble produces one estimate. The spread across those estimates provides evidence about randomisation error for this experiment.

The example integrates a smooth two-dimensional function with known answer. Smoothness, dimension, variable ordering and discontinuities can all affect performance. Better coverage in one illustration does not imply every integrand or tail event will improve. Retain the method, scramble seeds and evaluation budget in the record.

Replicate whole randomised point sets
  1. One scrambled set
    210=1024  points2^{10}=1024\;\text{points}
  2. One integral estimate
    I^r\widehat I_r
  3. Independent scrambles
    SD⁡(I^1,…,I^20)\operatorname{SD}(\widehat I_1,\ldots,\widehat I_{20})
Reference illustration. Points within a Sobol set are deliberately structured, not iid observations. Estimate numerical variability across independent scrambles; 1024 points within one set are not 1024 independent estimates.

Should the structured points inside one scramble be treated as iid draws for the ordinary standard-error formula?

Write a prediction (optional)

Seeded teaching simulation

Select Run Python below with the code unchanged.

Tools
About Python ↗

The code is editable. Press Ctrl+Enter or ⌘+Enter to run Python from the editor.

Published example output

This result comes from the original Python. Your runs appear above. Build environment ↗

Exact integral: 2.952492
Scrambled Sobol mean / replicate SD: 2.952461 8.8e-05
Ordinary mean / replicate SD: 2.954853 0.046355
Points per estimate: 1024

Read the first result

The independent units for the displayed comparison are whole randomised estimates. Their count is twenty, not 20 times 1024 iid points.

Try an edit

Replace np.exp(points.sum(axis=1)).mean() with (points.min(axis=1) > .95).mean() and np.exp(rng.random((1024, 2)).sum(axis=1)).mean() with (rng.random((1024, 2)).min(axis=1) > .95).mean() and round((np.e-1)**2, 6) with round(.05**2, 6). Select Run Python again. Compare the second numbers in the two mean / replicate SD rows. They measure repeat spread when each trial counts points from the small region where both coordinates exceed 0.95.

Back to the Python editor

Scope. Replicate spread estimates randomisation error, not model uncertainty. Few scrambles and rare discontinuous events can still give unstable evidence.

Try a fresh case

What is a defensible basic error check for this randomised QMC experiment?

Choose an answer
Need a hint?
Hint 1

Locate where independent randomisation enters.

Hint 2

Keep the structured sample together as one replicate.

Your notes