# Testing the Proportion in a Binary Population

 English Português Français ‎Español Italiano Nederlands

Assume a random variable ${\displaystyle X}$ has only two possible outcomes. We call the statistical population of ${\displaystyle X}$ binary. If ${\displaystyle X}$ is an indicator variable storing the information about the existence (or non-existence) of a feature, we can carry out statistical inference about the proportion of elements within the population possessing the property of interest (${\displaystyle \pi }$) or not (${\displaystyle 1-\pi }$). As in other parametric tests, the inference relates to a hypothetical value, here ${\displaystyle \pi _{0}}$, that represents a hypothetical proportion of population elements having the property of interest. We will introduce statistical test procedures based on a simple random sample of size ${\displaystyle n}$. This ensures that the sample variables ${\displaystyle X_{1},\ldots ,X_{n}}$, which are indicator variables with outcomes measured as either ${\displaystyle 0}$ or ${\displaystyle 1}$, are independent and identically distributed Bernoulli variables. As usual the significance level is denoted by ${\displaystyle \alpha }$.

### Hypotheses

Depending on the application at hand, one- or two-sided tests are formulated: 1) ${\displaystyle {\text{H}}_{0}:\pi =\pi _{0},{\text{H}}_{1}:\pi \neq \pi _{0}.}$ 2) ${\displaystyle {\text{H}}_{0}:\pi \leq \pi _{0},{\text{H}}_{1}:\pi >\pi _{0}.}$ 3) ${\displaystyle {\text{H}}_{0}:\pi \geq \pi _{0},{\text{H}}_{1}:\pi <\pi _{0}.}$ Our earlier remarks on the choice of null and alternative hypothesis in the section on testing population means also apply in this environment.

### Test statistic and its distribution; decision regions

