|
|
|
|
|
by LordDragonfang
1344 days ago
|
|
>On a sample of thousands, a 3% difference is big. Not really. Only if it is many, many thousands. Assuming a totally random acceptance rate of 1/5: a = 0;
b = 0;
for (c of Array(1000)) {
if (Math.random() > .8)
a++;
if (Math.random() > .8)
b++;
}
console.log(`a=${a}, b=${b}, a is ${(a/b - 1)*100}% more likely than b`)
> a=209, b=201, a is 3.9800995024875663% more likely than b
literally the first run. And even in absolute terms, I got this on the third run: >a=192, b=219, a is -12.328767123287676% more likely than b
That's an absolute difference of 2.7%. Again, 100% random data. |
|
I think I get what you're going for here -- you're trying to simulate a coin flip? -- but what you've actually done is made successive draws from a uniform random number generator. The software is designed to return numbers that fall along the interval [0,1) with equal probability. Thresholding the numbers and dividing their counts is not a meaningful transformation; the result is still just a uniformly distributed random number. It's like...the ratio of heads in two identical, unfair coins or something.
If all "random numbers" were uniform like this, then no, we wouldn't expect an X% difference to be any more or less likely based on the magnitude of the underlying sample. But when we're talking about something like a a population mean, then the behavior of the errors on estimates is very different indeed, and most estimates cluster around the true (aka population) value:
https://online.stat.psu.edu/stat415/lesson/9/9.4
As the sample size for an experiment of this sort gets larger, the bell curve of expected errors gets sharper and sharper, and it becomes increasingly less likely to see errors >= X, for any value X. In the limit of large N, the distribution of sample errors around a known mean approach a normal distribution:
https://www.jmp.com/en_us/statistics-knowledge-portal/t-test...
For what it's worth, the expected proportion of N heads in M coin flips is modeled using the binomial distribution, which is also bell-shaped and illustrates the same idea:
https://en.wikipedia.org/wiki/Binomial_distribution