19,095
edits
m (link fixes) |
m (WP section link fix, various tweaks to other WP links) |
||
Line 81: | Line 81: | ||
[[User:Neo|Neo]] | [[User:Neo|Neo]] | ||
:The term "inverse normal" is apparently not conventional, and also rather confusing because it can be mistaken as referring to either the [[ | :The term "inverse normal" is apparently not conventional, and also rather confusing because it can be mistaken as referring to either the [[wp:Normal-inverse Gaussian distribution|normal-inverse Gaussian distribution]] or the [[wp:Inverse Gaussian distribution|inverse Gaussian distribution]], both of which are rather exotic and irrelevant here. | ||
:What we have here is the inverse of the [[ | :What we have here is the inverse of the [[wp:Error function|error function]] or rather that of [[wp:Normal distribution#Standard deviation and coverage|erfc(x/sqrt(2))]]. If you have Java installed, [https://onlinestatbook.com/analysis_lab/inverse_normal_dist.html HERE] is a nice applet that you can toy around with to see just what the table in your PDF link corresponds to. | ||
:As further pointed out [[ | :As further pointed out [[wp:Normal distribution#Generating values from normal distribution|HERE]], inverting the [[wp:Normal distribution#Cumulative distribution function|standard normal cdf]] gives you a way to generate ''normally'' distributed random variables from a ''uniformly'' distributed random variable, which is exactly what Oni does (see Neo's code sample above). | ||
:The float r is a ''uniformly'' distributed random variable in (-1.0,1.0) (@ Neo: please check). Same for x except the interval is now [0.0,10.0). z is a first approximation of erfc(0.0998 * x / sqrt(2)), interpolated linearly between erfc(0.0998 * floorf(x) / sqrt(2)) and erfc(0.0998 * (floorf(x) + 1) / sqrt(2)). The table is thus sampled uniformly. | :The float r is a ''uniformly'' distributed random variable in (-1.0,1.0) (@ Neo: please check). Same for x except the interval is now [0.0,10.0). z is a first approximation of erfc(0.0998 * x / sqrt(2)), interpolated linearly between erfc(0.0998 * floorf(x) / sqrt(2)) and erfc(0.0998 * (floorf(x) + 1) / sqrt(2)). The table is thus sampled uniformly. | ||
:The result ( v1 + z * v2 ) is, to a good approximation, a ''normally'' distributed random variable, centered at v1 and with standard mean deviation v2. Apart from the approximation arising from the linear interpolation, the distribution is cut off at 99.8% of expectancy, so all the values will be within 3.09023*v2 of v1. | :The result ( v1 + z * v2 ) is, to a good approximation, a ''normally'' distributed random variable, centered at v1 and with standard mean deviation v2. Apart from the approximation arising from the linear interpolation, the distribution is cut off at 99.8% of expectancy, so all the values will be within 3.09023*v2 of v1. | ||
::[[User:Geyser|geyser]] 03:12, 7 December 2007 (CET) | ::[[User:Geyser|geyser]] 03:12, 7 December 2007 (CET) | ||
Boy, what a ton of interest this little function generates :). The interval for r is [-0.999, 0.999] to be precise (it originates as [-1, 1] and it is multiplied with 0.999). And yes, it is supposed to be distributed uniformly. Here is the (pseudo)random number generator: [[ | Boy, what a ton of interest this little function generates :). The interval for r is [-0.999, 0.999] to be precise (it originates as [-1, 1] and it is multiplied with 0.999). And yes, it is supposed to be distributed uniformly. Here is the (pseudo)random number generator: [[wp:Linear congruential generator|linear congruential generator]], the one from Numerical Recipes. | ||