The sample proportion ${\displaystyle {\widehat {\pi }}={\frac {X}{n}}={\frac {1}{n}}\sum _{i=1}^{n}\,X_{i}}$ is a suitable estimator of the population parameter ${\displaystyle \pi }$. The estimator ${\displaystyle X=\sum _{i=1}^{n}\,X_{i},}$ is a simple transformation of ${\displaystyle {\widehat {\pi }}}$ (${\displaystyle X=n\cdot {\widehat {\pi }}}$), which contains all the important information. It counts the number of elements in the sample possessing the property of interest. As has already been shown, ${\displaystyle X}$ follows a Binomial distribution with parameters ${\displaystyle n}$ and ${\displaystyle \pi }$: ${\displaystyle X\thicksim B\left(n;\,\pi \right)}$. As ${\displaystyle n}$ is chosen by the decision-maker, ${\displaystyle \pi }$ is the only remaining parameter needed to completely specify the Binomial distribution. Following the logic applied in all parametric hypothesis testing problems, we assume ${\displaystyle \pi }$ to be ${\displaystyle \pi _{0}}$, that is, we determine the distribution of the test statistic given the hypothetical proportion ${\displaystyle \pi _{0}}$ is the one prevailing in the population: ${\displaystyle \pi =\pi _{0}}$. Hence, the estimator ${\displaystyle X}$ becomes our , since it has a Binomial distribution with parameter ${\displaystyle n}$ and ${\displaystyle \pi _{0}}$ under ${\displaystyle {\text{H}}_{0}}$: ${\displaystyle V=X{\overset {{\text{H}}_{0}}{\thicksim }}B\left(n;\,\pi _{0}\right).}$ The rejection region of the null hypothesis contains all realizations of ${\displaystyle V}$ for which the cumulated probabilities don’t exceed the ${\displaystyle \alpha }$. The critical values can be read from the numerical table of the cumulative distribution function ${\displaystyle F_{B}\left(x\right)}$ of ${\displaystyle B\left(n;\,\pi _{0}\right)}$, by following these rules: 1) The lower critical value ${\displaystyle c_{l}}$ is the realization ${\displaystyle x}$ of ${\displaystyle X}$, for which the cumulative distribution function just exceeds the value ${\displaystyle \alpha /2}$: ${\displaystyle F_{B}\left(c_{l}-1\right)\leq \alpha /2}$ and ${\displaystyle F_{B}\left(c_{l}\right)>\alpha /2}$. The upper critical value ${\displaystyle c_{u}}$ is the argument ${\displaystyle x}$ of the cumulative distribution function that returns a probability equal to or greater than ${\displaystyle 1-\alpha /2}$: ${\displaystyle F_{B}\left(c_{u}-1\right)<1-\alpha /2}$ and ${\displaystyle F_{B}\left(c_{u}\right)\geq 1-\alpha /2}$. The rejection region for H${\displaystyle _{0}}$ is given by${\displaystyle \left\{v\,|\,vc_{u}\right\}}$, such that ${\displaystyle P\left(Vc_{u}|\pi _{0}\right)\leq \alpha }$. For the non-rejection region for H${\displaystyle _{0}}$ we have${\displaystyle \left\{v\,|\,c_{l}\leq v\leq c_{u}\right\}}$, such that ${\displaystyle P\left(c_{l}\leq V\leq c_{u}|\pi _{0}\right)\geq 1-\alpha }$. 2) The critical value ${\displaystyle c}$ is the smallest realization of the test statistic that occurs with cumulated probability of at least ${\displaystyle 1-\alpha }$ : ${\displaystyle F_{B}\left(c-1\right)<1-\alpha }$ and ${\displaystyle F_{B}\left(c\right)\geq 1-\alpha }$. The rejection region for H${\displaystyle _{0}}$ is then${\displaystyle \left\{v\,|\,v>c\right\}}$, such that ${\displaystyle P\left(V>c|\pi _{0}\right)\leq \alpha }$. The non-rejection region for H${\displaystyle _{0}}$ is${\displaystyle \left\{v\,|\,v\leq c\right\}}$, such that ${\displaystyle P\left(V\leq c|\pi _{0}\right)\geq 1-\alpha }$. 3) The critical value ${\displaystyle c}$ is determined as the smallest realization of the test statistic that occurs with cumulated probability of at least ${\displaystyle \alpha }$: ${\displaystyle F_{B}\left(c-1\right)\leq \alpha }$ and ${\displaystyle F_{B}\left(c\right)>\alpha }$. The rejection region for H${\displaystyle _{0}}$ is ${\displaystyle \left\{v\,|\,v, such that ${\displaystyle P\left(V. The non-rejection region for H${\displaystyle _{0}}$ is given by${\displaystyle \left\{v\,|\,v\geq c\right\}}$, such that ${\displaystyle P\left(V\geq c|\pi _{0}\right)\geq 1-\alpha }$. As ${\displaystyle V=X}$ is a discrete random variable, the given significance level ${\displaystyle \alpha }$ will generally not be fully utilized (exhausted). The actual significance level ${\displaystyle \alpha _{a}}$ will only by chance reach that level and will usually be smaller. The above tests are thus conservative with respect to the utilization of the allowance for the maximum probability of the type I error. Given the sample size ${\displaystyle n}$ is sufficiently high, the estimator ${\displaystyle {\widehat {\pi }}}$ can be standardized to give the test statistic ${\displaystyle V={\frac {{\widehat {\pi }}-\pi _{0}}{\sigma _{0}\left({\widehat {\pi }}\right)}}={\frac {{\widehat {\pi }}-\pi _{0}}{\sqrt {\frac {\pi _{0}\,\left(1-\pi _{0}\right)}{n}}}}.}$ Here, ${\displaystyle \sigma _{0}\left({\widehat {\pi }}\right)}$ is the standard deviation of the estimation function ${\displaystyle {\widehat {\pi }}}$ under ${\displaystyle {\text{H}}_{0}}$. Under ${\displaystyle {\text{H}}_{0}}$, ${\displaystyle V}$ has approximately standard normal distribution (i.e. normal with mean 0 and variance 1). Critical values for the given significance level can be taken from the cumulative standard normal distribution table. Decision regions for the one- and two sided tests are determined in the same way as those for the approximate population mean test for unknown ${\displaystyle \sigma }$: In fact, a hypothesis about a proportion is a hypothesis about an expectation (of a binary indicator variable): ${\displaystyle E\left({\widehat {\pi }}\right)=\pi }$.

### Sampling and computing the test statistic

Once a sample of size ${\displaystyle n}$ has been drawn, we have realization ${\displaystyle x_{1},\ldots ,x_{n}}$ of the sampling variables, ${\displaystyle X_{1},\ldots ,X_{n}}$, and can compute the realized value ${\displaystyle v}$ of the ${\displaystyle V}$.

### Test decision and interpretation

See the remarks for the ${\displaystyle \mu }$ test.

### Power Curve ${\displaystyle P\left(\pi \right)}$

The power curve of the large-sample test based on ${\displaystyle V={\frac {{\widehat {\pi }}-\pi _{0}}{\sigma _{0}\left({\widehat {\pi }}\right)}}={\frac {{\widehat {\pi }}-\pi _{0}}{\sqrt {\frac {\pi _{0}\,\left(1-\pi _{0}\right)}{n}}}}}$ can be calculated explicitly for all test situations in the same manner as the power curve for the population mean tests. The power curve of the exact test based on ${\displaystyle V=X}$ is computed using the Binomial distribution (as this is the distribution underlying the test statistic) for all ${\displaystyle 0\leq \pi \leq 1}$ and fixed ${\displaystyle n}$. From the definition ${\displaystyle P\left(\pi \right)=P\left(V=X\in \,{\text{rejection region for H}}_{0}\,|\,\pi \right)}$ it follows 1) for the two-sided test ${\displaystyle P\left(\pi \right)=P\left(Vc_{u}\,|\,\pi \right)=P\left(V\leq c_{l}-1\,|\,\pi \right)+\left[1-P\left(V\leq c_{u}\,|\,\pi \right)\right],}$ 2) for the right-sided test ${\displaystyle P\left(\pi \right)=P\left(V>c\,|\,\pi \right)=1-P\left(V\leq c\,|\,\pi \right),}$ 3) for the left-sided test ${\displaystyle P\left(\pi \right)=P\left(V Given the respective critical values, the probabilities can be looked up in the numerical table of the cumulative Binomial . For ${\displaystyle \pi =\pi _{0}}$, the power curve equals the actual ${\displaystyle \alpha _{a}}$. Imagine a ‘binary population’ of ${\displaystyle N=3,250}$ economics students, an unknown proportion of which is enthusiastic about statistics. We define the random variable ${\displaystyle X}$ to assume one if the statistical element (‘economics student’) likes statistic and zero if not. We believe that half of the students fancy learning statistical concepts (our hypothetical proportion is thus ${\displaystyle \pi _{0}=0.5}$) and want to test whether this informed guess is true in statistical terms, at a significance level of ${\displaystyle \alpha }$ on the basis of a random sample of size ${\displaystyle n}$: ${\displaystyle {\text{H}}_{0}:\pi =\pi _{0}=0.5\quad {\text{ versus }}\quad {\text{H}}_{1}:\pi \neq \pi _{0}=0.5.}$ In this interactive example you can repeat this test as often as you like. In each run a new sample is simulated (drawn). You can interact by deciding about ${\displaystyle \alpha }$ and ${\displaystyle n}$ in each repetition. In particular, you can try the following combinations:

• Hold significance level ${\displaystyle \alpha }$ and sample size ${\displaystyle n}$ constant;
• vary the significance level ${\displaystyle \alpha }$ and keep the sample size ${\displaystyle n}$ constant;
• set ${\displaystyle n}$ to a new level and hold ${\displaystyle \alpha }$ constant; or
• change both the significance level ${\displaystyle \alpha }$ and the sample size ${\displaystyle n}$.

One of the raison d’etres of financial intermediaries is their ability to efficiently assess the credit-standing (‘creditworthiness’) of potential borrowers. The management of ABC bank decides to introduce an extended credit checking scheme if the proportion of customers with repayment irregularities isn’t below ${\displaystyle 20}$ per cent. The in-house statistician conducting the statistical test is asked to keep the probability of not deciding to improve the credit rating procedure even though the proportion is ‘really’ above ${\displaystyle 20}$ per cent low (i.e. to keep ${\displaystyle \alpha }$ low). The random variable ${\displaystyle X:}$ ‘credit event’ or ‘repayment problems’ is defined as an indicator variable taking on zero (‘no’) or one (‘yes’). The actual proportion ${\displaystyle \pi }$ of clients having trouble with servicing the debt is unknown. The hypothetical boundary value for testing this population proportion is ${\displaystyle \pi _{0}=0.2}$.

### Hypothesis

Deviations from the hypothetical parameter into one direction are of interest; thus, a one-sided test will be employed. As the bank hopes to prove that the evaluation processes in place are sufficient, i.e. the proportion of debtors displaying irregularities in repaying their loans is less than ${\displaystyle 20}$ per cent, this claim is formulated as the alternative hypothesis: ${\displaystyle {\text{H}}_{0}:\pi \geq \pi _{0}=0.2\quad {\text{ versus }}\quad {\text{H}}_{1}:\pi <\pi _{0}=0.2}$ The properties of this test with respect to the bank managers’ requirements have to be evaluated to ensure the test really meets their needs. The type I error, which can be made if the null hypothesis is rejected, is here: ${\displaystyle '{\text{H}}_{1}^{'}|{\text{H}}_{0}={\text{'do not-reject that the proportion of problematic debtors}}<0.2;{\text{no new guidelines}}\,|\,{\text{in reality, unreliable debtors make up at least 20 per cent; credit process has to be reviewed}}.}$ If the test results in the non-rejection of the null hypothesis, a type II error might occur: ${\displaystyle '{\text{H}}_{0}^{'}|{\text{H}}_{1}={\text{'do not-reject that the proportion of problematic debtors}}\geq 0.2;{\text{new evaluation process to be developed}}\,|\,{\text{in reality, unreliable debtors make up no more than 20 per cent; no need for action}}.}$ The type I error represents the risk the managers of the ABC bank want to cap. Its maximum level is given by the significance level, which has been set to a sufficiently low level of ${\displaystyle 0.05}$. The type II error represents the risk of a costly introduction of new credit evaluation processes without management-approved need. The impact of this scenario on the banks’ profitability is difficult to assess, as the new process will lead to a repricing of credits and thus may also generate cost savings. The following two alternatives are both based on the above test. A random sample is drawn from the population of ${\displaystyle 10,000}$ debtors without replacement. This is reasonable, if ${\displaystyle n/N\leq 0.05}$, as then the random sample can then be regarded as ‘simple’.

### 1st alternative

To curb costs, a sample size of ${\displaystyle n=30}$ is chosen. The sampling-theoretical requirement ${\displaystyle n/N\leq 0.05}$ is fulfilled.

### Test statistic and its distribution; decision regions

The estimator ${\displaystyle X:}$ ‘Number of clients with irregularities in debt servicing in sample of size 30’ can directly serve as our test statistic ${\displaystyle V}$. Under ${\displaystyle {\text{H}}_{0}}$, ${\displaystyle V=X}$ has Binomial distribution ${\displaystyle B\left(30;\,0.2\right)}$. A small ${\displaystyle V}$ supports the . The critical value ${\displaystyle c}$ is the smallest realization of ${\displaystyle X}$, for which ${\displaystyle F_{B}\left(x\right)}$ equals to or is greater than ${\displaystyle \alpha }$ , i.e. it has to satisfy: ${\displaystyle F_{B}\left(c-1\right)\leq \alpha =0.05}$ and ${\displaystyle F_{B}\left(c\right)>\alpha =0.05}$. In the numerical table of the cumulative distribution function of ${\displaystyle B\left(30;\,0.2\right)}$ we find ${\displaystyle c=3}$, and thus we have the following decision regions: Rejection region for H${\displaystyle _{0}}$:${\displaystyle \left\{v\,|\,v<3\right\}=\left\{0,1,2\right\}}$, with ${\displaystyle P\left(V<5|0.2\right)=0.0442}$. Non-rejection region for H${\displaystyle _{0}}$:${\displaystyle \left\{v\,|\,v\geq 3\right\}=\left\{3,4,\ldots ,30\right\}}$, with ${\displaystyle P\left(V\geq 3|0.02\right)=0.9558}$. Because ${\displaystyle V=X}$ is a discrete random variable, the given isn’t exhausted: i.e. ${\displaystyle \alpha _{a}=0.0442}$ ${\displaystyle <\alpha =0.05.}$

### Sampling and computing the test statistic

${\displaystyle 30}$ randomly selected debtors are investigated with respect to reliability in debt servicing. Assume ${\displaystyle 5}$ of them haven’t always fulfilled their contractual obligations: ${\displaystyle v=5}$.

### Test decision and interpretation

As ${\displaystyle v=5}$ belongs to the non-rejection region for H${\displaystyle _{0}}$, the is not-rejected. Even though the sample proportion ${\displaystyle x/n=5/30=0.167}$ is smaller than the hypothetical boundary proportion ${\displaystyle \pi _{0}=0.2}$, which should favour H${\displaystyle _{1}}$, we cannot conclude ${\displaystyle {\text{H}}_{0}}$ is false: at a significance level of ${\displaystyle 0.05}$, the difference cannot be regarded as statistically significant. In other words: It is far too likely that the difference has arisen from sampling variability due to the small sample size to be able to reject the null hypothesis. It is important to observe that it’s not merely the value of the point estimator compared to the hypothetical value that leads to a non-rejection or rejection of the null hypothesis, but intervals that take into account the random character of the estimator (i.e. the difference is compared to an appropriate, case specific, statistical yardstick to determine what is statistically significant large, and hence small, deviations/differences). Based on a random sample of size ${\displaystyle n=30}$ and a significance level ${\displaystyle \alpha =0.05}$, we were unable to show statistically, that the proportion of trouble debtors is significantly smaller than ${\displaystyle 20}$ per cent. Consequently, the ABC bank will review and try to improve the credit approval procedures.

### Power

Not having rejected the null hypothesis, we are vulnerable to a type II error, which occurs when the is a true statement: ${\displaystyle '{\text{H}}_{0}^{'}|{\text{H}}_{1}}$. Let’s calculate the type II error probability for a true parameter value ${\displaystyle \pi =0.15}$: What is the probability of not rejecting the null hypothesis in a left-sided test with ${\displaystyle \pi _{0}=0.2}$, ${\displaystyle n=30}$, ${\displaystyle \alpha =0.05}$ and ${\displaystyle c=3}$, given the true population proportion is ${\displaystyle \pi =0.15}$ and hence the null hypothesis actually wrong? ${\displaystyle \beta \left(\pi =0.15\right)=P\left('{\text{H}}_{0}^{'}|{\text{H}}_{1}\right)=P\left(V=X\in \,{\text{non-rejection region for H}}_{0}\,|\,\pi =0.15\right)=P\left(V\geq 3\,|\,\pi =0.15\right).}$ We compute ${\displaystyle P\left(V\geq 3\,|\,\pi =0.15\right)=1-P\left(V<3\,|\,\pi =0.15\right)=1-P\left(V\leq 2\,|\,\pi =0.15\right)=1-0.1514=0.8486,}$ where ${\displaystyle P\left(V\leq 2\,|\,\pi =0.15\right)}$ is taken from the table of the cumulative distribution function ${\displaystyle B\left(30;\,0.15\right)}$ for ${\displaystyle c=2}$, that is ${\displaystyle F_{B}\left(2\right)}$. Interpretation: Given the true proportion is ${\displaystyle \pi =0.15}$, ${\displaystyle 84.86\%}$ of all samples of size ${\displaystyle n=30}$ will not be able to discriminate between the true parameter and the hypothetical ${\displaystyle \pi _{0}=.20}$, inducing the bank to undertake suboptimal improvements of the credit assessment process with probability ${\displaystyle 0.8486}$. In deciding to control the maximum error I probability, the bank is accepting type II error probabilities of such magnitude, statisticians can provide management with power function graphs for any desired true parameter value ${\displaystyle \pi }$. Of course, not rejecting the null hypothesis can also be the right decision: ${\displaystyle '{\text{H}}_{0}^{'}|{\text{H}}_{1}}$. Suppose, for example, that the true proportion of unreliable debtors is ${\displaystyle \pi =0.25}$. The probability of not rejecting the null hypothesis and hence (unknowingly) making the right decision given our current test setting (left sided with ${\displaystyle \pi _{0}=0.20}$, ${\displaystyle n=30}$, ${\displaystyle \alpha =0l05}$ and thus ${\displaystyle c=3}$) is ${\displaystyle P\left(V=X\in \,{\text{non-rejection region for H}}_{0}\,|\,\pi =0.25\right)=P\left(V\geq 3\,|\,\pi =0.25\right)=P\left('{\text{H}}_{0}^{'}|{\text{H}}_{1}\right)=1-\alpha .}$ We have ${\displaystyle P\left(V\geq 3\,|\,\pi =0.25\right)=1-P\left(V<3\,|\,\pi =0.25\right)=1-P\left(V\leq 2\,|\,\pi =0.25\right)=1-0.0106=0.9894,}$ where ${\displaystyle P\left(V\leq 2\,|\,\pi =0.25\right)}$ can be looked up in a numerical table of ${\displaystyle B\left(30;\,0.25\right)}$ as the cumulative probability for values less than or equal to ${\displaystyle c=2}$, i.e. ${\displaystyle F_{B}\left(2\right)}$. These calculations can be carried out for any desired parameter value within the overall parameter space (here: ${\displaystyle \pi \in \left(0,1\right)}$). Depending on which hypothesis the individual parameter adheres to, the power curve ${\displaystyle P\left(\pi \right)}$ or ${\displaystyle 1-P\left(\pi \right)}$ returns probabilities for making a right decision or a type I or type II error.

