hypothesis that the die is fair. Normally, when we are testing for fairness of a die, we are also interested if the die is biased towards generating fewer 6s than expected, and not only more 6s as we considered in the one-tailed test above. In order to consider both the biases, we use a two-tailed test. Note that to do this we cannot simply double the one-tailed p-value unless the probability of the event is 1/2. This is because the binomial distribution becomes asymmetric as that probability deviates from 1/2. There are two methods to define the two-tailed p-value. One method is to sum the probability that the total deviation in numbers of events in either direction from the expected value is either more than or less than the expected value. The probability of that occurring in our example is 0.0437. The second method involves computing the probability that the deviation from the expected value is as unlikely or more unlikely than the observed value, i.e. from a comparison of the probability density functions. This can create a subtle difference, but in this example yields the same probability of 0.0437. In both cases, the two-tailed test reveals significance at the 5% level, indicating that the number of 6s observed was significantly different for this die than the expected number at the 5% level. In statistical software packages Binomial tests are available in most software used for statistical purposes. E.g. In R the above example could be calculated with the following code: binom.test(51, 235, 1/6, alternative = "less") (one-tailed test) binom.test(51, 235, 1/6, alternative = "greater") (one-tailed test) binom.test(51, 235, 1/6, alternative = "two.sided") (two-tailed test) In Java using the Apache Commons library: new BinomialTest().binomialTest(235, 51, 1.0 / 6, AlternativeHypothesis.LESS_THAN) (one-tailed test) new BinomialTest().binomialTest(235, 51, 1.0 / 6, AlternativeHypothesis.GREATER_THAN) (one-tailed test) new BinomialTest().binomialTest(235, 51, 1.0 / 6, AlternativeHypothesis.TWO_SIDED) (two-tailed test) In SAS the test is available in the Frequency procedurePROC FREQ DATA=DiceRoll ; TABLES Roll / BINOMIAL (P=0.166667) ALPHA=0.05 ; EXACT BINOMIAL ; WEIGHT Freq ; RUN; In SPSS the test can be utilized through the menu Analyze > Nonparametric test > Binomial npar tests /binomial (.5) = node1 node2. In Python, use SciPy's binomtest: scipy.stats.binomtest(51, 235, 1.0/6, alternative='greater') (one-tailed test) scipy.stats.binomtest(51, 235, 1.0/6, alternative='two-sided') (two-tailed test) In MATLAB, use myBinomTest, which is available via Mathworks' community File Exchange website. myBinomTest will directly calculate the p-value for the observations given the