Skip to content

Commit 1c3e31d

Browse files
authored
Merge pull request #221 from JoramSoch/master
added proof "bin-test"
2 parents cfcd006 + 0e2453f commit 1c3e31d

2 files changed

Lines changed: 110 additions & 8 deletions

File tree

I/ToC.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -718,14 +718,15 @@ title: "Table of Contents"
718718

719719
3.1. Binomial observations <br>
720720
&emsp;&ensp; 3.1.1. *[Definition](/D/bin-data)* <br>
721-
&emsp;&ensp; 3.1.2. **[Maximum likelihood estimation](/P/bin-mle)** <br>
722-
&emsp;&ensp; 3.1.3. **[Maximum log-likelihood](/P/bin-mll)** <br>
723-
&emsp;&ensp; 3.1.4. **[Maximum-a-posteriori estimation](/P/bin-map)** <br>
724-
&emsp;&ensp; 3.1.5. **[Conjugate prior distribution](/P/bin-prior)** <br>
725-
&emsp;&ensp; 3.1.6. **[Posterior distribution](/P/bin-post)** <br>
726-
&emsp;&ensp; 3.1.7. **[Log model evidence](/P/bin-lme)** <br>
727-
&emsp;&ensp; 3.1.8. **[Log Bayes factor](/P/bin-lbf)** <br>
728-
&emsp;&ensp; 3.1.9. **[Posterior probability](/P/bin-pp)** <br>
721+
&emsp;&ensp; 3.1.2. **[Binomial test](/P/bin-test)** <br>
722+
&emsp;&ensp; 3.1.3. **[Maximum likelihood estimation](/P/bin-mle)** <br>
723+
&emsp;&ensp; 3.1.4. **[Maximum log-likelihood](/P/bin-mll)** <br>
724+
&emsp;&ensp; 3.1.5. **[Maximum-a-posteriori estimation](/P/bin-map)** <br>
725+
&emsp;&ensp; 3.1.6. **[Conjugate prior distribution](/P/bin-prior)** <br>
726+
&emsp;&ensp; 3.1.7. **[Posterior distribution](/P/bin-post)** <br>
727+
&emsp;&ensp; 3.1.8. **[Log model evidence](/P/bin-lme)** <br>
728+
&emsp;&ensp; 3.1.9. **[Log Bayes factor](/P/bin-lbf)** <br>
729+
&emsp;&ensp; 3.1.10. **[Posterior probability](/P/bin-pp)** <br>
729730

730731
3.2. Multinomial observations <br>
731732
&emsp;&ensp; 3.2.1. *[Definition](/D/mult-data)* <br>

