Chapter page 21 / 3814 Decision Errors
English

14  Decision Errors

Using data to make inferential decisions about larger populations is not a perfect process. As seen in Chapter 11, a small p-value typically leads the researcher to a decision to reject the null claim or hypothesis. Sometimes, however, data can produce a small p-value when the null hypothesis is actually true and the data are just inherently variable. Here we describe the errors which can arise in hypothesis testing, how to define and quantify the different errors, and suggestions for mitigating errors if possible.

Hypothesis tests are not flawless. Just think of the court system: innocent people are sometimes wrongly convicted and the guilty sometimes walk free. Similarly, data can point to the wrong conclusion. However, what distinguishes statistical hypothesis tests from a court system is that our framework allows us to quantify and control how often the data lead us to the incorrect conclusion.

In a hypothesis test, there are two competing hypotheses: the null and the alternative. We make a statement about which one might be true, but we might choose incorrectly. There are four possible scenarios in a hypothesis test, which are summarized in Table 14.1.

Table 14.1: Four different scenarios for hypothesis tests.
Test conclusion
Truth Reject null hypothesis Fail to reject null hypothesis
Null hypothesis is true Type I error Good decision
Alternative hypothesis is true Good decision Type II error

A Type I error is rejecting the null hypothesis when \(H_0\) is actually true. Since we rejected the null hypothesis in the sex discrimination and opportunity cost studies, it is possible that we made a Type I error in one or both of those studies. A Type II error is failing to reject the null hypothesis when the alternative is actually true.

In a US court, the defendant is either innocent \((H_0)\) or guilty \((H_A).\) What does a Type I error represent in this context? What does a Type II error represent? Table 14.1 may be useful.


If the court makes a Type I error, this means the defendant is innocent \((H_0\) true) but wrongly convicted. A Type II error means the court failed to reject \(H_0\) (i.e., failed to convict the person) when they were in fact guilty \((H_A\) true).

Consider the opportunity cost study where we concluded students were less likely to make a DVD purchase if they were reminded that money not spent now could be spent later. What would a Type I error represent in this context?1

How could we reduce the Type I error rate in US courts? What influence would this have on the Type II error rate?


To lower the Type I error rate, we might raise our standard for conviction from “beyond a reasonable doubt” to “beyond a conceivable doubt” so fewer people would be wrongly convicted. However, this would also make it more difficult to convict the people who are actually guilty, so we would make more Type II errors.

How could we reduce the Type II error rate in US courts? What influence would this have on the Type I error rate?2

The example and guided practice above provide an important lesson: if we reduce how often we make one type of error, we generally make more of the other type.

14.1 Discernibility level

The discernibility level provides the cutoff for the p-value which will lead to a decision of “reject the null hypothesis.” Choosing a discernibility level for a test is important in many contexts, and the traditional level is 0.05. However, it is sometimes helpful to adjust the discernibility level based on the application. We may select a level that is smaller or larger than 0.05 depending on the consequences of any conclusions reached from the test.

If making a Type I error is dangerous or especially costly, we should choose a small discernibility level (e.g., 0.01 or 0.001). If we want to be very cautious about rejecting the null hypothesis, we demand very strong evidence favoring the alternative \(H_A\) before we would reject \(H_0.\)

If a Type II error is relatively more dangerous or much more costly than a Type I error, then we should choose a higher discernibility level (e.g., 0.10). Here we want to be cautious about failing to reject \(H_0\) when the null is actually false.

Discernibility levels should reflect consequences of errors.

The discernibility level selected for a test should reflect the real-world consequences associated with making a Type I or Type II error.

14.2 Two-sided hypotheses

In Chapter 11 we explored whether women were discriminated against and whether a simple trick could make students a little thriftier. In these two case studies, we have actually ignored some possibilities:

  • What if men are actually discriminated against?
  • What if the money trick actually makes students spend more?

These possibilities weren’t considered in our original hypotheses or analyses. The disregard of the extra alternatives may have seemed natural since the data pointed in the directions in which we framed the problems. However, there are two dangers if we ignore possibilities that disagree with our data or that conflict with our world view:

  1. Framing an alternative hypothesis simply to match the direction that the data point will generally inflate the Type I error rate. After all the work we have done (and will continue to do) to rigorously control the error rates in hypothesis tests, careless construction of the alternative hypotheses can disrupt that hard work.

  2. If we only use alternative hypotheses that agree with our worldview, then we are going to be subjecting ourselves to confirmation bias, which means we are looking for data that supports our ideas. That’s not very scientific, and we can do better!

The original hypotheses we have seen are called one-sided hypothesis tests because they only explored one direction of possibilities. Such hypotheses are appropriate when we are exclusively interested in the single direction, but usually we want to consider all possibilities. To do so, let’s learn about two-sided hypothesis tests in the context of a new study that examines the impact of using blood thinners on patients who have undergone CPR.

Cardiopulmonary resuscitation (CPR) is a procedure used on individuals suffering a heart attack when other emergency resources are unavailable. This procedure is helpful in providing some blood circulation to keep a person alive, but CPR chest compression can also cause internal injuries. Internal bleeding and other injuries that can result from CPR complicate additional treatment efforts. For instance, blood thinners may be used to help release a clot that is causing the heart attack once a patient arrives in the hospital. However, blood thinners negatively affect internal injuries.

Here we consider an experiment with patients who underwent CPR for a heart attack and were subsequently admitted to a hospital. Each patient was randomly assigned to either receive a blood thinner (treatment group) or not receive a blood thinner (control group). The outcome variable of interest was whether the patient survived for at least 24 hours. (Böttiger et al. 2001)