${\displaystyle \pi }$ True hypothesis ${\displaystyle P\left(\pi \right)}$ ${\displaystyle 1-P\left(\pi \right)}$
${\displaystyle 0}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 1=1-\beta }$ ${\displaystyle 0=\beta }$
${\displaystyle 0.05}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 0.8122=1-\beta }$ ${\displaystyle 0.1878=\beta }$
${\displaystyle 0.10}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 0.4114=1-\beta }$ ${\displaystyle 0.5886=\beta }$
${\displaystyle 0.15}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 0.1514=1-\beta }$ ${\displaystyle 0.8486=\beta }$
${\displaystyle 0.20}$ ${\displaystyle {\text{H}}_{0}}$ ${\displaystyle 0.0442=\alpha _{a}}$ ${\displaystyle 0.9558=1-\alpha _{a}}$
${\displaystyle 0.25}$ ${\displaystyle {\text{H}}_{0}}$ ${\displaystyle 0.0106=\alpha }$ ${\displaystyle 0.9894=1-\alpha }$
${\displaystyle 0.30}$ ${\displaystyle {\text{H}}_{0}}$ ${\displaystyle 0.0021=\alpha }$ ${\displaystyle 0.9979=1-\alpha }$
${\displaystyle 0.35}$ ${\displaystyle {\text{H}}_{0}}$ ${\displaystyle 0.0003=\alpha }$ ${\displaystyle 0.9997=1-\alpha }$
${\displaystyle 0.40}$ ${\displaystyle {\text{H}}_{0}}$ ${\displaystyle 0=\alpha }$ ${\displaystyle 1=1-\alpha }$

