I wrote a program to simulate flipping a coin and count the number of flips it takes to get the series heads-tails-heads or tails-heads-tails to continue for ten flips.

Here's the data (100 data points):

The blue line is just an idea of what the probability distribution should look like.

As you can see only one value actually occurred twice, but the data is still concentrated around 500. Is there any way to represent this with a chart like the one I have? I'm using JavaFX charts.

## Probability Distribution of Data with no Repeated Data Points?

**Moderators:** gmalivuk, Moderators General, Prelates

- SaggiSponge
**Posts:**4**Joined:**Mon Apr 04, 2016 7:33 pm UTC

### Re: Probability Distribution of Data with no Repeated Data Points?

That spike at 500 is a fluke, and I cannot read a concentration around 500 from the graph at all. All one can read from the graph is that 100 trials are waaaaaay too few. Do at least 10000, and your red graph should be good enough that it doesn't need guessing, just a bit of smoothing.

Second, if you want to interpolate the data, you cannot just omit all data points with 0 occurrences. They're part of your results; they belong on the graph, and they need to be considered in interpolation.

Of course, the low number of trials will just turn your graph into an unreadable zigzag pattern. If you don't want to do additional trials, I suggest graphing and interpolating on the cumulative distribution instead. Those zigzags will turn into stairs, which are much easier to visually interpolate.

If you think about the problem, one of the common probability distributions should be a very close approximation. If your blue line doesn't look similar to it, your blue line is likely to be wrong. And right now, it looks quite different.

Second, if you want to interpolate the data, you cannot just omit all data points with 0 occurrences. They're part of your results; they belong on the graph, and they need to be considered in interpolation.

Of course, the low number of trials will just turn your graph into an unreadable zigzag pattern. If you don't want to do additional trials, I suggest graphing and interpolating on the cumulative distribution instead. Those zigzags will turn into stairs, which are much easier to visually interpolate.

If you think about the problem, one of the common probability distributions should be a very close approximation. If your blue line doesn't look similar to it, your blue line is likely to be wrong. And right now, it looks quite different.

- gmalivuk
- GNU Terry Pratchett
**Posts:**26820**Joined:**Wed Feb 28, 2007 6:02 pm UTC**Location:**Here and There-
**Contact:**

### Re: Probability Distribution of Data with no Repeated Data Points?

If you want to get the shape without doing thousands of trials, group the results and plot a histogram. (That is, don't just plot the number of times you get exactly 463. Plot the number of times you get a result from 461 to 465 or from 461 to 470. With too few trials you'll never get something that looks all that great when you're just counting and plotting the individual results.)

- SaggiSponge
**Posts:**4**Joined:**Mon Apr 04, 2016 7:33 pm UTC

### Re: Probability Distribution of Data with no Repeated Data Points?

I performed 10000 trials and used a histogram, and here's the graph:

A lot clearer than before! Thanks!

A lot clearer than before! Thanks!

My understanding of quantum physics can be graphed with a sine wave.

### Who is online

Users browsing this forum: No registered users and 9 guests