The cpr data can be found in the openintro R package.

Form hypotheses for this study in plain and statistical language. Let \(p_C\) represent the true survival rate of people who do not receive a blood thinner (corresponding to the control group) and \(p_T\) represent the survival rate for people receiving a blood thinner (corresponding to the treatment group).


We want to understand whether blood thinners are helpful or harmful. We’ll consider both of these possibilities using a two-sided hypothesis test.

  • \(H_0:\) Blood thinners do not have an overall survival effect, i.e., the survival proportions are the same in each group. \(p_T - p_C = 0.\)

  • \(H_A:\) Blood thinners have an impact on survival, either positive or negative, but not zero. \(p_T - p_C \neq 0.\)

Note that if we had done a one-sided hypothesis test, the resulting hypotheses would have been:

  • \(H_0:\) Blood thinners do not have a positive overall survival effect, i.e., the survival proportions for the blood thinner group is the same or lower than the control group. \(p_T - p_C \leq 0.\)

  • \(H_A:\) Blood thinners have a positive impact on survival. \(p_T - p_C > 0.\)

There were 50 patients in the experiment who did not receive a blood thinner and 40 patients who did. The study results are shown in Table 14.2.

Table 14.2: Results for the CPR study. Patients in the treatment group were given a blood thinner, and patients in the control group were not.
Group Died Survived Total
Control 39 11 50
Treatment 26 14 40
Total 65 25 90

What is the observed survival rate in the control group? And in the treatment group? Also, provide a point estimate \((\hat{p}_T - \hat{p}_C)\) for the true difference in population survival proportions across the two groups: \(p_T - p_C.\)3

According to the point estimate, for patients who have undergone CPR outside of the hospital, an additional 13% of these patients survive when they are treated with blood thinners. However, we wonder if this difference could be easily explainable by chance, if the treatment has no effect on survival.

As we did in past studies, we will simulate what type of differences we might see from chance alone under the null hypothesis. By randomly assigning each of the patient’s files to a “simulated treatment” or “simulated control” allocation, we get a new grouping. If we repeat this simulation 1,000 times, we can build a null distribution of the differences shown in Figure 14.1.

Histogram of the null distribution of the point estimate for the difference in proportions, $\hat{p}_T - \hat{p}_C.$ The shaded right tail shows observations that are at least as large as the observed difference, 0.13.
Figure 14.1: Null distribution of the point estimate for the difference in proportions, \(\hat{p}_T - \hat{p}_C.\) The shaded right tail shows observations that are at least as large as the observed difference, 0.13.

The right tail area is 0.135. (Note: it is only a coincidence that we also have \(\hat{p}_T - \hat{p}_C=0.13.)\) However, contrary to how we calculated the p-value in previous studies, the p-value of this test is not actually the tail area we calculated, i.e., it’s not 0.135!

The p-value is defined as the probability we observe a result at least as favorable to the alternative hypothesis as the observed difference. In this case, any differences less than or equal to -0.13 would also provide equally strong evidence favoring the alternative hypothesis as a difference of +0.13 did. A difference of -0.13 would correspond to 13% higher survival rate in the control group than the treatment group. In Figure 14.2 we have also shaded these differences in the left tail of the distribution. These two shaded tails provide a visual representation of the p-value for a two-sided test.

Histogram of the null distribution of the point estimate for the difference in proportions, $\hat{p}_T - \hat{p}_C.$ All values that are at least as extreme as +0.13 but in either direction away from 0 are shaded.
Figure 14.2: Null distribution of the point estimate for the difference in proportions, \(\hat{p}_T - \hat{p}_C.\) All values that are at least as extreme as +0.13 but in either direction away from 0 are shaded.

For a two-sided test, take the single tail (in this case, 0.131) and double it to get the p-value: 0.262. Since this p-value is larger than 0.05, we do not reject the null hypothesis. That is, we do not find convincing evidence that the blood thinner has any influence on survival of patients who undergo CPR prior to arriving at the hospital.

Default to a two-sided test.

We want to be rigorous and keep an open mind when we analyze data and evidence. Use a one-sided hypothesis test only if you truly have interest in only one direction.

Computing a p-value for a two-sided test.

First compute the p-value for one tail of the distribution, then double that value to get the two-sided p-value. That’s it!

Consider the situation of the medical consultant. Now that you know about one-sided and two-sided tests, which type of test do you think is more appropriate?


The setting has been framed in the context of the consultant being helpful (which is what led us to a one-sided test originally), but what if the consultant actually performed worse than the average? Would we care? More than ever! Since it turns out that we care about a finding in either direction, we should run a two-sided test. The p-value for the two-sided test is double that of the one-sided test, here the simulated p-value would be 0.2444.

Generally, to find a two-sided p-value we double the single tail area, which remains a reasonable approach even when the distribution is asymmetric. However, the approach can result in p-values larger than 1 when the point estimate is very near the mean in the null distribution; in such cases, we write that the p-value is 1. Also, very large p-values computed in this way (e.g., 0.85), may also be slightly inflated. Typically, we do not worry too much about the precision of very large p-values because they lead to the same analysis conclusion, even if the value is slightly off.

14.3 Controlling the Type I error rate

Now that we understand the difference between one-sided and two-sided tests, we must recognize when to use each type of test. Because of the result of increased error rates, it is never okay to change two-sided tests to one-sided tests after observing the data. We explore the consequences of ignoring this advice in the next example.

Using \(\alpha=0.05,\) we show that freely switching from two-sided tests to one-sided tests will lead us to make twice as many Type I errors as intended.


Suppose we are interested in finding any difference from 0. We’ve created a smooth-looking null distribution representing differences due to chance below.