The following display shows the graph of the power curve in the left-sided test with parameters ${\displaystyle \pi _{0}=0.20}$, ${\displaystyle n=30}$, ${\displaystyle \alpha =0.05}$ and ${\displaystyle c=3}$.

### 2nd alternative

Now the statistician tries to both satisfy the parameter ${\displaystyle \alpha =0.05}$ set by the management to contain the probability of the crucial type I error and keep the type II error as low as possible. She is aware of the trade-off relationship between ${\displaystyle \alpha }$ and ${\displaystyle \beta }$ error and focuses on possibilities of reducing the associated probabilities simultaneously by increasing the sample size ${\displaystyle n}$ and thus making the decision an economic one. Cost projections in conjunction with a valuation of the benefit of higher reliability lead to a choice of ${\displaystyle n=350}$, still small enough to satisfy ${\displaystyle n/N\leq 0.05}$ as basis for simple random sampling without replacement.

### Test statistic and its distribution; decision regions

The standardized test statistic ${\displaystyle V={\frac {{\widehat {\pi }}-\pi _{0}}{\sigma _{0}\left({\widehat {\pi }}\right)}}={\frac {{\widehat {\pi }}-\pi _{0}}{\sqrt {\frac {\pi _{0}\,\left(1-\pi _{0}\right)}{n}}}}}$ is used. Under ${\displaystyle {\text{H}}_{0}}$, it is approximately with parameters ${\displaystyle \mu =0}$ and ${\displaystyle \sigma =1}$. Large sample theory suggests that the approximation is sufficiently accurate for a sample size of ${\displaystyle n=350}$. From the cumulative standard normal distribution table we can take ${\displaystyle c=z_{0.95}=1.645}$ to satisfy ${\displaystyle P\left(V\leq c\right)=1-\alpha =0.95}$. From symmetry it follows that ${\displaystyle -c=-1.645}$, and we have ${\displaystyle \left\{v\,|\,v<-1.645\right\}}$ as the approximated for H${\displaystyle _{0}}$ and ${\displaystyle \left\{v\,|\,v\geq -1.645\right\}}$ as the approximated non-rejection region for H${\displaystyle _{0}}$.

