News for hackers. Stuff that matters.
Re:How odd is a cluster of plane crashes? by simonh on Tuesday August 18, 2015 @06:43AM (#10078435)
One of the first computer programs I ever wrote just put random dots on a screen and I remember looking at how 'lumpy' the results were. Intuitively most people assume that random distributions will be even distributions, but in fact they are usually full of clusters. Some mathematicians can reliably distinguish 'random' sequences created by people from truly random ones because people produce distributions that are too smoothed out. 'I won't put a dot here because it's too close to that other dot', but a truly random distribution doesn't care where previous dots were and won't avoid the conjunction.
Re:How odd is a cluster of plane crashes? by lordnacho on Tuesday August 18, 2015 @07:02AM (#10078503)
The iPod shuffle algo was an example of this. It just didn't feel "random" enough for people to have a truly random generator.
Re:How odd is a cluster of plane crashes? by ececconi on Tuesday August 18, 2015 @09:16AM (#10079001)
I would think about this all the time when I got a shuffle in high school. After listening to it for a while, I could really predict the next track that would come on even in shuffle mode.
Re:How odd is a cluster of plane crashes? by wodenokoto on Tuesday August 18, 2015 @12:37PM (#10080197)
Isn't that also why it is shuffle and not random? When shuffling, you don't risk getting the same song twice in a row.
Re:How odd is a cluster of plane crashes? by eru on Wednesday August 19, 2015 @03:30AM (#10084104)
People are seldom precise when they talk about randomness.

For example, you could mean: picking tracks with `putting back'. You could shuffle tracks like you shuffle a deck of cards, ie picking without putting back. It's still random, but with a different distribution.

Even picking the first track with 90% probability, and the rest with some other smaller probability is random. It's just not a uniform distribution.

Re:How odd is a cluster of plane crashes? by martin-adams on Tuesday August 18, 2015 @07:14AM (#10078539)
I do wonder if that is down to sample size. For example, I wrote a program to simulate the roll of a dice. There is a one in 6 chance of getting any one number. But roll it 6 million times, you'll be very close to have each number 1 million times.

So I would anticipate the clumping to even out as the sample size increases. Or maybe the evening out is a large collection of clumps. Anyone know if this is the correct way to think about it?

Re:How odd is a cluster of plane crashes? by Osmium on Tuesday August 18, 2015 @08:02AM (#10078706)
> So I would anticipate the clumping to even out as the sample size increases.

Clumping won't even out. A useful way of thinking about it is in terms of the distance between samples (e.g. a radial distribution function). If you don't have clumping, that distribution of distances is decidedly non-random and has peaks. Additionally, there's no specific length-scale for the clumping to happen on, it's essentially fractal in nature.

(Happy to be corrected if I'm wrong on this.)

Re:How odd is a cluster of plane crashes? by eru on Wednesday August 19, 2015 @03:27AM (#10084097)
I think in order to pass any judgement on the correctness, you'd have to make your remarks more precise.

Are you talking about a random distribution of points on a line / square, or about rolling dice?

Re:How odd is a cluster of plane crashes? by Osmium on Wednesday August 19, 2015 @05:50AM (#10084492)
> Are you talking about a random distribution of points on a line / square, or about rolling dice?

Right, exactly. I made my comment in reply to the grandparent problem talking about dots on a screen. For a discrete distribution like a dice roll in the parent post it'd be a different matter. (I was going to edit my comment to clarify, but the edit window had expired.) Which serves to illustrate why it's important to be precise when talking about what distribution you're sampling.

Also, trying to run this experiment in practice is also problem even for dots on a screen, because eventually the finite display size of your dots will become an issue, as will floating point arithmetic (since you only really have a finite number of floats in a given range).

Re:How odd is a cluster of plane crashes? by eru on Wednesday August 19, 2015 @06:09AM (#10084545)
Thanks for clarifying.

> Also, trying to run this experiment in practice is also problem even for dots on a screen, because eventually the finite display size of your dots will become an issue, as will floating point arithmetic (since you only really have a finite number of floats in a given range).

Yes, but that's not a problem for the theoretical analysis of fractal dimension.

Uniformly placed dots do have a characteristic density and a relatively simple distribution of nearest neighbour distances. Even the clumpiness doesn't lead to scale invariant lumps.

The lumps get absolutely bigger on bigger scales, but relatively smaller and smoother.

It would be useful to do the analysis properly, though.

Re:How odd is a cluster of plane crashes? by vmarsy on Tuesday August 18, 2015 @09:48AM (#10079140)
What you're describing for the dice is called the law of large numbers : https://en.m.wikipedia.org/wiki/Law_of_large_numbers

It would probably true for that too but as another comment says, we don't want to have an increased sample size here!

Re:How odd is a cluster of plane crashes? by mfenniak on Tuesday August 18, 2015 @09:00AM (#10078934)
> So I would anticipate the clumping to even out as the sample size increases.

Are you saying we need to crash more planes? That seems a little harsh just to get crashes coming at a consistent rate. ;-)

Re:How odd is a cluster of plane crashes? by martin-adams on Tuesday August 18, 2015 @10:45AM (#10079443)
I'd prefer to simulate this with dots on a screen rather than with planes ;-)
Re:How odd is a cluster of plane crashes? by mungoman2 on Tuesday August 18, 2015 @07:44AM (#10078644)
Well depends of what you mean by very close. It's the relative numbers that approaches the true distribution, not the absolute numbers.

Do the experiment you decribe and look at the numbers.

Re:How odd is a cluster of plane crashes? by martin-adams on Tuesday August 18, 2015 @08:02AM (#10078709)
This is what I mean:

  var results = [0,0,0,0,0,0];
  for (var i = 0; i < 6000000; i += 1) {
    results[Math.floor((Math.random() * 6))] += 1;
  }
  console.log(results);
The results are:

  [1002140, 999355, 1000009, 1000401, 1000014, 998081]
Basically, they are all within 1% tolerance of each number getting 1 million occurrences.

So when you look at the clumping on random dots on a screen, given a large enough sample size, I would anticipate that the probability of keeping a clumped visual distribution would become quite improbable.

Re:How odd is a cluster of plane crashes? by ijager on Tuesday August 18, 2015 @08:45AM (#10078875)
I think the clumping is more about how many consecutive same numbers there are in the array.

For example, a naive me would generate: [3,4,5,1,2,4,2,1,2,6] whereas a true random distribution might generate: [3,4,4,4,4,1,2,2,2]. When you generate 6 million samples you would indeed have about 1 million per number. However you would still have subsequences of the same number.

Re:How odd is a cluster of plane crashes? by gus_massa on Tuesday August 18, 2015 @09:26AM (#10079044)
The problem is not when you have much more samples than slots, in that case you should get "almost" the same number of hits in each slot as you measured.

The problem is when you get less samples than slots. For example if you roll 3 dices, you should get "1/2" hits for each result. So the question is: How probable is that one result is repeated? (i.e. you get two equal dices out of the three)

[spoiler alert]

All equal: 3%

Two equal and one different: 42%

Three different: 55%

"Intuitively", it's expected that with a uniform distribution you get something like 1% + 9% + 90% instead (this numbers are completely made up). Most people don't expect that the probability of getting a repeated dice is so close to the probability of getting all of them different.

Re:How odd is a cluster of plane crashes? by dmichulke on Tuesday August 18, 2015 @06:50AM (#10078469)
I don't disagree at all and I remember seeing studies or articles writing about that phenomenon.

Just wanted to add that a few years ago (when you wrote your first computer program) a randomly selected random number generator was more likely to be less random than a randomly selected random number generator today.

Re:How odd is a cluster of plane crashes? by yitchelle on Tuesday August 18, 2015 @06:56AM (#10078486)
The method described in the article on how the statistician approached the problem is very similar to the approach used in the birthday problem[1].

[1] - https://en.wikipedia.org/wiki/Birthday_problem

Re:How odd is a cluster of plane crashes? by DanBC on Tuesday August 18, 2015 @07:27AM (#10078589)
Early random number generation was terrible. You wouldn't get clumps / no clumps, you'd get fuzzy straight lines.
Re:How odd is a cluster of plane crashes? by simonh on Tuesday August 18, 2015 @02:06PM (#10080978)
Approximately 35 years ago :)
Re:How odd is a cluster of plane crashes? by leni536 on Tuesday August 18, 2015 @08:14AM (#10078751)
An other great example is how random is a terrible algorithm for dithering.

https://en.wikipedia.org/wiki/Dither#Algorithms

Re:How odd is a cluster of plane crashes? by detrino on Tuesday August 18, 2015 @08:54AM (#10078910)
Perhaps just an artifact of a weak PRNG or not truly uniform distribution?
Re:How odd is a cluster of plane crashes? by Sharlin on Tuesday August 18, 2015 @09:08AM (#10078971)
No. A truly uniform random distribution indeed has "clumps".
Re:How odd is a cluster of plane crashes? by detrino on Tuesday August 18, 2015 @09:28AM (#10079052)
And a poor PRNG or poor implementation of a uniform distribution (both extremely common, for example: rand() % max) has more clumps, my question is still valid.

Edit: I wrote a program[1] to fill random pixels based on rand/modulo and mersenne twister/uniform distribution and I could not tell the difference in the generates images.

[1] https://gist.github.com/anonymous/9c726ea636f06900ba3a

Re:How odd is a cluster of plane crashes? by benihana on Tuesday August 18, 2015 @07:08AM (#10078521)
Great point. Here's a visualization of what you're talking about:

http://bl.ocks.org/mbostock/fe3f75700e70416e37cd

>Uniform random is pretty terrible. There is both severe under- and oversampling: many samples are densely-packed, even overlapping, leading to large empty areas. (Uniform random sampling also represents the lower bound of quality for the best-candidate algorithm, as when the number of candidates per sample is set to one.)

Taken from: http://bost.ocks.org/mike/algorithms/