Density curve of a normal distribution with mean 0 and standard deviation 1. The shaded regions represent areas where we would reject $H_0$ under the bad practices considered in when $\alpha = 0.05.$

First, suppose the sample difference was larger than 0. In a one-sided test, we would set \(H_A:\) difference \(> 0.\) If the observed difference falls in the upper 5% of the distribution, we would reject \(H_0\) since the p-value would just be the single tail. Thus, if \(H_0\) is true, we incorrectly reject \(H_0\) about 5% of the time when the sample mean is above the null value, as shown above.

Then, suppose the sample difference was smaller than 0. In a one-sided test, we would set \(H_A:\) difference \(< 0.\) If the observed difference falls in the lower 5% of the figure, we would reject \(H_0.\) That is, if \(H_0\) is true, then we would observe this situation about 5% of the time.

By examining these two scenarios, we can determine that we will make a Type I error \(5\%+5\%=10\%\) of the time if we are allowed to swap to the “best” one-sided test for the data. This is twice the error rate we prescribed with our discernibility level: \(\alpha=0.05\)!

Hypothesis tests should be set up before seeing the data.

After observing data, it is tempting to turn a two-sided test into a one-sided test. Avoid this temptation. Hypotheses should be set up before observing the data.

14.4 Power

Although we won’t go into extensive detail here, power is an important topic for follow-up consideration after understanding the basics of hypothesis testing. A good power analysis is a vital preliminary step to any study as it will inform whether the data you collect are sufficient for being able to conclude your research broadly.

Often times in experiment planning, there are two competing considerations:

  • We want to collect enough data that we can detect important effects.
  • Collecting data can be expensive, and, in experiments involving people, there may be some risk to patients.

When planning a study, we want to know how likely we are to detect an effect we care about. In other words, if there is a real effect, and that effect is large enough that it has practical value, then what is the probability that we detect that effect? This probability is called the power, and we can compute it for different sample sizes or different effect sizes.

Power.

The power of the test is the probability of rejecting the null claim when the alternative claim is true.

How easy it is to detect the effect depends on both how big the effect is (e.g., how good the medical treatment is) as well as the sample size.

We think of power as the probability that you will become rich and famous from your science. In order for your science to make a splash, you need to have good ideas! That is, you won’t become famous if you happen to find a single Type I error which rejects the null hypothesis. Instead, you’ll become famous if your science is very good and important (that is, if the alternative hypothesis is true). The better your science is (i.e., the better the medical treatment), the larger the effect size and the easier it will be for you to convince people of your work.

Not only does your science need to be solid, but you also need to have evidence (i.e., data) that shows the effect. A few observations (e.g., \(n = 2)\) is unlikely to be convincing because of well known ideas of natural variability. Indeed, the larger the dataset which provides evidence for your scientific claim, the more likely you are to convince the community that your idea is correct.

Although a full discussion of relative power is beyond the scope of this text, you might be interested to know that, often, paired t-tests (discussed in Section 21.3) are more powerful than independent t-tests (discussed in Section 20.3) because the pairing reduces the inherent variability across observations. Additionally, because the median is almost always more variable than the mean, tests based on the mean are more powerful than tests based on the median. That is to say, reducing variability (done in different ways depending on the experimental design and set-up of the analysis) makes a test more powerful in such that the data are more likely to reject the null hypothesis.

14.5 Chapter review

14.5.1 Summary

Although hypothesis testing provides a strong framework for making decisions based on data, as the analyst, you need to understand how and when the process can go wrong. That is, always keep in mind that the conclusion to a hypothesis test may not be right! Sometimes when the null hypothesis is true, we will accidentally reject it and commit a Type I error; sometimes when the alternative hypothesis is true, we will fail to reject the null hypothesis and commit a Type II error. The power of the test quantifies how likely it is to obtain data which will reject the null hypothesis when indeed the alternative is true; the power of the test is increased when larger sample sizes are taken.

14.5.2 Terms

The terms introduced in this chapter are presented in Table 14.3. If you’re not sure what some of these terms mean, we recommend you go back in the text and review their definitions. You should be able to easily spot them as bolded text.

Table 14.3: Terms introduced in this chapter.
confirmation bias one-sided hypothesis test two-sided hypothesis test
discernibility level power Type I error
null distribution significance level Type II error

14.6 Exercises