### Sampling and computing the test statistic

From the universe of ${\displaystyle 10,000}$ debtors, ${\displaystyle 350}$ are selected and random, of which ${\displaystyle 63}$ turn out to have displayed problems in debt servicing at least once in their repayment history. Their proportion within the sample is thus ${\displaystyle 0.18}$. Plugging this into the test statistic yields ${\displaystyle v={\frac {0.18-0.2}{\sqrt {\frac {0.2\,\cdot (\,0.8)}{350}}}}=-0.935.}$

### Test decision and interpretation

As ${\displaystyle v=-.0935}$ falls into the non-rejection region for H${\displaystyle _{0}}$, the null hypothesis is not rejected. On the basis of this particular sample of size ${\displaystyle n=350}$, it can not be statistically claimed, that the proportion of problematic debtors is less than ${\displaystyle 20}$ per cent. The ABC bank management will thus initiate a review of their credit procedures.

### Type II error probability

As the bank management has been induced to not-reject the statement in the null hypothesis, it may have made a type II error, which occurs if the true proportion amongst the ${\displaystyle 10,000}$ is actually smaller than ${\displaystyle 0.2}$: ${\displaystyle '{\text{H}}_{0}^{'}|{\text{H}}_{1}}$. Let’s examine the probability of this happening for a ‘hypothetical’ true population proportion of ${\displaystyle \pi =0.15}$, i.e. ${\displaystyle P\left('{\text{H}}_{0}^{'}|{\text{H}}_{1}\right)=\beta \left(\pi =0.15\right)}$. First we must determine the critical proportion ${\displaystyle p_{c}}$ corresponding to the critical value calculated using the normal approximation. From ${\displaystyle -c=\left(p_{c}-\pi _{0}\right)/\sigma \left({\hat {\pi }}\right)}$ follows ${\displaystyle p_{c}=\pi _{0}-c\cdot \sigma \left({\hat {\pi }}\right)=0.2-1.645\,\left(0.2\cdot 0.8/350\right)=0.1648.}$ ${\displaystyle \beta \left(\pi =0.15\right)}$ is the probability of the sample function ${\displaystyle {\widehat {\pi }}}$ assuming a value from the non-rejection region of the null hypothesis, given the true parameter ${\displaystyle \pi }$ belongs to the alternative hypothesis: ${\displaystyle \beta \left(\pi =0.15\right)=P\left({\widehat {\pi }}\geq p_{c}\,|\,\pi =0.15\right)=P\left({\widehat {\pi }}\geq 0.1648\,|\,\pi =0.15\right).}$ In order to determine this probability on the basis of a numerical table for the standard normal distribution, we must standardize using ${\displaystyle E\left({\widehat {\pi }}\right)=\pi =0.15}$ and ${\displaystyle Var\left({\widehat {\pi }}\right)=\pi \left(1-\pi \right)/n=0.15\cdot (0.85)/350}$: {\displaystyle {\begin{aligned}\beta \left(\pi =0.15\right)&=P\left({\widehat {\pi }}\geq p_{c}\,|\,\pi =0.15\right)=P\left({\frac {{\widehat {\pi }}-\pi _{0}}{\sqrt {\frac {\pi \,\left(1-\pi \right)}{n}}}}\geq {\frac {p_{c}-\pi _{0}}{\sqrt {\frac {\pi \,\left(1-\pi \right)}{n}}}}\,|\,\pi =0.15\right)\\&=P\left({\frac {0.1648-0.15}{\sqrt {\frac {0.15\cdot (0.85)}{350}}}}\,|\,\pi =0.15\right)=P\left(V\geq 0.775\,|\,\pi =0.15\right).\end{aligned}}} In the standard normal distribution table we find ${\displaystyle P\left(V\leq 0.775\right)=0.7808}$ and thus have ${\displaystyle \beta \left(\pi =0.15\right)=1-P\left(V\leq 0.775\right)=1-0.7808=0.2192.}$ Thus, compared to ${\displaystyle \beta \left(\pi =0.15\right)}$ from the 1st alternative, the increase in the sample size has resulted in a sizeable reduction in the error type II probability for a true population proportion of ${\displaystyle \pi =0.15}$.

