Sixteen of twenty independently tested components pass a quality check, a sample proportion of 0.8. Before testing, a pass probability of 0.5 was set as the benchmark, and the question was whether the true pass probability is higher. The count is a whole number from 0 to 20, so its distribution under the benchmark can be computed exactly, while the familiar normal approximation is a shortcut that needs conditions. This lesson computes both, explains why the hypothesized value goes into the standard error, and shows why p-values from counts move in steps.
Key terms
Exact binomial test
Definition Suppose the number of successes comes from independent trials that share one success probability , so that . To test for a fixed with , the exact binomial test uses the null distribution itself, with probabilities
for . For an observed count , the p-values against and against are
where denotes probability computed under . The word exact means that no approximating distribution is used. The result is only as trustworthy as the binomial model of independent trials with a common probability.
In plain words Under the null hypothesis the count has a known distribution, so the p-value is found by adding the probabilities of all counts at least as extreme as the observed one, the observed count included.
Example For passes in trials with and the upper alternative, every sequence of results has null probability . The numbers of sequences with , , , and passes are , , , and , which add to , so
The test rejects at the level and at the level. If the components came from batches with different pass probabilities, or if failures tended to occur together, the binomial null model would be wrong, and the exact p-value would be an exact answer for the wrong model.
Two-sided exact binomial p-values
Definition For the two-sided alternative , a rule must say which counts are at least as extreme as the observed in either direction. Three common rules give the following p-values.
- Doubling the smaller of the two one-sided p-values and , with the result capped at .
- Adding over all counts with , the counts that are no more likely under the null than the observed one.
- Adding over all counts with , the counts at least as far from the null mean as the observed one.
When the null distribution is symmetric and the three rules agree. For other values of they can differ, so a report names the rule it used.
In plain words A two-sided test needs a rule for what counts as equally surprising on the other side, and when the null distribution is lopsided, reasonable rules disagree. Doubling a one-sided p-value is one convention among several, not the definition.
Example For of with , every rule gives
Now take , and , where the null mean is . The upper tail is , so doubling gives about . The counts no more likely than are , , and through , and their total null probability is about . The distance rule picks the same counts here, since means or . Both values are legitimate two-sided p-values, but they are not interchangeable.
Discrete p-value
Definition A p-value computed from a discrete statistic, such as a count, can take only certain values, at most one for each possible observation. For the upper-tail binomial test the possible p-values are the tail sums for . A test that rejects when then rejects exactly when , where is the smallest count with , and its actual type I error probability is , which is at most and often well below it. If even exceeds , no count leads to rejection.
In plain words Moving the observed count from down to adds a whole bar of probability to the tail, so the p-value jumps instead of sliding. A test at the percent level may then use only part of its percent allowance for false rejections. Each p-value is still an exact tail probability, but only a limited set of values can occur.
Example For and , the upper tails nearest are and . A one-sided test at therefore rejects exactly when , and its actual type I error probability is about , not . With only trials and the same , even passes out of gives , so a one-sided test at cannot reject whatever happens.
Null standard error
Definition For the sample proportion from independent trials, under the mean of is and its standard deviation is the null standard error
computed from the hypothesized value rather than from the data. The estimated standard error , used in the Wald confidence interval for , estimates the standard deviation of at the unknown true instead. The two are different quantities, and putting the estimated one into a test statistic gives a different test.
In plain words A test asks how the sample proportion would vary if the null hypothesis were true, and the null hypothesis already says how much that is. Nothing about the spread has to be estimated.
Example For and , the null standard error is . The estimate-based value is smaller, and dividing the difference by it would give instead of the of the next card. If all components had passed, the estimate would make the estimate-based standard error and the ratio undefined, while the null standard error would stay .
One-proportion z test
Definition The one-proportion z test, also called the score test for a proportion, tests with the statistic
and compares it with the standard normal distribution, using , or for the upper, lower and two-sided alternatives. It approximates the exact binomial test and needs the same model of independent trials with a common probability. The approximation is usually judged adequate when the expected numbers of successes and failures under the null, and , are both at least about , a rule of thumb that does not bound the error. A continuity correction replaces the count by for the upper tail and by for the lower tail. It often brings the normal value closer to the exact one, with no guarantee.
In plain words The z test replaces the binomial bars with a smooth normal curve that has the null mean and the null standard error. It is a shortcut that works well when the binomial distribution is close to normal in shape, and the exact test remains available when it is not.
Example For of with , the expected counts and meet the rule of thumb, and
The upper tail is smaller than the exact . With the continuity correction the count becomes , and since the null mean of is and its null standard deviation is ,
which is closer to the exact value in this case. The three numbers come from three methods, and a report says which one it gives.
Check yourself
- In independent trials of a task, succeed. Test against , an alternative fixed in advance, with the exact binomial test. Does the test reject at the level, and at the level?
Show the answer
Under the null hypothesis each of the sequences of results has probability . The counts at least as extreme as are and , reached by sequences, so
The test rejects at the level but not at the level. The expected count is below the usual threshold of , which is one more reason to use the exact test here.
- In independent trials, succeed, and the two-sided test of was planned. A classmate computes the z statistic with the standard error . What is wrong, and what are the correct z statistic and p-value?
Show the answer
The z test measures the distance from in units of the null standard error, so the hypothesized value belongs under the square root. The expected counts and support the normal approximation, and
with the two-sided p-value . The classmate’s standard error gives and , the result of a different test. The exact two-sided binomial p-value, on which all three rules agree because , is about , and the continuity-corrected approximation gives about . So near the threshold the decision depends on the method, which is why a report names the method and gives the p-value itself.
- A process is supposed to fail with probability . In independent runs it fails twice. Test against , fixed in advance. Should you use the z test or the exact binomial test, and what does the resulting p-value describe?
Show the answer
The expected number of failures under the null is , far below any usual threshold, so the null distribution is piled up at and strongly skewed, and the z test is not appropriate. The exact upper tail is
The z statistic would be , with a normal upper tail of about , roughly times too small. The exact p-value is the probability, under a model of independent runs that each fail with probability , of at least failures in runs. It is not the probability that the failure rate is .