Answers to odd-numbered exercises can be found in Appendix A.14.

  1. Testing for Fibromyalgia. A patient named Diana was diagnosed with Fibromyalgia, a long-term syndrome of body pain, and was prescribed anti-depressants. Being the skeptic that she is, Diana didn’t initially believe that anti-depressants would help her symptoms. However after a couple months of being on the medication she decides that the anti-depressants are working, because she feels like her symptoms are in fact getting better.

    1. Write the hypotheses in words for Diana’s skeptical position when she started taking the anti-depressants.

    2. What is a Type I error in this context?

    3. What is a Type II error in this context?

  1. Testing for food safety. A food safety inspector is called upon to investigate a restaurant with a few customer reports of poor sanitation practices. The food safety inspector uses a hypothesis testing framework to evaluate whether regulations are not being met. If he decides the restaurant is in gross violation, its license to serve food will be revoked.

    1. Write the hypotheses in words.

    2. What is a Type I error in this context?

    3. What is a Type II error in this context?

    4. Which error is more problematic for the restaurant owner? Why?

    5. Which error is more problematic for the diners? Why?

    6. As a diner, would you prefer that the food safety inspector requires strong evidence or very strong evidence of health concerns before revoking a restaurant’s license? Explain your reasoning.

  1. Which is higher? In each part below, there is a value of interest and two scenarios: (i) and (ii). For each part, report if the value of interest is larger under scenario (i), scenario (ii), or whether the value is equal under the scenarios.

    1. The standard error of \(\hat{p}\) when (i) \(n = 125\) or (ii) \(n = 500\).

    2. The margin of error of a confidence interval when the confidence level is (i) 90% or (ii) 80%.

    3. The p-value for a Z-statistic of 2.5 calculated based on a (i) sample with \(n = 500\) or based on a (ii) sample with \(n = 1000\).

    4. The probability of making a Type II error when the alternative hypothesis is true and the discernibility level is (i) 0.05 or (ii) 0.10.

  1. True / False. Determine if the following statements are true or false, and explain your reasoning. If false, state how it could be corrected.

    1. If a given value (for example, the null hypothesized value of a parameter) is within a 95% confidence interval, it will also be within a 99% confidence interval.

    2. Decreasing the discernibility level (\(\alpha\)) will increase the probability of making a Type I error.

    3. Suppose the null hypothesis is \(p = 0.5\) and we fail to reject \(H_0\). Under this scenario, the true population proportion is 0.5.

    4. With large sample sizes, even small differences between the null value and the observed point estimate, a difference often called the effect size, will be identified as statistically discernible.

  1. Online communication. A study suggests that 60% of college student spend 10 or more hours per week communicating with others online. You believe that this is incorrect and decide to collect your own sample for a hypothesis test. You randomly sample 160 students from your dorm and find that 70% spent 10 or more hours a week communicating with others online. A friend of yours, who offers to help you with the hypothesis test, comes up with the following set of hypotheses. Indicate any errors you see.

    \[H_0: \hat{p} < 0.6 \quad \quad H_A: \hat{p} > 0.7\]

  1. Same observation, different sample size. Suppose you conduct a hypothesis test based on a sample where the sample size is \(n = 50\), and arrive at a p-value of 0.08. You then refer back to your notes and discover that you made a careless mistake, the sample size should have been \(n = 500\). Will your p-value increase, decrease, or stay the same? Explain.
  1. Estimating \(\pi\). In a class activity, each of 100 students experimentally estimates the value of \(\pi\), 10 separate times. Using the 10 measurements for \(\pi\) (10 values of \(\hat{\pi}\)), each student calculates a confidence interval for \(\pi\). In grading the 100 student assignments, the professor marks 7 of the assignments wrong, indicating that the 7 students must have done their experiments or analysis incorrectly because each of the 7 students reported confidence intervals that did not capture the known true value of \(\pi\), roughly 3.14159. Was the professor correct to mark the assignments wrong for having CIs that did not capture the value of 3.14159? Explain.4
  1. Fermenting yeast. Twenty students work individually in a biology lab to test whether using raw sucrose versus refined sugar will lead to the same yeast fermentation rate. Each student runs a full experiment independently of the other students in the lab. Of the twenty students, twelve are able to reject the null hypothesis and to claim that the fermentation rates are different.5

    1. Explain what type of error was likely to have occurred in this situation.
    2. What change would you suggest that would lower the error rate?
  1. Practical importance vs. statistical discernibility. Determine whether the following statement is true or false, and explain your reasoning: “With large sample sizes, even small differences between the null value and the observed point estimate can be statistically discernible.”
  1. Hypothesis statements. For each of the research claims below, fill in the value and the direction of the null and alternative hypotheses. That is, complete all aspects of the following hypothesis statements. Additionally, for each item, describe \(p\) in words.

    \[H_0: p \_\_\_\_ \_\_\_\_ \quad \quad H_A: p \_\_\_\_ \_\_\_\_\]

    1. On a pre-test to assess knowledge of the upcoming material, a professor wants to determine if their students know, on average, more than if they were just randomly guessing. The pre-test is 30 multiple choice questions, where each question has 5 possible responses.

    2. A standard treatment is known to reduce blood pressure in 32% of patients. A clinical trial is conducted to assess whether a new medical intervention will produce results which are different than the standard treatment, in terms of the percent of patients who will have reduced blood pressure.

    3. In the last presidential election 67% of registered voters turned out to vote. Will the next presidential election have a higher turn-out of voters?


  1. Making a Type I error in this context would mean that reminding students that money not spent now can be spent later does not affect their buying habits, despite the strong evidence (the data suggesting otherwise) found in the experiment. Notice that this does not necessarily mean something was wrong with the data or that we made a computational mistake. Sometimes data simply point us to the wrong conclusion, which is why scientific studies are often repeated to check initial findings.↩︎

  2. To lower the Type II error rate, we want to convict more guilty people. We could lower the standards for conviction from “beyond a reasonable doubt” to “beyond a little doubt”. Lowering the bar for guilt will also result in more wrongful convictions, raising the Type I error rate.↩︎

  3. Observed control survival rate: \(\hat{p}_C = \frac{11}{50} = 0.22.\) Treatment survival rate: \(\hat{p}_T = \frac{14}{40} = 0.35.\) Observed difference: \(\hat{p}_T - \hat{p}_C = 0.35 - 0.22 = 0.13.\)↩︎

  4. This exercise was inspired by discussion with Dr. Annelise Wagner.↩︎

  5. This exercise was inspired by discussion with Dr. Annelise Wagner.↩︎

中文

14  决策错误

利用数据对更大的总体做出推断性决策并不是一个完美的过程。如 第 11所示,较小的 p 值通常会使研究者做出拒绝零假设(或原假设)的决定。然而,有时当零假设实际上为真而数据只是本身具有变异性时,数据也会产生较小的 p 值。在这里我们描述假设检验中可能出现的错误、如何定义和量化不同的错误,以及在可能的情况下减少错误的建议。

