## Stata 15 help for bitest

```
[R] bitest -- Binomial probability test

Syntax

Binomial probability test

bitest varname == #p [if] [in] [weight] [, detail]

Immediate form of binomial probability test

bitesti #N #succ #p [, detail]

by is allowed with bitest; see [D] by.

fweights are allowed with bitest; see weight.

bitest

Statistics > Summaries, tables, and tests > Classical tests of
hypotheses > Binomial probability test

bitesti

Statistics > Summaries, tables, and tests > Classical tests of
hypotheses > Binomial probability test calculator

Description

bitest performs exact hypothesis tests for binomial random variables.
The null hypothesis is that the probability of a success on a trial is
#p.  The total number of trials is the number of nonmissing values of
varname (in bitest) or #N (in bitesti).  The number of observed successes
is the number of 1s in varname (in bitest) or #succ (in bitesti).
varname must contain only 0s, 1s, and missing.

bitesti is the immediate form of bitest; see immed for a general
introduction to immediate commands.

Option

+----------+

detail shows the probability of the observed number of successes, k_obs;
the probability of the number of successes on the opposite tail of
the distribution that is used to compute the two-sided p-value,
k_opp; and the probability of the point next to k_opp.  This
information can be safely ignored.  See the technical note in [R]
bitest for details.

Examples

Setup
. webuse quick

Test whether probability of success equals 0.3
. bitest quick == 0.3
. bitest quick == 0.3, detail

Test if probability of success = 0.5, given 3 successes in 10 trials
. bitesti 10 3 .5

Test if probability of success = 0.000001, given 36 successes in 2.5
million trials
. bitesti 2500000 36 .000001

Stored results

bitest and bitesti store the following in r():

Scalars
r(N)           number N of trials
r(P_p)         assumed probability p of success
r(k)           observed number k of successes
r(p_l)         lower one-sided p-value
r(p_u)         upper one-sided p-value
r(p)           two-sided p-value
r(k_opp)       opposite extreme k
r(P_k)         probability of observed k (detail only)
r(P_oppk)      probability of opposite extreme k (detail only)
r(k_nopp)      k next to opposite extreme (detail only)
r(P_noppk)     probability of k next to opposite extreme (detail only)

```