# scipy.stats.binom_test

scipy.stats.binom_test(x, n=None, p=0.5, alternative='two-sided')

  Perform a test that the probability of success is p.

  Note: `binom_test` is deprecated; it is recommended that `binomtest` be used instead.

  This is an exact, two-sided test of the null hypothesis that the probability of success in a Bernoulli experiment is p.

  Parameters
    x int or array_like

      The number of successes, or if x has length 2, it is the number of successes and the number of failures.

    n int

      The number of trials. This is ignored if x gives both the number of successes and failures.

    p float, optional

      The hypothesized probability of success. `0 <= p <= 1`. The default value is `p = 0.5`.

    alternative{‘two-sided’, ‘greater’, ‘less’}, optional

      Indicates the alternative hypothesis. The default value is ‘two-sided’.

  Returns
    p-value float

      The p-value of the hypothesis test.

  References

  1

    https://en.wikipedia.org/wiki/Binomial_test

  Examples

      >>> from scipy import stats

  A car manufacturer claims that no more than 10% of their cars are unsafe. 15 cars are inspected for safety, 3 were found to be unsafe. Test the manufacturer’s claim:

      >>> stats.binom_test(3, n=15, p=0.1, alternative='greater')
      0.18406106910639114

  The null hypothesis cannot be rejected at the 5% level of significance because the returned p-value is greater than the critical value of 5%.

scipy.stats.anderson_ksamp scipy.stats.binomtest