假设检验并非完美无缺。想想法庭系统:无辜的人有时被错误定罪,而有罪的人有时逍遥法外。同样,数据也可能指向错误的结论。然而,统计假设检验与法庭系统的区别在于,我们的框架使我们能够量化和控制数据导致我们得出错误结论的频率。

在假设检验中,存在两个相互竞争的假设:零假设和备择假设。我们对哪一个可能为真做出陈述,但我们可能会选择错误。假设检验中有四种可能的情形,总结在 表 14.1.

表 14.1:假设检验的四种不同情形。
检验结论
真实情况 拒绝零假设 未能拒绝零假设
零假设为真 第一类错误 正确的决策
备择假设为真 正确的决策 第二类错误

一个 第一类错误 是在 \(H_0\) 实际为真时拒绝了原假设。由于我们在性别歧视和机会成本研究中拒绝了原假设,我们有可能在其中一项或两项研究中犯了第一类错误。 第二类错误 是在备择假设实际为真时未能拒绝原假设。

在美国法庭上,被告要么是无罪的 \((H_0)\) 要么是有罪的 \((H_A).\) 在这种情境下,第一类错误代表什么?第二类错误代表什么? 表 14.1 可能会有帮助。


如果法庭犯了第一类错误,这意味着被告是无罪的 \((H_0\) 为真)但被错误定罪。第二类错误意味着法庭未能拒绝 \(H_0\) (即未能给此人定罪),而实际上他们是有罪的 \((H_A\) 为真)。

考虑机会成本研究,在该研究中我们得出结论:如果提醒学生现在不花的钱以后可以花,他们购买DVD的可能性会降低。在这种情况下,第一类错误代表什么?1

我们如何降低美国法院的第一类错误率?这会对第二类错误率产生什么影响?


为了降低第一类错误率,我们可能会将定罪标准从“排除合理怀疑”提高到“排除一切可想象的怀疑”,这样被错误定罪的人就会更少。然而,这也会使对真正有罪的人定罪变得更加困难,因此我们会犯更多第二类错误。

我们如何降低美国法院的第二类错误率?这会对第一类错误率产生什么影响?2

上面的例子和引导练习提供了一个重要的教训:如果我们减少犯某一类错误的频率,通常就会犯更多另一类错误。

14.1 可辨别性水平

可辨别性水平 提供了p值的临界值,该临界值将导致“拒绝原假设”的决定。在许多情况下,为检验选择可辨别性水平很重要,传统水平是0.05。但是,有时根据具体应用调整可辨别性水平会有所帮助。根据检验所得出的任何结论的后果,我们可以选择小于或大于0.05的水平。

如果犯第一类错误是危险的或代价特别高,我们应该选择一个较小的可辨别性水平(例如0.01或0.001)。如果我们对拒绝原假设非常谨慎,我们要求有非常强的支持备择假设的证据 \(H_A\) 才会拒绝 \(H_0.\)

如果第二类错误比第一类错误相对更危险或代价高得多,那么我们应该选择较高的可辨别性水平(例如0.10)。在这里,当原假设实际上为假时,我们希望对未能拒绝 \(H_0\) 保持谨慎。

可辨别性水平应反映错误的后果。

为检验选择的可辨别性水平应反映犯第一类错误或第二类错误所关联的现实后果。

14.2 双侧假设

第 11 我们探讨了女性是否受到歧视,以及一个简单的技巧是否能使学生在消费上更节俭一些。在这两个案例研究中,我们实际上忽略了一些可能性:

  • 如果 男性 实际上受到歧视呢?
  • 如果金钱技巧实际上使学生 花更多钱?

这些可能性在我们的原始假设或分析中并未被考虑。由于数据指向了我们构建问题的方向,忽略这些额外的备选方案似乎很自然。然而,如果我们忽略与数据不一致或与我们世界观相冲突的可能性,会有两个危险:

  1. 仅仅为了匹配数据指向的方向而构建备选假设,通常会夸大第一类错误率。毕竟,我们已经(并将继续)做了大量工作来严格控制假设检验中的错误率,而随意构建备选假设可能会破坏这些努力。

  2. 如果我们只使用与自身世界观一致的备选假设,那么我们将陷入 确认偏误,这意味着我们只寻找支持自己想法的数据。这很不科学,我们可以做得更好!

我们之前看到的原始假设被称为 单侧假设检验 ,因为它们只探索了一个方向的可能性。当我们只关注单一方向时,这类假设是合适的,但通常我们希望考虑所有可能性。为此,让我们在一项新的研究中学习 双侧假设检验 ,该研究考察使用血液稀释剂对接受过心肺复苏的患者的影响。

心肺复苏(CPR)是在其他急救资源不可用时,对心脏病发作患者实施的一种急救程序。这一程序有助于提供一定的血液循环以维持患者生命,但CPR胸外按压也可能造成内伤。CPR可能导致的内出血和其他损伤会使后续治疗更加复杂。例如,患者到达医院后,可能会使用血液稀释剂来帮助溶解导致心脏病发作的血栓。然而,血液稀释剂会对内伤产生不利影响。

在这里,我们考虑一项针对因心脏病发作接受心肺复苏(CPR)并随后入院的患者进行的实验。每位患者被随机分配到接受血液稀释剂(治疗组)或不接受血液稀释剂(对照组)。我们关注的结果变量是患者是否存活至少24小时。 (Böttiger et al. 2001)

cpr 数据可以在 openintro R 包中找到。

用通俗语言和统计语言为这项研究提出假设。设 \(p_C\) 表示不接受血液稀释剂的人群(对应对照组)的真实存活率, \(p_T\) 表示接受血液稀释剂的人群(对应治疗组)的存活率。


