Experiment with the quasi-random Sobol sequence, using John Burkardt's code. Compile with
gfortran kind.f90 stats.f90 sobol.f90 xsobol.f90
Below are sample results with gfortran. The Sobol variate fill the domain (0,1) more uniformly than the random_number()
intrinsic, but successive
variates have substantial correlations to each other.
#obs = 1000000
random number type: Sobol
mean sd dev_sq counts
0.499999 0.288675 12 100002 99999 100000 100000 99999 100002 99999 100000 100000 99999
0.500000 0.288675 8 99999 100001 100001 99999 100000 99999 100001 100001 99999 100000
0.500001 0.288675 16 99999 99999 100001 99999 100002 99999 99999 100001 99999 100002
0.499999 0.288675 48 100001 100001 99998 100003 99997 100001 100001 99998 100003 99997
0.500000 0.288675 12 100000 99999 100002 99999 100000 100000 99999 100002 99999 100000
lag ACF ACF ACF ACF ACF
1 0.1429 0.1429 0.1429 0.1429 0.1429
2 -0.7143 -0.7143 -0.7143 -0.7143 -0.7143
3 -0.0714 -0.0714 -0.0714 -0.0714 -0.0714
4 0.5714 0.5714 0.5714 0.5714 0.5714
5 -0.0982 -0.0982 -0.0982 -0.0982 -0.0982
6 -0.7679 -0.7679 -0.7679 -0.7679 -0.7679
7 0.0625 0.0625 0.0625 0.0625 0.0625
8 0.8929 0.8929 0.8929 0.8929 0.8929
9 0.0592 0.0592 0.0592 0.0592 0.0592
10 -0.7746 -0.7746 -0.7746 -0.7746 -0.7746
random number type: uniform
mean sd dev_sq counts
0.500188 0.288813 906656 100154 100141 99694 99777 99840 99932 99732 100031 100781 99918
0.500089 0.288584 252714 99770 99995 100059 100215 99961 99951 99952 99946 100330 99821
0.500404 0.288698 811622 99895 99952 99338 100387 100034 99875 99908 100027 100209 100375
0.499800 0.288518 1140964 99945 99812 100402 100238 99476 100601 100123 100024 99548 99831
0.500220 0.288554 2050940 99686 99445 100163 101002 99760 99578 99826 100416 100351 99773
lag ACF ACF ACF ACF ACF
1 -0.0007 -0.0012 -0.0001 -0.0017 -0.0003
2 0.0010 0.0005 -0.0004 0.0009 0.0008
3 -0.0008 -0.0012 -0.0008 -0.0002 -0.0007
4 0.0004 -0.0008 0.0005 -0.0005 0.0000
5 0.0013 0.0012 -0.0011 -0.0007 -0.0030
6 0.0009 -0.0002 -0.0012 0.0015 0.0007
7 -0.0010 0.0015 0.0016 -0.0009 -0.0001
8 0.0003 0.0003 -0.0005 -0.0005 0.0013
9 0.0001 0.0005 -0.0009 -0.0013 -0.0014
10 0.0009 -0.0002 -0.0010 0.0003 -0.0004