# Standard deviation of binomial distribution

So I'm sort of stuck on this fairly simple-seeming statistics problem: You have an ordinary dice that you suspect might not be fair. You throw it 300 times and get 60 sixes. Is the resulting deviation from the expected value within a 95 percent confidence level using the standard deviation for a binomial distribution?

So I calculate the expected value of throwing a fair dice is 3.5 and the average of my 300-throw experiment is 3.6. But I can't figure out how to correctly apply the standard deviation formula. If I assume $n=300$ and $p=1/6$ then I get a nonsensical standard deviation of $6.5$, if I use the formula $\sqrt{np(1-p)}$. What are my parametres supposed to be or do I have the wrong formula? I can easily figure out what the parametres would be if I used the standard deviation $\sqrt{\frac{1}{n}\sum(x_n-\bar{x})^2}$ but as far as I know that's not applicable in a discrete distribution like this.

• You do not know what the average of your throws actually was, based on the given information, becaude you do not know what the remaining 240 throws were. Perhaps what you mean here is the distribution of the number of sixes (not the actual sum of the rolls) which would be Binomial (300,1/6) for a fair standard die. So then your mean is 50 and your variance is 250/6. – Ian Sep 8 '16 at 11:00
• I forgot to write out my assumption that the rest of the throws were equally divided between the other five possible outcomes, thus giving me an average. The binomial (300, 1/6) yields the variance 250/6, as you wrote, and the standard deviation of 6.5. This doesn't seem credible to me though because then the 95 percent confidence level of two standard deviations would be achieved even with nothing but 300 sixes unless I misunderstand something. – otto Sep 8 '16 at 11:30
• You haven't really pinned down the question yet, then. Are you comparing the average of the throws themselves (3.6) to the average of the throws of a fair die (3.5), or are you comparing the number of sixes (60) to the average number of sixes for a fair die (50)? If you are doing the former, why are you doing that? That would be a bad way to detect whether a die is fair, because it could be systematically unfair in a way that preserves the average, such as if if the distribution was $(3/12,0,3/12,1/6,1/6,1/6)$. (Here I took a fair die and evenly divided the probability of 2 between 1 and 3.) – Ian Sep 8 '16 at 11:36
• The wording of the problem also suggests that this isn't what you should do because the throws are not binomially distributed. The number of occurrences of a given number or a given set of numbers is binomially distributed however. – Ian Sep 8 '16 at 11:38
• Ohh! I was doing the former and I see now why that was incorrect. The standard deviation 6.5 predicts the deviation from the average number of throws you should get for each side instead of the deviation from the expected value. So now I can say that the result of 60 sixes is within two standard deviations and therefore within the 95 percent confidence level of the expected value. Thank you! – otto Sep 8 '16 at 12:16

Let $X$ be the number of 6's in 300 rolls of the die. If the die is fair, in the sense that the probability of a 6 on any one roll is $1/6,$ then $X \sim Binom(300, 1/6$ and $E(X) = 300(1/6) = 50.$

You observed $X = 60,$ which is more than expected. The question is whether it is remarkable to get $X \ge 60$ if $X \sim Binom(300,1/6).$ Under that assumption it is easy to find $P(X \ge 60) = 0.073 ,$ using R statistical software. Or you can use the normal approximation to get a close enough approximation.

1 - pbinom(59, 300, 1/6)
## 0.07299305


This is a small probability, that may cast some doubt on the assumption that $X \sim Binom(300, 1/6),$ but not so small that most statisticians and researchers would be willing to declare the die as 'unfair.'

I will leave it to you to put this into the format of a test of hypothesis (as specified in your text), with the value of the test statistic, and the P-value. How big would $X$ have to be ('critical value') in order to reject the null hypothesis at the 5% level of significance? (You might get a different critical value using an exact binomial computation than with a normal approximation.)

I should say that $n = 300$ rolls of the die (although perhaps tedious to perform) do not give a lot of information about the die. Based on 60 sixes out of 300, an Agresti 95% CI for the true probability of getting a 6 is fairly wide--about $(0.16,0.35).$

It would be best to have the counts, out of 300, for each of the six faces of the die, and to do a chi-squared goodness-of-fit test of the null hypothesis that each face has probability $1/6$ of showing on any one roll.

Notes: (a) It is worth pointing out that a die can be seriously biased in many ways and still show 6's with the frequency expected of a fair die. (b) It also possible to bias a die so that it is very unfair with respect to a few faces and still show an average of 3.5 over the long run--and show 6's a sixth of the time over the long run. All of this points to the fact that keeping totals of all six faces would be the optimal way to collect the data, but that is not the problem you were given to solve. (c) Under the assumption that $X \sim Binom(300, 1/6),$ the formula you use gives $Var(X) = 300(1/6)(5/6) = 41.667,$ so $SD(X) = 6.455$ is indeed correct. The figure below shows that PDF of $Binom(300, 1/6)$ together with the PDF (red curve) of the approximating normal distribution $Norm(\mu = 50, \sigma = 6.455).$