我们想了解血液稀释剂是有益还是有害。我们将使用双侧假设检验来考虑这两种可能性。

  • \(H_0:\) 血液稀释剂没有总体生存效应,即两组的存活比例相同。 \(p_T - p_C = 0.\)

  • \(H_A:\) 血液稀释剂对生存有影响,无论是正面还是负面的,但不是零。 \(p_T - p_C \neq 0.\)

请注意,如果我们进行的是单侧假设检验,得到的假设将是:

  • \(H_0:\) 血液稀释剂没有正面的总体生存效应,即血液稀释剂组的存活比例与对照组相同或更低。 \(p_T - p_C \leq 0.\)

  • \(H_A:\) 血液稀释剂对生存有正面影响。 \(p_T - p_C > 0.\)

实验中有50名患者未接受血液稀释剂,40名患者接受了血液稀释剂。研究结果如 表 14.2.

表 14.2:CPR研究的结果。治疗组的患者接受了血液稀释剂,对照组的患者未接受。
组别 死亡 存活 总计
对照组 39 11 50
治疗 26 14 40
总计 65 25 90

对照组的观测存活率是多少?治疗组呢?同时给出一个点估计 \((\hat{p}_T - \hat{p}_C)\) 针对两组总体生存比例的真实差异: \(p_T - p_C.\)3

根据点估计,对于在医院外接受过心肺复苏(CPR)的患者,如果使用血液稀释剂治疗,这些患者中会额外有13%的人存活。然而,我们想知道,如果治疗对生存没有影响,这个差异是否很容易用偶然性来解释。

正如我们在以往研究中做的那样,我们将模拟在原假设下仅凭偶然因素可能看到什么样的差异。通过将每位患者的档案随机分配到“模拟治疗组”或“模拟对照组”,我们得到一个新的分组。如果我们重复这个模拟1,000次,就可以构建一个 原分布 ,展示图中的差异。 图 14.1.

Histogram of the null distribution of the point estimate for the difference in proportions, $\hat{p}_T - \hat{p}_C.$ The shaded right tail shows observations that are at least as large as the observed difference, 0.13.
图14.1:比例差异点估计的零分布, \(\hat{p}_T - \hat{p}_C.\) 右侧阴影尾部显示了至少与观察到的差异0.13一样大的观测值。

右侧尾部面积为0.135。(注意:我们也有一个0.13,这只是巧合。 \(\hat{p}_T - \hat{p}_C=0.13.)\) 然而,与我们之前研究中计算p值的方法相反,这个检验的p值实际上并不是我们计算出的尾部面积,也就是说,它不是0.135!

p值被定义为观察到至少与观察到的差异一样有利于备择假设的结果的概率。在本例中,任何小于或等于-0.13的差异也会提供与+0.13的差异同样强的支持备择假设的证据。-0.13的差异对应于对照组比治疗组生存率高13%。在 图 14.2 中,我们也在分布的左尾部对这些差异进行了阴影标注。这两个阴影尾部直观地展示了双侧检验的p值。

Histogram of the null distribution of the point estimate for the difference in proportions, $\hat{p}_T - \hat{p}_C.$ All values that are at least as extreme as +0.13 but in either direction away from 0 are shaded.
图14.2:比例差异点估计的零分布, \(\hat{p}_T - \hat{p}_C.\) 所有至少与+0.13一样极端、但方向可以是偏离0的任一侧的值都被阴影标注。

对于双侧检验,取单侧尾部面积(在本例中为0.131)并将其加倍得到p值:0.262。由于这个p值大于0.05,我们不拒绝原假设。也就是说,我们没有找到令人信服的证据表明血液稀释剂对到达医院前接受过心肺复苏(CPR)的患者的生存有任何影响。

默认使用双侧检验。

我们在分析数据和证据时希望保持严谨并持开放态度。只有当你真正只对一个方向感兴趣时,才使用单侧假设检验。

计算双侧检验的 p 值。

首先计算分布单尾的 p 值,然后将该值乘以 2 得到双侧 p 值。就这么简单!

考虑医疗顾问的情形。既然你已经了解单侧检验和双侧检验,你认为哪种检验更合适?


这个情境的设定是基于顾问有帮助的前提(这正是我们最初采用单侧检验的原因),但如果顾问的实际表现实际上比平均水平 更差 呢?我们会在意吗?比以往任何时候都在意!由于我们关心的是任一方向上的发现,我们应该进行双侧检验。双侧检验的 p 值是单侧检验的两倍,这里模拟得到的 p 值将是 0.2444。

一般来说,求双侧 p 值时我们将单尾面积乘以 2,即使分布不对称,这仍然是一种合理的方法。然而,当点估计非常接近零分布的均值时,这种方法可能导致 p 值大于 1;在这种情况下,我们将 p 值记为 1。此外,用这种方法计算出的非常大的 p 值(例如 0.85)也可能略微偏高。通常,我们不必过于担心非常大的 p 值的精确性,因为即使数值略有偏差,它们也会得出相同的分析结论。

14.3 控制第一类错误率

既然我们已经理解了单侧检验和双侧检验的区别,就必须知道何时使用哪种检验。由于错误率会增加,在观察数据之后将双侧检验改为单侧检验是绝对不可取的。我们将在下一个例子中探讨忽视这一建议的后果。

使用 \(\alpha=0.05,\) 我们证明,随意地从双侧检验切换到单侧检验会导致我们犯第一类错误的次数是预期的两倍。


假设我们感兴趣的是寻找与 0 的任何差异。我们在下面创建了一个平滑的 原分布 来表示由偶然因素造成的差异。

