Theory
Hypothesis testing, power, and chi-square tests
From hypotheses to statistical decisions, including power, tests for means, proportions, and variances, and the analysis of counts.
On this page
A company claims that its components last at least hours on average. In a test of components the mean lifetime is hours, with sample standard deviation hours. The difference of hours may indicate that the claim is false, but it may also depend only on the components that happened to be in the sample, because another sample would give another mean. A hypothesis test is a rule, fixed before looking at the data, that decides whether the data contradict the claim. The rule is built so that the probability of rejecting a true claim is small, for example . With these data the claim is rejected, as calculated in the section on the test for a mean.
This chapter calculates the threshold of the rule, for example “reject the claim if the sample mean is at most hours”, the probabilities that the rule makes a wrong decision, and the p-value, that is, the probability of a result at least this far from the claim when the claim is true. The rules concern a mean, a proportion such as the fraction of defective items, the comparison of two groups, a variance, and tables of counts.
The chapter belongs to statistical inference (Chapters 8-12). It uses the distribution of the sample mean from Chapter 8, the normal, chi-square, and Student’s t distributions from Chapter 6, and the statistics of the confidence intervals of Chapter 10; the last section shows that a confidence interval is the set of values that a test does not reject. In Chapter 12 the same procedure decides whether the slope of a regression line differs from zero.
Hypotheses and decision rules
1. Null and alternative hypotheses
A company claims that the mean lifetime of its components is hours. The mean lifetime of all components produced is a parameter, denoted by (read mu), and the claim states that . Before collecting data, two mutually exclusive statements about the parameter are written down. The null hypothesis is the statement being tested, here . The alternative hypothesis collects the values of interest to the research question, here . The test uses the sample to decide whether to reject in favor of .
In symbols, let (read theta) be the parameter of a probability model. The null hypothesis states that belongs to a set (capital theta zero), the alternative that it belongs to a set , and the two sets are disjoint. In the example .
The null hypothesis is called simple when it determines a single distribution for the sample, and composite when it allows more than one. With normal lifetimes of known standard deviation , the hypothesis fixes the single distribution and is simple. With unknown, the same allows the distribution for every and is composite. The hypothesis is also composite.
Given a reference value , there are three pairs of hypotheses for a mean.
- For a departure in either direction, and .
- To establish an increase, and .
- To establish a decrease, and .
The first alternative contains values on both sides of and is called two-sided; the other two are called one-sided. The corresponding test is called two-sided, upper-tailed if , and lower-tailed if . The chosen pair determines on which side the results that lead to rejection lie.
When contains several values, as does, the probability of a wrong rejection must be calculated for each of them. The null value closest to the alternative, , is called the boundary of the null hypothesis; the block on the significance level shows that for one-sided tests for a mean the calculation at the boundary suffices.
2. Test statistic and rejection region
To test against with observations, one rule is to calculate the sample mean and reject if ; the number is derived in the next section. Here is the test statistic, and the values from upward form the rejection region.
A test statistic is a function of the sample. Substituting the observed data into this function gives the value (obs stands for observed). The rejection region, also called the critical region, is the set of values of for which the rule rejects . It is built from the distribution of under , that is, when is true, by placing in the values that become more probable when is true.
- If large values of point to , as does for an increase in the mean, choose a threshold and reject when .
- If small values of point to , as does for a decrease in the mean, reject when .
- If has a distribution symmetric about zero under and the alternative is two-sided, reject when , that is, when or .
In the first two cases the rejection region is one tail of the distribution; in the third it consists of two tails. Once is calculated, the decision consists in checking whether it belongs to .
The research question determines the direction
A mean lifetime of at least hours meets the design requirement. If the investigation seeks evidence that the requirement is violated, the hypotheses are and , and rejection occurs for small sample means. A sample mean of hours lies on the side opposite the one that would lead to rejection, so the rule does not reject .
The requirement determines the alternative, which is fixed before sampling. If each tail has probability when is true, someone who chooses the tail after seeing the sign of the result rejects whenever the result falls in either tail. That person therefore rejects a true hypothesis with probability , twice the stated value.
Errors and power
1. Significance level, Type II error, and power
The rule of the previous block rejects if . Since the decision is based on a sample, it can be wrong in two ways.
- If , so that is true, a sample may give and the rule rejects. Rejecting a true null hypothesis is a Type I error.
- If , so that is true, a sample may give and the rule does not reject. Failing to reject a false null hypothesis is a Type II error.
For every value , the power function (read pi of theta) is the probability that the rule rejects when the parameter equals . The subscript on identifies the distribution used to calculate the probability. For , is the probability of a Type I error. For rejection is the correct decision, and the Type II error has probability (beta of theta). With the next theorem gives , , and therefore .
A test has significance level (read alpha) if the Type I error probability does not exceed at any value of :
The symbol , the supremum, is the smallest number that no with exceeds; when there is a maximum, the supremum equals it. The level is fixed before collecting data; exercises usually use and . If the maximum Type I error probability is strictly less than , the test is called conservative, like the test for a count at the end of this section, which at level has maximum probability .
If contains several values, the level must be checked at all of them. In the test for a mean the rejection probability increases with , as the next theorem proves. At , for example, it is approximately , less than . The maximum over therefore occurs at the boundary , and it suffices to calculate the rejection probability there.
The probability depends on the alternative value . Since , for a true mean of , close to the boundary, the rule fails to reject in about samples out of ; for a true mean of , . Likewise, if at a given alternative value a procedure rejects in samples out of in the long run, its power at that value is and equals . The power at a value of the alternative is therefore the probability of rejecting when the true mean is that value; the remark on sample size chooses so that power reaches a specified value.
2. Power of an upper-tailed z test
Let be the mean of independent normal observations with mean and known standard deviation . Let denote the standard normal quantile of order , that is, the number with probability to its left (Chapter 6), and let (capital phi) be the standard normal cumulative distribution function. To test against at level , the test rejects if , with chosen so that . The rule is equivalent to rejecting if , and the test based on this statistic is called the z test. The threshold for the sample mean and the power are
Proof
If , the mean is normal with mean and variance (Chapter 8), so standardization gives . This probability equals when , and solving for gives the threshold. Subtracting in and multiplying by the positive number turns the inequality into .
To calculate power, keep the threshold and use the distribution of when the mean is . Since has a standard normal distribution,
Substituting gives , which is the formula. As increases the argument of decreases and is increasing, so power increases with . The maximum of over is therefore .
The theorem gives the threshold from the chosen level and the rejection probability for every value of the mean; the next two blocks calculate them with numbers.
One threshold, two sampling distributions
With , , , and , we have . Since , the threshold for the sample mean is . If , the threshold standardized relative to is . The rejection probability is therefore .
On the scale the two distributions have centers and , and the threshold is the same in both cases. Reducing to with moves the threshold to , and power at falls to approximately . At a fixed level, increasing reduces the standard error , that is, the standard deviation of the sample mean, and the two distributions overlap less.
Sample size for a specified power
The upper-tailed z test should detect an increase (read delta) with power at least . By the theorem this happens if , that is, if . Since is increasing, the condition is equivalent to . By the symmetry of the normal distribution , so
Isolate ; if and are less than the two quantiles are positive, so square both sides and round up to an integer.
For example, with , , , and minimum power , we have and , with sum . Hence and , so at least observations are needed. The bound on is proportional to , so halving the difference to be detected while keeping the other quantities fixed quadruples the theoretical threshold for .
With , power at is , whereas with it is approximately . Both power functions equal at because the significance level determines the threshold.
Actual significance level for a discrete count
Let be the number of successes in five independent trials. For against the upper-tailed test rejects if . Under the rejection probability is , or . Extending the rejection region to four successes would add the five sequences with a single failure, each of probability , and the probability would rise to . Of the two regions considered, only the first has level at most .
The rejection probability under of the chosen rule, , is called the actual significance level. With a count the rejection region grows one value at a time, so the actual level changes in jumps and here does not equal exactly; the test is conservative. Under the alternative , the same region gives power . Both calculations sum probabilities over the same rejection region using the binomial distribution (Chapter 5) at the specified value of .
End of the free preview
The theory of this topic continues with 6 more sections
- P-values and significance
- Tests for a mean
- Proportions and comparisons between samples
- Goodness of fit and independence
- Variance, multiple comparisons, and intervals
- Keep studying
Full access also includes the other 7 worked examples of this topic and the solutions of the 14 practice exercises.
Unlock Statistics and probability · €49Read the first 3 worked examples in this chapter for free.