# How do I know if I have enough data to calculate probability?

It's been a while since I took a stats class so I'm pretty rusty on this.

I have a hobby where I've been collecting data on an online gambling game called "Crash" (you can see an explanation of the game here if you're not familiar).

I now have the crash points for a bunch of game rounds, and I've added up the counts for each round where the crash point was higher than a given number. In other words, if the crash point was 3, then 3, 2, and 1 would've been acceptable bets and they have their counter incremented. You can see what I mean in a sample of my data here.

Using my data, I'm pretty sure I can say that the odds of getting a crash of at least 1 is about 96% because I have about 150k instances out of 156k rounds where the crash was greater or equal to 1. However, I don't think I could accurately estimate the chances of getting a crash of at least 420 since 335/156k instances are probably too few. But I don't know how to calculate how many samples I need to be reasonably certain of the results.

My question is, how many instances of a crash point do I need to have before I could somewhat accurately estimate the odds of hitting that crash point or higher?

• The main issue is to find a suitable model. What would help much is to know whether the (unknown) probability is the same in each try and whether the tries are independent. – Peter Aug 27 '18 at 21:54
• I've been working under the assumption that the probability is the same and each try is independent since those are the claims that the betting site makes. I've run some of my data through machine learning algorithms, and I haven't been able to find any kind of pattern that would suggest otherwise. – Daemond Aug 27 '18 at 22:11
• I would not believe claims that any sequence of outcomes on an Internet gaming site are independent or identically distributed. 'Brick-and-mortar' casinos can be regulated and monitored by local authorities, and so there might be some reason to trust that games are played according to advertised rules. Online games often lack such regulation and monitoring. – BruceET Aug 28 '18 at 5:51
• This is possibly an interesting exercise in statistics and mathematics but don't bet your house on your findings. Even if the game was fair, see BruceET's comment, misunderstandings are very common. See en.m.wikipedia.org/wiki/Gambler%27s_fallacy. – badjohn Aug 28 '18 at 8:04
• Sure, I understand that. This is mostly an exercise in data scraping and statistical analysis so I'd just like to move forward with the assumption that the data is actually pseudo weighted random. – Daemond Aug 28 '18 at 17:49

If you have a sequence of 'binomial trials', independent and all with success probability $p.$ then a you can get a confidence interval for $p.$

Traditional binomial confidence interval. For very large $n,$ you can use $\hat p = X/n,$ as an estimate of $p,$ where $X$ is the number of Successes in $n$ trials. Then a traditional 95% confidence interval for $p$ is of the form $$\hat p \pm 1.96\sqrt{\frac{\hat p(1-\hat p)}{n}}.$$

This interval assumes that $n$ and $p$ are such that $Z = \frac{X - np}{\sqrt{np(1-p)}}$ is nearly standard normal and that $\frac{\hat p(1 - \hat p)}{n}$ is a reasonably good estimate of $\frac{p(1-p)}{n}.$

Determining n for a given margin of error. If you want to know $n$ that estimates $p$ within a particular margin of error $M,$ you can get that from the confidence interval as follows:

If you have a rough idea of $p$ in advance then you can choose $n$ so that the margin of error $M = 1.96\sqrt{\frac{\hat p(1-\hat p)}{n}}$ is of a desired size.

If you have no idea of the size of $p,$ then you can use $p = .5$ as a worst-case because for a given $M$ that value of $p$ gives the largest $n.$ [Among public opinion pollsters there is a rough rule that the margin of sampling error of a poll is $M \approx \sqrt{1/n},$ which is based on this worst case.]

Notes: (1) For $n < 500$ (approximately) or $p$ very near 0 or 1, it is better to use $n^\prime = n + 4$ and $X^\prime = X + 2$ (instead of $n$ and $X)$ to compute $\hat p$ and the confidence interval. [This makes an 'Agresti-Coull style of confidence interval' for which you can google explanations and a link to their paper in The American Statistician (1998) pp 119-126.] (2) A Bayesian 95% probability interval is based on a uniform prior uses quantiles .025 and .975 of $\mathsf{Beta}(1 + X, 1 + n - X).$