Skip to content

Home / Monte Carlo / Additional Tools / Sampling Matrices / Math Details

Math Details

How each of the three matrices is built. What the tool produces is on Sampling Matrices, and every control is on Options.

This is not a simulation. It reads no model and touches no marked workbook. It writes a plan you take away and run experiments against.

What every matrix has in common

Rows are cases, columns are factors, and every value lies strictly between 0 and 1. Neither endpoint is ever produced, so an inverse distribution function on the worksheet is never handed a 0 or a 1.

With \(n\) cases, each column is divided into \(n\) equal slices

\[ \left[\frac{i-1}{n},\; \frac{i}{n}\right), \qquad i = 1 \ldots n \]

and each method decides where in a slice its point sits and how the points are ordered down the column.

Descriptive Sampling

One point per slice, at the slice midpoint:

\[ x_i = \frac{i - 0.5}{n} \]

so the set of values in a column is fixed and only their order varies. The column is then shuffled.

Latin Hypercube

One point per slice, drawn at random inside the slice, rather than at its midpoint:

\[ x_i = \frac{i - 1 + u_i}{n}, \qquad u_i \in (0, 1) \]

Every column draws its own points and every column is shuffled independently, including the first.

The shuffle is a Fisher-Yates draw from one seeded stream, so every ordering is equally likely and the same seed reproduces the same matrix bit for bit.

Sobol

A quasi-random sequence rather than a shuffled stratification: the points are chosen so that they spread evenly in every dimension at once, using an embedded direction-number table.

The case count must be a power of two. One point per slice in every dimension holds at \(2^m\) points and not between powers of two, which is the reason to choose Sobol at all. A count that is not a power of two is refused rather than rounded.

The limits

One set of limits for every build. A count outside them is refused by name and never quietly clamped or rounded.

Descriptive Sampling and Latin Hypercube Sobol
Cases 2 to 20,000 16 to 32,768, and a power of two
Factors 1 to 250 1 to 1,000

Sobol's factor cap is the size of the embedded direction-number table.

What the previous version got wrong

Recorded because a matrix from v17 will not match one from v18, and the difference is not a regression.

v17 behaviour Now
Latin Hypercube copied the first column's points into every column, making it Descriptive Sampling with random points instead of midpoints each column draws its own point inside each slice
the first column was never reordered, so case 1 always held the smallest value of the first factor every column is reordered, the first included
the reorder picked its swap partner from the whole range at every step, which does not make every ordering equally likely, and no seed was set so a matrix could not be recreated a correct Fisher-Yates from one seeded stream, and the same seed gives the same matrix

See Also