A statistics professor has the impression that in the last year the university library has bought proportionally less new statistics books than in the past. Over the last couple of years the relative amount of statistics books amongst new purchases has consistently been more than ${\displaystyle 10}$ per cent. He asks one of his assistants to investigate whether this has changed in favour of other departments. Acting on behalf of his students whom he wants to secure as many new books as possible, he asks his assistant to minimize the risk of not complaining to the head of the library when the proportion of statistics books has decreased. The assistant decides to have a sample of ${\displaystyle 25}$ books taken from the file containing the new purchases over the last ${\displaystyle 12}$ months. He wants to know how many of these are statistics books. He is thus dichotomizing the random variable ‘subject matter’ into the outcomes ‘statistics’ and ‘not statistics’. Of course, if you regard the purchases as an outcome of a decision-making process conducted by the librarians, this is anything but a random variable. But for the statisticians who rely on a sample because they don’t have access to all relevant information, it appears to be one. From the proportion of statistics books the assistant wants to infer to the population of all newly purchased books, using a statistical test to allow for deviations of the proportion in the sample from those in the population. In particular, he wants to verify whether the proportion has indeed dropped below the past average of ${\displaystyle 10}$ per cent. He will thus test the population proportion ${\displaystyle \pi }$ and chooses a ‘standard’ of ${\displaystyle 0.05}$.

### Hypothesis