Density curve of a normal distribution with mean 0 and standard deviation 1. The shaded regions represent areas where we would reject $H_0$ under the bad practices considered in when $\alpha = 0.05.$

首先,假设样本差异大于 0。在单侧检验中,我们会设定 \(H_A:\) 差异 \(> 0.\) 如果观测到的差异落在分布的上5%区间内,我们会拒绝 \(H_0\) 因为此时p值恰好就是单尾。因此,如果 \(H_0\) 为真,当样本均值高于原假设值时,我们大约有5%的概率会错误地拒绝 \(H_0\) 如上所示。

然后,假设样本差异小于0。在单侧检验中,我们会设定 \(H_A:\) 差异 \(< 0.\) 如果观测到的差异落在图形的下5%区间内,我们会拒绝 \(H_0.\) 也就是说,如果 \(H_0\) 为真,那么我们大约有5%的概率会观察到这种情况。

通过考察这两种情形,我们可以确定,如果允许我们根据数据切换到“最佳”的单侧检验,我们会有 \(5\%+5\%=10\%\) 的概率犯第一类错误。这是我们根据可辨别性水平所设定的错误率的两倍: \(\alpha=0.05\)!

假设检验应当在 看到数据之前 设定。

在观测数据之后,人们很容易想把双侧检验改成单侧检验。请抵制这种诱惑。假设应当在 看到数据之前 观察数据。

14.4 功效

虽然我们在这里不会深入展开细节,但在理解了假设检验的基础知识之后,功效是一个值得后续深入考虑的重要主题。良好的功效分析是任何研究至关重要的预备步骤,因为它能告诉你所收集的数据是否足以支持你得出较为广泛的研究结论。

在实验规划中,通常有两个相互竞争的考量因素:

  • 我们希望收集足够的数据,以便能够检测到重要的效应。
  • 收集数据的成本可能很高,而且在涉及人的实验中,患者可能面临一定的风险。

在规划研究时,我们想知道检测到我们所关心的效应的可能性有多大。换句话说,如果存在真实效应,并且该效应大到具有实际价值,那么我们检测到该效应的概率是多少?这个概率被称为 功效,我们可以针对不同的样本量或不同的效应大小来计算它。

功效。

检验的功效是当备择主张为真时拒绝原主张的概率。

检测效应的难易程度取决于效应的大小(例如,医疗治疗的效果有多好)以及样本量。

我们把功效想象成你从自己的科学研究中名利双收的概率。要让你的科学研究引起轰动,你需要有好的想法!也就是说,如果你碰巧犯了一次拒绝原假设的第一类错误,你并不会因此成名。相反,只有当你的科学非常出色且重要(即备择假设为真)时,你才会成名。你的科学越好(即医疗治疗越有效), 效应大小 就越大,你也就越容易让人们信服你的工作。

不仅你的科学需要扎实,你还需要有证据(即数据)来证明该效应。少量观测(例如, \(n = 2)\) 由于自然变异的广为人知的观念,很可能不具说服力。事实上,为你的科学主张提供证据的数据集越大,你就越有可能让学界相信你的想法是正确的。

虽然对相对功效的完整讨论超出了本文的范围,但你可能有兴趣知道,通常配对 t 检验(在 Section 21.3中讨论)比独立 t 检验(在 Section 20.3中讨论)更有功效,因为配对减少了观测之间固有的变异。此外,由于中位数几乎总是比均值更具变异性,基于均值的检验比基于中位数的检验更有功效。也就是说,减少变异(根据实验设计和分析设置以不同方式进行)会使检验更有功效,因为数据更有可能拒绝原假设。

14.5 本章复习

14.5.1 小结

虽然假设检验为基于数据做决策提供了一个强有力的框架,但作为分析者,你需要了解这个过程可能如何以及何时出错。也就是说,请始终记住,假设检验的结论可能不正确!有时当原假设为真时,我们会意外地拒绝它并犯第一类错误;有时当备择假设为真时,我们会未能拒绝原假设并犯第二类错误。检验的功效量化了当备择假设确实为真时,获得将拒绝原假设的数据的可能性有多大;当采用更大的样本量时,检验的功效会增加。

14.5.2 术语

本章中介绍的术语列于 表 14.3。如果您不确定其中一些术语的含义,我们建议您回到正文中复习它们的定义。您应该能够很容易地发现它们是 粗体文本.

表 14.3:本章介绍的术语。
确认偏误 单侧假设检验 双侧假设检验
可辨别性水平 功效 第一类错误
原分布 显著性水平 第二类错误

14.6 练习