P/bin-test.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
layout: proof
3+
mathjax: true
4+
5+
author: "Joram Soch"
6+
affiliation: "BCCN Berlin"
7+
e_mail: "joram.soch@bccn-berlin.de"
8+
date: 2023-12-16 20:01:14
9+
10+
title: "Binomial test"
11+
chapter: "Statistical Models"
12+
section: "Count data"
13+
topic: "Binomial observations"
14+
theorem: "Binomial test"
15+
16+
sources:
17+
- authors: "Wikipedia"
18+
year: 2023
19+
title: "Binomial test"
20+
in: "Wikipedia, the free encyclopedia"
21+
pages: "retrieved on 2023-12-16"
22+
url: "https://en.wikipedia.org/wiki/Binomial_test#Usage"
23+
- authors: "Wikipedia"
24+
year: 2023
25+
title: "Binomialtest"
26+
in: "Wikipedia – Die freie Enzyklopädie"
27+
pages: "retrieved on 2023-12-16"
28+
url: "https://de.wikipedia.org/wiki/Binomialtest#Signifikanzniveau_und_kritische_Werte"
29+
30+
proof_id: "P429"
31+
shortcut: "bin-test"
32+
username: "JoramSoch"
33+
---
34+
35+
36+
**Theorem:** Let $y$ be the number of successes resulting from $n$ independent trials with unknown success probability $p$, such that $y$ follows a [binomial distribution](/D/bin):
37+
38+
$$ \label{eq:Bin}
39+
y \sim \mathrm{Bin}(n,p) \; .
40+
$$
41+
42+
Then, the [null hypothesis](/D/h0)
43+
44+
$$ \label{eq:bin-test-h0}
45+
H_0: \; p = p_0
46+
$$
47+
48+
is [rejected](/D/test) at [significance level](/D/alpha) $\alpha$, if
49+
50+
$$ \label{eq:bin-test-rej}
51+
y \leq c_1 \quad \text{or} \quad y \geq c_2
52+
$$
53+
54+
where $c_1$ is the largest integer value, such that
55+
56+
$$ \label{eq:bin-test-c1}
57+
\sum_{x=0}^{c_1} \mathrm{Bin}(x; n, p_0) \leq \frac{\alpha}{2} \; ,
58+
$$
59+
60+
and $c_2$ is the smallest integer value, such that
61+
62+
$$ \label{eq:bin-test-c2}
63+
\sum_{x=c_2}^{n} \mathrm{Bin}(x; n, p_0) \leq \frac{\alpha}{2} \; ,
64+
$$
65+
66+
where $\mathrm{Bin}(x; n, p)$ is the [probability mass function of the binomial distribution](/P/bin-pmf):
67+
68+
$$ \label{eq:bin-pmf}
69+
\mathrm{Bin}(x; n, p) = {n \choose x} \, p^x \, (1-p)^{n-x} \; .
70+
$$
71+
72+
73+
**Proof:** The [alternative hypothesis](/D/h1) relative to $H_0$ for a [two-sided test](/D/test-tail) is
74+
75+
$$ \label{eq:bin-test-h1}
76+
H_1: \; p \neq p_0 \; .
77+
$$
78+
79+
We can use $y$ as a [test statistic](/D/tstat). Its [sampling distribution](/D/dist-samp) is given by \eqref{eq:Bin}. The [cumulative distribution function](/D/cdf) (CDF) of the test statistic under the null hypothesis is thus equal to the [cumulative distribution function of a binomial distribution](/P/bin-cdf) with [success probability](/D/bin) $p_0$:
80+
81+
$$ \label{eq:y-cdf}
82+
\mathrm{Pr}(y \leq z \vert H_0) = \sum_{x=0}^{z} \mathrm{Bin}(x; n, p_0) = \sum_{x=0}^{z} {n \choose x} \, p_0^x \, (1-p_0)^{n-x} \; .
83+
$$
84+
85+
The [critical value](/D/cval) is the value of $y$, such that the probability of observing this or more extreme values of the test statistic is equal to or smaller than $\alpha$. Since $H_0$ and $H_1$ define a two-tailed test, we need two critical values $y_1$ and $y_2$ that satisfy
86+
87+
$$ \label{eq:y-cvals}
88+
\begin{split}
89+
\alpha &\geq \mathrm{Pr}(y \in \left\lbrace 0, \ldots, y_1 \right\rbrace \cup \left\lbrace y_2, \ldots, n \right\rbrace \vert H_0) \\
90+
&= \mathrm{Pr}(y \leq y_1 \vert H_0) + \mathrm{Pr}(y \geq y_2 \vert H_0) \\
91+
&= \mathrm{Pr}(y \leq y_1 \vert H_0) + (1-\mathrm{Pr}(y \leq (y_2-1) \vert H_0) \; .
92+
\end{split}
93+
$$
94+
95+
Given the test statistic's CDF in \eqref{eq:y-cdf}, this is fulfilled by the values $c_1$ and $c_2$ defined in \eqref{eq:bin-test-c1} and \eqref{eq:bin-test-c2}. Thus, the null hypothesis $H_0$ [can be rejected](/D/cval), if the [observed test statistic](/D/test) is inside the rejection region:
96+
97+
$$ \label{eq:bin-test-rej-qed}
98+
y \in \left\lbrace 0, \ldots, c_1 \right\rbrace \cup \left\lbrace c_2, \ldots, n \right\rbrace \; .
99+
$$
100+
101+
This is equivalent to \eqref{eq:bin-test-rej} and thus completes the proof.

0 commit comments

Comments
 (0)