As the assistant wants to verify whether the proportion has dropped below ${\displaystyle 0.1}$, he has to employ a one-sided test. He recalls that the professor wants him to minimize the probability of not disclosing that the proportion has decreased below ${\displaystyle \pi _{0}=0.1}$ when in reality it has. He thus opts for a right-sided test, i.e. puts the professors’ claim as null hypothesis in the hope of not rejecting it: ${\displaystyle {\text{H}}_{0}:\pi \leq \pi _{0}=0.1\quad {\text{ versus }}\quad {\text{H}}_{1}:\pi >\pi _{0}=0.1.}$ The assistant undertakes an investigation into the properties of this test with respect to the professors’ intention of minimizing the probability of not detecting a relative decrease in the statistics book supply. A real-world decrease can only not have been detected if the has been rejected even though it is really true. This situation is called type I error: ${\displaystyle '{\text{H}}_{1}^{'}|{\text{H}}_{0}={\text{'conclude proportion of statistics books has not decreased'}}|{\text{in reality, the proportion has decreased}}.}$ The maximum probability of this situation, ${\displaystyle P\left('{\text{H}}_{1}^{'}|{\text{H}}_{0}\right)}$, is given by the ${\displaystyle \alpha }$, which has been set to ${\displaystyle 0.05}$. Thus, the risk the professor wanted to ‘minimize’ is under control. If the null hypothesis is not-rejected, then a type II error can arise: ${\displaystyle '{\text{H}}_{0}^{'}|{\text{H}}_{1}={\text{'conclude proportion of statistics books has decreased'}}|{\text{in reality, the proportion has not decreased}}.}$ The probability of this happening (conditional on the null hypothesis not having been rejected), ${\displaystyle P\left('{\text{H}}_{1}^{'}|{\text{H}}_{0}\right)=\beta }$, is unknown, because the true proportion ${\displaystyle \pi }$ (which is element of the parameter set specified by the ), is unknown. As we have already seen in other examples, it can be substantial, but the professors’ priorities lie on trading off type II error for type I error which is under control.

### Test statistic and its distribution; decision regions

The estimator ${\displaystyle X:}$ ‘number of statistics books in a sample of ${\displaystyle 25}$ books’ can serve as test statistic ${\displaystyle V}$. Under ${\displaystyle {\text{H}}_{0}}$, ${\displaystyle V=X}$ has Binomial distribution with parameter ${\displaystyle n=25}$ and ${\displaystyle \pi =0.1}$: ${\displaystyle V\thicksim B\left(25;\,0.1\right)}$. A relatively high number of statistics books in the sample supports the , that the proportion of statistics books has not decreased. The critical value ${\displaystyle c}$ is the realization of ${\displaystyle X}$ , for which ${\displaystyle F_{B}\left(c\right)}$ equals or exceeds ${\displaystyle 1-\alpha =0.05}$, that is, we require ${\displaystyle F_{B}\left(c-1\right)<1-\alpha =0.95}$ and ${\displaystyle F_{B}\left(c\right)\geq 1-\alpha =0.95}$. In the table of the cumulative of ${\displaystyle B\left(25;\,0.1\right)}$ you will find ${\displaystyle c=5}$. The rejection region for H${\displaystyle _{0}}$ is thus${\displaystyle \left\{v\,|\,v>5\right\}=\left\{6,7,\ldots ,25\right\}}$, such that ${\displaystyle P\left(V>5|0.1\right)=0.0334=\alpha _{a}<\alpha }$. As ${\displaystyle V=X}$ is a discrete random variable, the given significance level isn’t fully utilized:${\displaystyle \alpha _{a}=0.0334<\alpha =0.05.}$ The non-rejection region for H${\displaystyle _{0}}$ is given by${\displaystyle \left\{v\,|\,v\leq 5\right\}=\left\{0,1,2,3,4,5\right\}}$, such that ${\displaystyle P\left(V\leq 5|0.01\right)=0.9666}$.

### Sampling and computing the test statistic

A subset of ${\displaystyle 25}$ books is selected at random from the list of last years’ new purchases and categorized in statistics and non-statistics books. As the total amount of new books is sufficiently large from a sample-theoretical point of view, a simple random sample is drawn, i.e. the sampling is carried out without replacement. The amount of statistics books in the sample is counted to be ${\displaystyle x=3}$, which will serve as the realized test statistic value ${\displaystyle v}$.

### Test decision and interpretation

As ${\displaystyle v=3}$ falls into the non-rejection region for H${\displaystyle _{0}}$, the cannot be rejected. On the basis of a random sample of size ${\displaystyle n=25}$ and a significance level of ${\displaystyle \alpha =0.05}$, the assistant couldn’t verify statistically that the proportion of statistics books is still above ${\displaystyle 10}$ per cent. This test result means that a complaint to the library seems to be merited.

### Power

Given our test parameters (${\displaystyle \pi _{0}=0.1}$, ${\displaystyle n=25}$, ${\displaystyle \alpha =0.05}$ and ${\displaystyle c=5}$ ), what is the probability of not rejecting the null hypothesis if the true proportion of statistics books is ${\displaystyle \pi =0.2}$? That is, we want to calculate the probability of the type II error given a specific element of the parameter set associated with the alternative hypothesis, ${\displaystyle \pi =0.2}$: ${\displaystyle \beta \left(0.2\right)=P\left('{\text{H}}_{0}^{'}|{\text{H}}_{1}\right)=P\left(V=X\in \,{\text{non-rejection region for H}}_{0}\,|\,\pi =0.2\right)=P\left(V\leq 5\,|\,\pi =0.2\right).}$ In the table of the cumulative Binomial distribution ${\displaystyle B\left(25;\,0.2\right)}$ we find this probability to be ${\displaystyle 0.6167}$. Alas, if the true proportion has increased to ${\displaystyle 20}$ per cent, there is still a ${\displaystyle 61.67}$ per cent chance of not discovering a significant deviation from the hypothetical boundary proportion of ${\displaystyle 10}$ per cent. This is the probability of an unjustified complaint issued by the professor given the proportion has risen to ${\displaystyle 0.2}$—a substantial relative increase. The probability of making a type II error contingent on alternative true proportions ${\displaystyle \pi }$ can be computed via the power curve. Levels of ${\displaystyle P\left(\pi \right)}$ and ${\displaystyle 1-P\left(\pi \right)}$ for several values of ${\displaystyle \pi }$ are listed in the following table.

