If the 2-D sample space is not regular, it may cause asymmetry in probability during a random walk. This algorithm rearranges the sample space to a new array with nRow
rows and nCol
columns.
m = 2;
funcLogic = @(data1, data2) ((0 <= data1 + data2) & (data1 + data2 <= m));
Irregular sample space caused by the above condition:
(0, 3)
(0, 2) (1, 2)
(0, 1) (1, 1) (2, 1)
(0, 0) (1, 0) (2, 0) (3, 0)
Permute the sample space in one dimension randomly, using getCellSampleSpace2dim
.
(0, 2) (0, 3) (2, 0) (3, 0) (1, 1) (0, 0) (2, 1) (1, 0) (1, 2) (0, 1)
Arrange the sample space to an array with 2 rows and 3 columns, using arrangeSampleSpace2dim
.
(0, 2) (0, 3) (2, 0) (3, 0) (1, 1)
(0, 0) (2, 1) (1, 0) (1, 2) (0, 1)
The result using this algorithm. There is no obvious asymmetry except volatility caused by simulation.
The result using simple step-wise random walk. There is some obvious asymmetry. Besides, the result is affected by the initial position.