奇数编号习题的答案见 附录 A.14.

  1. 纤维肌痛检测。 一位名叫戴安娜的患者被诊断出患有纤维肌痛,这是一种长期的身体疼痛综合征,医生给她开了抗抑郁药。作为一个怀疑论者,戴安娜起初并不相信抗抑郁药能缓解她的症状。然而,在服药几个月后,她认为抗抑郁药起作用了,因为她感觉自己的症状确实在好转。

    1. 用文字写出戴安娜开始服用抗抑郁药时持怀疑态度的假设。

    2. 在这种情况下,第一类错误是什么?

    3. 在这种情况下,第二类错误是什么?

  1. 食品安全检测。 一名食品安全检查员被派去调查一家有少数顾客举报卫生习惯不良的餐厅。该食品安全检查员使用假设检验框架来评估餐厅是否未达到规定标准。如果他判定该餐厅严重违规,其食品经营许可证将被吊销。

    1. 用文字写出假设。

    2. 在这种情况下,第一类错误是什么?

    3. 在这种情况下,第二类错误是什么?

    4. 哪种错误对餐厅老板来说更严重?为什么?

    5. 哪种错误对用餐者来说更严重?为什么?

    6. 作为用餐者,你希望食品安全检查员在吊销餐厅许可证之前需要强有力的证据还是非常强有力的健康隐患证据?请解释你的理由。

  1. 哪个更高? 在下面的每一部分中,都有一个感兴趣的数值和两种情形:(i) 和 (ii)。对于每一部分,请报告该感兴趣的数值在情形 (i) 下更大、在情形 (ii) 下更大,还是在两种情形下相等。

    1. 当 (i) \(\hat{p}\) 或 (ii) \(n = 125\) 时的标准误。 \(n = 500\).

    2. 置信水平为 (i) 90% 或 (ii) 80% 时置信区间的误差范围。

    3. 基于 (i) 具有 \(n = 500\) 的样本或基于 (ii) 具有 \(n = 1000\).

    4. 的样本计算得到的 Z 统计量为 2.5 时的 p 值。

  1. 当备择假设为真且可辨别性水平为 (i) 0.05 或 (ii) 0.10 时,犯第二类错误的概率。 判断正误。

    1. 判断下列陈述是正确还是错误,并解释你的理由。如果是错误的,请说明如何改正。

    2. 如果某个给定值(例如参数的原假设值)位于 95% 置信区间内,那么它也将位于 99% 置信区间内。\(\alpha\)降低可辨别性水平(

    3. )会增加犯第一类错误的概率。 \(p = 0.5\) 假设原假设为 \(H_0\),而我们未能拒绝

    4. 。在这种情况下,真实的总体比例为 0.5。

  1. 在线交流。 一项研究表明,60%的大学生每周花10小时或更多时间与他人在线交流。你认为这一说法不正确,于是决定收集自己的样本进行假设检验。你从宿舍中随机抽取了160名学生,发现70%的学生每周花10小时或更多时间与他人在线交流。一位主动帮你做假设检验的朋友提出了以下一组假设。请指出你发现的任何错误。

    \[H_0: \hat{p} < 0.6 \quad \quad H_A: \hat{p} > 0.7\]

  1. 相同的观测,不同的样本量。 假设你基于一个样本进行假设检验,样本量为 \(n = 50\),得到的p值为0.08。随后你查阅笔记,发现自己犯了一个粗心的错误,样本量本应为 \(n = 500\)。你的p值会增加、减少还是保持不变?请解释。
  1. 估计 \(\pi\)。在一次课堂活动中,100名学生每人通过实验对 \(\pi\)的值进行估计,各做10次。利用 \(\pi\) 的10次测量值(即10个 \(\hat{\pi}\)的值),每名学生为 \(\pi\)计算出一个置信区间。在批改这100份学生作业时,教授将其中7份标记为错误,指出这7名学生一定是实验或分析做错了,因为这7名学生报告的置信区间都没有包含 \(\pi\)的已知真实值,约为3.14159。教授因为置信区间未包含3.14159而将作业判为错误,这样做正确吗?请解释。4
  1. 酵母发酵。 二十名学生在生物实验室中各自独立开展实验,检验使用原蔗糖与精制糖是否会导致相同的酵母发酵速率。每名学生都独立于实验室中的其他学生完成完整的实验。在这二十名学生中,有十二名能够拒绝原假设,并声称发酵速率不同。5

    1. 请解释在这种情况下可能发生了哪种类型的错误。
    2. 你会建议做出什么改变来降低错误率?
  1. 实际重要性与统计可辨别性的对比。 判断以下陈述是真是假,并解释你的理由:“在大样本量下,即使零值与观测点估计之间的差异很小,也可能具有统计可辨别性。”
  1. 假设陈述。 对于下面的每个研究主张,填写原假设和备择假设的数值和方向。也就是说,补全以下假设陈述的所有内容。此外,对每个条目,用文字描述 \(p\)

    \[H_0: p \_\_\_\_ \_\_\_\_ \quad \quad H_A: p \_\_\_\_ \_\_\_\_\]

    1. 在一次用于评估学生对即将学习内容掌握情况的前测中,一位教授想确定他们的学生平均而言是否比随机猜测知道得更多。前测共有30道选择题,每道题有5个可能的选项。

    2. 标准疗法已知能使32%的患者血压降低。一项临床试验旨在评估一种新的医疗干预在降低血压的患者百分比方面是否会产生与标准疗法不同的结果。

    3. 在上次总统选举中,67%的登记选民参加了投票。下次总统选举的投票率会更高吗?


  1. 在这种情况下犯第一类错误意味着:提醒学生现在不花的钱以后可以花,这一提醒并不影响他们的购买习惯,尽管实验中发现了强有力的相反证据。请注意,这并不 意味着数据有问题或我们犯了计算错误。有时数据只是把我们引向错误的结论,这就是为什么科学研究常常需要重复进行以检验最初的发现。↩︎

  2. 为了降低第二类错误率,我们希望给更多有罪的人定罪。我们可以把定罪标准从“排除合理怀疑”降低到“排除一点怀疑”。降低定罪门槛也会导致更多冤案,从而提高第一类错误率。↩︎

  3. 观测到的对照组存活率: \(\hat{p}_C = \frac{11}{50} = 0.22.\) 治疗生存率: \(\hat{p}_T = \frac{14}{40} = 0.35.\) 观察到的差异: \(\hat{p}_T - \hat{p}_C = 0.35 - 0.22 = 0.13.\)↩︎

  4. 本练习受与 Annelise Wagner 博士讨论的启发。↩︎

  5. 本练习受与 Annelise Wagner 博士讨论的启发。↩︎