${\displaystyle \pi }$ True hypothesis ${\displaystyle P\left(\pi \right)}$ ${\displaystyle 1-P\left(\pi \right)}$
${\displaystyle 0}$ ${\displaystyle {\text{H}}_{0}}$ ${\displaystyle 0=\alpha }$ ${\displaystyle 1=1-\alpha }$
${\displaystyle 0.05}$ ${\displaystyle {\text{H}}_{0}}$ ${\displaystyle 0.0012=\alpha }$ ${\displaystyle 0.9988=1-\alpha }$
${\displaystyle 0.1}$ ${\displaystyle {\text{H}}_{0}}$ ${\displaystyle 0.0334=\alpha _{a}}$ ${\displaystyle 0.9666=1-\alpha _{a}}$
${\displaystyle 0.15}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 0.1615=1-\beta }$ ${\displaystyle 0.8385=\beta }$
${\displaystyle 0.20}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 0.3833=1-\beta }$ ${\displaystyle 0.6167=\beta }$
${\displaystyle 0.25}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 0.6217=1-\beta }$ ${\displaystyle 0.3783=\beta }$
${\displaystyle 0.30}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 0.8065=1-\beta }$ ${\displaystyle 0.1935=\beta }$
${\displaystyle 0.35}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 0.9174=1-\beta }$ ${\displaystyle 0.0826=\beta }$
${\displaystyle 0.40}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 0.9706=1-\beta }$ ${\displaystyle 0.0294=\beta }$
${\displaystyle 0.45}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 0.9914=1-\beta }$ ${\displaystyle 0.0086=\beta }$
${\displaystyle 0.50}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 0.9980=1-\beta }$ ${\displaystyle 0.0020=\beta }$
${\displaystyle 0.60}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 0.9999=1-\beta }$ ${\displaystyle 0.0001=\beta }$
${\displaystyle 0.70}$ ${\displaystyle {\text{H}}_{1}}$ ${\displaystyle 1=1-\beta }$ ${\displaystyle 0=\beta }$

For example, if the true proportion (and therefore absolute amount) of statistics books is ${\displaystyle \pi =0}$, the sample cannot contain any statistics books and we will expect ${\displaystyle x=0}$ and won’t reject the null hypothesis. The rejection of the null hypothesis (${\displaystyle '{\text{H}}_{1}^{'}}$) is an impossible event with associated probability of zero. The poweris the conditional probability of rejecting the null hypothesis given the relative amount is zero: ${\displaystyle P\left(0\right)=P\left(V=X\in \,{\text{rejection region for H}}_{0}\,|\,\pi =0\right)=P\left('{\text{H}}_{1}^{'}\,|\,0\right)=0.}$ If, on the other hand, the true proportion of statistics books is ${\displaystyle \pi =0.35}$ , the power is calculated as ${\displaystyle P\left(0.35\right)=P\left(V>5\,|\,\pi =0.35\right)=1-P\left(V\leq 5\,|\,\pi =0.35\right)=1-0.0826=0.9174,}$ where ${\displaystyle P\left(V\leq 5\,|\,\pi =0.35\right)}$ can be looked up in the table of the cumulative distribution function as the value of ${\displaystyle B\left(25;\,0.2\right)}$ for ${\displaystyle c=5}$. ${\displaystyle P\left(0.35\right)}$ is the probability of correctly rejecting the null hypothesis, ${\displaystyle P\left('{\text{H}}_{1}^{'}|{\text{H}}_{1}\right)}$. The probabilities of rejecting the null hypothesis and not-rejecting it must always sum up to one for any given true parameter value within the range specified by the alternative hypothesis: ${\displaystyle P\left('{\text{H}}_{0}^{'}|{\text{H}}_{1}\right)+P\left('{\text{H}}_{1}^{'}|{\text{H}}_{1}\right)=1.}$ For a true proportion of ${\displaystyle \pi =0.35}$, the former sampling result amounts to making a type II error, the probability of which is denoted by ${\displaystyle \beta \left(0.35\right)}$. Thus, we can write ${\displaystyle \beta \left(0.35\right)+P\left('{\text{H}}_{1}^{'}|{\text{H}}_{1}\right)=1}$ or ${\displaystyle P\left('{\text{H}}_{1}^{'}|{\text{H}}_{1}\right)=1-\beta \left(0.35\right).}$ As ${\displaystyle P\left('{\text{H}}_{1}^{'}|{\text{H}}_{1}\right)}$ is the value of the power at point ${\displaystyle \pi =0.35}$, we can calculate the probability of making a type II error as ${\displaystyle \beta \left(0.35\right)=1-P\left(0.35\right)=0.0826.}$ If the true proportion of statistics books is ${\displaystyle 35}$ per cent, ${\displaystyle 8.26}$ per cent of all samples of size ${\displaystyle n=25}$ will lead to a non-rejection of the null hypothesis, i.e. won’t detect the significant difference between ${\displaystyle \pi =0.35}$ and ${\displaystyle \pi _{0}=0.10}$. The following display depicts the graph of the power curve for the right-sided test we have just discussed: ${\displaystyle \pi _{0}=0.10}$, ${\displaystyle n=25}$, ${\displaystyle \alpha =0.05}$ and ${\displaystyle c=5}$.