Chapter page 25 / 3817 Inference for comparing two proportions
English

17  Inference for comparing two proportions

We now extend the methods from Chapter 16 to apply confidence intervals and hypothesis tests to differences in population proportions that come from two groups, Group 1 and Group 2: \(p_1 - p_2.\)

In our investigations, we’ll identify a reasonable point estimate of \(p_1 - p_2\) based on the sample, and you may have already guessed its form: \(\hat{p}_1 - \hat{p}_2.\) Then we’ll look at the inferential analysis in three different ways: using a randomization test, applying bootstrapping for interval estimates, and, if we verify that the point estimate can be modeled using a normal distribution, we compute the estimate’s standard error, and we apply the mathematical framework.

17.1 Randomization test for the difference in proportions

17.1.1 Observed data

Let’s take another look at the cardiopulmonary resuscitation (CPR) study we introduced in Section 14.2. The experiment consisted of two treatments on 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.

The results are summarized in Table 17.1 (which is a replica of Table 14.2). 11 out of the 50 patients in the control group and 14 out of the 40 patients in the treatment group survived.

Table 17.1: 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

Is this an observational study or an experiment? What implications does the study type have on what can be inferred from the results?1

In this study, a larger proportion of patients who received blood thinner after CPR,\(\hat{p}_T = \frac{14}{40} = 0.35,\) survived compared to those who did not receive blood thinner, \(\hat{p}_C = \frac{11}{50} = 0.22.\) However, based on these observed proportions alone, we cannot determine whether the difference (\(\hat{p}_T - \hat{p}_C = 0.35 - 0.22 = 0.13\)) provides convincing evidence that blood thinner usage after CPR is effective.

As we saw in Chapter 11, we can re-randomize the responses (survived or died) to the treatment conditions assuming the null hypothesis is true and compute possible differences in proportions. The process by which we randomize observations to two groups is summarized and visualized in Figure 11.8).

17.1.2 Variability of the statistic

Figure 17.1 shows a stacked plot of the differences found from 100 randomization simulations (i.e., repeated iterations as described in Figure 11.8, where each dot represents a simulated difference between the infection rates (control rate minus treatment rate).

A stacked dot plot of differences from 100 simulations produced under the independence model $H_0,$ where in these simulations survival is unaffected by the treatment. Twelve of the 100 simulations had a difference of at least 13%, the difference observed in the study.
Figure 17.1: A stacked dot plot of differences from 100 simulations produced under the independence model \(H_0,\) where in these simulations survival is unaffected by the treatment. Twelve of the 100 simulations had a difference of at least 13%, the difference observed in the study.

17.1.3 Observed statistic vs null statistics

Note that the distribution of these simulated differences is centered around 0. We simulated the differences assuming that the independence model was true, that blood thinners after CPR have no effect on survival. Under the null hypothesis, we expect the difference to be near zero with some random fluctuation, where near is pretty generous in this case since the sample sizes are so small in this study.

How often would you observe a difference of at least 13% (0.13) according to Figure 17.1? Is this a rare event?


It appears that a difference of at least 13% due to chance alone, if the null hypothesis was true would happen about 12% of the time according to Figure 17.1. This is not a very rare event.

The difference of 13% not being a rare event suggests two possible interpretations of the results of the study:

  • \(H_0\) Independence model. Blood thinners after CPR have no effect on survival, and we just happened to observe a difference that would only occur on a rare occasion.
  • \(H_A\) Alternative model. Blood thinners after CPR increase chance of survival, and the difference we observed was actually due to the blood thinners after CPR being effective at increasing the chance of survival, which explains the difference of 13%.

Since we determined that the outcome is not that rare (12% chance of observing a difference of 13% or more under the assumption that blood thinners after CPR have no effect on survival), we fail to reject \(H_0\), and conclude that the study results do not provide strong evidence against the independence model. This does not mean that we have proved that blood thinners are not effective, it just means that this study does not provide convincing evidence that they are effective in this setting.

Statistical inference, is built on evaluating how likely such differences are to occur due to chance if in fact the null hypothesis is true. In statistical inference, data scientists evaluate which model is most reasonable given the data. Errors do occur, just like rare events, and we might choose the wrong model. While we do not always choose correctly, statistical inference gives us tools to control and evaluate how often these errors occur.

17.2 Bootstrap confidence interval for the difference in proportions

In Section 17.1, we worked with the randomization distribution to understand the distribution of \(\hat{p}_1 - \hat{p}_2\) when the null hypothesis \(H_0: p_1 - p_2 = 0\) is true. Now, through bootstrapping, we study the variability of \(\hat{p}_1 - \hat{p}_2\) without assuming the null hypothesis is true.

17.2.1 Observed data

Reconsider the CPR data from Section 17.1 which is provided in Table 14.2. Again, we use the difference in sample proportions as the observed statistic of interest. Here, the value of the statistic is: \(\hat{p}_T - \hat{p}_C = 0.35 - 0.22 = 0.13.\)

17.2.2 Variability of the difference in sample proportions

The bootstrap method applied to two samples is an extension of the method described in Chapter 12. Now, we have two samples, so each sample estimates the population from which they came. In the CPR setting, the treatment sample estimates the population of all individuals who have gotten (or will get) the treatment; the control sample estimates the population of all individuals who do not get the treatment and are controls. Figure 17.2 extends Figure 12.1 to show the bootstrapping process from two samples simultaneously.

Sample 1 is taken from Population 1 (3 colored marbles out of 7); Sample 2 is taken from Population 2 (5 colored marbles out of 9). Each of the two samples is used to create separate infinitely large proxy populations. Proxy population 1 has 3/7 colored marbles; proxy population 2 has 4/9 colored marbles.
Figure 17.2: Creating two populations from which to take each of the bootstrap samples.

As before, once the population is estimated, we can randomly resample observations to create bootstrap samples, as seen in Figure 17.3.

Sample 1 is taken from Population 1 (3 colored marbles out of 7); Sample 2 is taken from Population 2 (5 colored marbles out of 9). Each of the two samples is used to create separate infinitely large proxy populations. Proxy population 1 has 3/7 colored marbles; proxy population 2 has 4/9 colored marbles. Resamples are taken from each of the proxy populations. The three resamples from proxy population 1 have 2/7, 4/7 and 5/7 colored marbles, respectively. The three resamples from proxy population 2 have 5/9, 4/9, and 7/9 colored smarbles, respectively.
Figure 17.3: Taking each bootstrap sample from the estimated population.

The variability of the statistic (the difference in sample proportions) can be calculated by taking one bootstrap resample from Sample 1 and one bootstrap resample from Sample 2 and calculating the difference in the bootstrap proportions.

The first resamples from each of the two proxy populations are compared. Resample 1 from proxy population 1 has 2/7 colored marbles; resample 1 from proxy population 2 has 5/9 colored marbles. The difference in bootstrap proportions is taken as 2/7 minus 5/9.
Figure 17.4: For example, the first bootstrap resamples from Sample 1 and Sample 2 provide resample proportions of 2/7 and 5/9, respectively.

As always, the variability of the difference in proportions can only be estimated by repeated simulations, in this case, repeated bootstrap resamples. Figure 17.4 shows multiple bootstrap differences calculated for each of the repeated bootstrap samples.

Shown are the two infinitely large proxy populations (created from sample 1 and sample 2). From each proxy population, three resamples are shown. For each pair of resamples, the difference in bootstrap proportions is taken. The first pair of resamples gives a difference in bootstrapped proportions of 2/7 minus 5/9; the second pair of resamples gives a difference in bootstrapped proportions of 4/7 minus 4/9; the last pair of resamples gives a difference in bootstrapped proportions of 5/7 minus 7/9.
Figure 17.5: For each pair of bootstrap samples, we calculate the difference in sample proportions.

Repeated bootstrap simulations lead to a bootstrap sampling distribution of the statistic of interest, here the difference in sample proportions. Figure 17.6 visualizes the process and Figure 17.7 shows 1,000 bootstrap differences in proportions for the CPR data. Note that the CPR data includes 40 and 50 people in the respective groups, and the illustrated example includes 7 and 9 people in the two groups. Accordingly, the variability in the distribution of sample proportions is higher for the illustrated example. As you will see in the mathematical models discussed in Section 17.3, large sample sizes lead to smaller standard errors for a difference in proportions.

Shown are the two infinitely large proxy populations (created from sample 1 and sample 2). From each proxy population, three resamples are shown. For each pair of resamples, the difference in bootstrap proportions is taken. A dotplot displays many differences in bootstrap proportions. The differences range from roughly -0.6 to +0.3.
Figure 17.6: The differences in each bootstrapped pair of proportions are combined to create the sampling distribution of the differences in proportions.
A histogram of differences in proportions from 1000 bootstrap simulations of the CPR data.
Figure 17.7: A histogram of differences in proportions from 1,000 bootstrap simulations of the CPR data. Note that because the CPR data has a larger sample size than the illustrated example, the variability of the difference in proportions is much smaller with the CPR histogram.

17.2.3 Bootstrap percentile vs. SE confidence intervals

Figure 17.7 provides an estimate for the variability of the difference in survival proportions from sample to sample. The values in the histogram can be used in two different ways to create a confidence interval for the parameter of interest: \(p_1 - p_2\).

As in Chapter 12, the bootstrap confidence interval can be calculated directly from the bootstrapped differences in Figure 17.7. The interval created from the percentiles of the distribution is called the percentile interval. Note that here we calculate the 90% confidence interval by finding the \(5^{th}\) and \(95^{th}\) percentile values from the bootstrapped differences. The bootstrap 5 percentile proportion is -0.032 and the 95 percentile is 0.284. The result is: we are 90% confident that, in the population, the true difference in probability of survival for individuals receiving blood thinners after CPR is between -0.032 lower and 0.284 higher than those who did not receive blood thinners. The interval shows that we do not have much definitive evidence of the effect of blood thinners, one way or another.

A histogram of differences in proportions from 1000 bootstrap simulations of the CPR data. The 5th and 95th percentiles are shown as vertical lines.
Figure 17.8: The CPR data is bootstrapped 1,000 times. Each simulation creates a sample from the original data where the probability of survival in the treatment group is \(\hat{p}_{T} = 14/40\) and the probability of survival in the control group is \(\hat{p}_{C} = 11/50.\)

Alternatively, we can use the variability in the bootstrapped differences to calculate a standard error of the difference. The resulting interval is called the SE interval. Section 17.3 details the mathematical model for the standard error of the difference in sample proportions, but the bootstrap distribution typically does an excellent job of estimating the variability of the sampling distribution of the sample statistic.

\[ SE(\hat{p}_T - \hat{p}_C) \approx SE(\hat{p}_{T, boot} - \hat{p}_{C, boot}) = 0.098 \]

The variability of the difference in proportions was calculated in R using the sd() function, but any statistical software will calculate the standard deviation of the differences, here, the exact quantity we hope to approximate.

Note that we do not know the true distribution of \(\hat{p}_T - \hat{p}_C,\) so we will use a rough approximation to find a confidence interval for \(p_T - p_C.\) As seen in the bootstrap histograms, the shape of the distribution is roughly symmetric and bell-shaped. So for a rough approximation, we will apply the 67-95-99.7 rule which tells us that 95% of observed differences should be roughly no farther than 2 SE from the true parameter (difference in proportions). A 95% confidence interval for \(p_T - p_C\) is given by:

\[ \hat{p}_T - \hat{p}_C \pm 2 \cdot SE \rightarrow \ \ \ 14/40 - 11/50 \pm 2 \cdot 0.098 \ \ \ \rightarrow \ \ \ (-0.067, 0.327) \]

We are 95% confident that the true value of \(p_T - p_C\) is between -0.067 and 0.327. Again, the wide confidence interval that contains zero indicates that the study provides very little evidence about the effectiveness of blood thinners. For other percentages, e.g., a 90% bootstrap SE confidence interval, we will use quantiles given by the standard normal distribution, as seen in Section 13.2 and Figure 13.8.

17.2.4 What does 95% mean?

Recall that the goal of a confidence interval is to find a plausible range of values for a parameter of interest. The estimated statistic is not the value of interest, but it is typically the best guess for the unknown parameter. The confidence level (often 95%) is a number that takes a while to get used to. Surprisingly, the percentage does not describe the dataset at hand, it describes many possible datasets. One way to understand a confidence interval is to think about all the confidence intervals that you have ever made or that you will ever make as a scientist, the confidence level describes those intervals.

Figure 17.9 demonstrates a hypothetical situation in which 25 different studies are performed on the exact same population (with the same goal of estimating the true parameter value of \(p_1 - p_2 = 0.47).\) The study at hand represents one point estimate (a dot) and a corresponding interval. It is not possible to know whether the interval at hand is to the right of the unknown true parameter value (the black line) or to the left of that line. It is also impossible to know whether the interval captures the true parameter (is blue) or does not (is red). If we are making 95% intervals, then about 5% of the intervals we create over our lifetime will not capture the parameter of interest (e.g., will be red as in Figure 17.9). What we know is that over our lifetimes as scientists, about 95% of the intervals created and reported on will capture the parameter value of interest: thus the language “95% confident.”

A series of 25 horizontal lines are drawn, representing each of 25 different studies (where a study represents two samples, one from each of population 1 and population 2). Each vertical line starts at the value of the lower bound of the confidence interval and ends at the value of the upper bound of the confidence interval which was created from that particular sample. In the center of the line is a solid dot at the observed difference in proportion of successes for sample 1 minus sample 2. A dashed vertical line runs through the horizontal lines at p = 0.47 (which is the true value of the diffrence in population proportions). 24 of the 25 horizontal lines cross the vertical line at 0.47, but one of the horizontal lines is completely above than 0.47. The line that does not cross 0.47 is colored red because the confidence interval from that particular sample would not have captured the true difference in population proportions.
Figure 17.9: One hypothetical population, parameter value of: \(p_1 - p_2 = 0.47.\) Twenty-five different studies all which led to a different point estimate, SE, and confidence interval. The study at hand is one of the horizontal lines (hopefully a blue line!).’

The choice of 95% or 90% or even 99% as a confidence level is admittedly somewhat arbitrary; however, it is related to the logic we used when deciding that a p-value should be declared as “discernible” if it is lower than 0.05 (or 0.10 or 0.01, respectively). Indeed, one can show mathematically, that a 95% confidence interval and a two-sided hypothesis test at a cutoff of 0.05 will provide the same conclusion when the same data and mathematical tools are applied for the analysis. A full derivation of the explicit connection between confidence intervals and hypothesis tests is beyond the scope of this text.

17.3 Mathematical model for the difference in proportions

17.3.1 Variability of the difference between two proportions

Like with \(\hat{p},\) the difference of two sample proportions \(\hat{p}_1 - \hat{p}_2\) can be modeled using a normal distribution when certain conditions are met. First, we require a broader independence condition, and secondly, the success-failure condition must be met by both groups.

Conditions for the sampling distribution of \(\hat{p}_1 -\hat{p}_2\) to be normal.

The difference \(\hat{p}_1 - \hat{p}_2\) can be modeled using a normal distribution when

  1. Independence (extended). The data are independent within and between the two groups. Generally this is satisfied if the data come from two independent random samples or if the data come from a randomized experiment.
  2. Success-failure condition. The success-failure condition holds for both groups, where we check successes and failures in each group separately. That is, we should have at least 10 successes and 10 failures in each of the two groups.

When these conditions are satisfied, the standard error of \(\hat{p}_1 - \hat{p}_2\) is:

\[SE(\hat{p}_1 - \hat{p}_2) = \sqrt{\frac{p_1(1-p_1)}{n_1} + \frac{p_2(1-p_2)}{n_2}}\]

where \(p_1\) and \(p_2\) represent the population proportions, and \(n_1\) and \(n_2\) represent the sample sizes.

Note that in most cases, the standard error is approximated using the observed data:

\[SE(\hat{p}_1 - \hat{p}_2) = \sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}\]

where \(\hat{p}_1\) and \(\hat{p}_2\) represent the observed sample proportions, and \(n_1\) and \(n_2\) represent the sample sizes.

Recall that the margin of error is defined by the standard error. The margin of error for \(\hat{p}_1 - \hat{p}_2\) can be directly obtained from \(SE(\hat{p}_1 - \hat{p}_2).\)

Margin of error for \(\hat{p}_1 - \hat{p}_2.\)

The margin of error is \(z^\star \times \sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}\) where \(z^\star\) is calculated from a specified percentile on the normal distribution.

17.3.2 Confidence interval for the difference between two proportions

We can apply the generic confidence interval formula for a difference of two proportions, where we use \(\hat{p}_1 - \hat{p}_2\) as the point estimate and substitute the \(SE\) formula:

\[ \begin{aligned} \text{point estimate} \ &\pm \ z^{\star} \ \times \ SE \\ (\hat{p}_1 - \hat{p}_2) \ &\pm \ z^{\star} \times \sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}} \end{aligned} \]

Standard error of the difference in two proportions, \(\hat{p}_1 -\hat{p}_2.\)

When the conditions for the normal model are are met, the variability of the difference in proportions, \(\hat{p}_1 -\hat{p}_2,\) is well described by:

\[SE(\hat{p}_1 -\hat{p}_2) = \sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}\]

We reconsider the experiment for patients who underwent cardiopulmonary resuscitation (CPR) for a heart attack and were subsequently admitted to a hospital. These patients were randomly divided into a treatment group where they received a blood thinner or the control group where they did not receive a blood thinner. The outcome variable of interest was whether the patients survived for at least 24 hours. The results are shown in Table 14.2. Check whether we can model the difference in sample proportions using the normal distribution.


We first check for independence: since this is a randomized experiment, it seems reasonable to assume that the observations are idependent. Next, we check the success-failure condition for each group. We have at least 10 successes and 10 failures in each experiment arm (11, 14, 39, 26), so this condition is also satisfied. With both conditions satisfied, the difference in sample proportions can be reasonably modeled using a normal distribution for these data.

Create and interpret a 90% confidence interval of the difference for the survival rates in the CPR study.


We’ll use \(p_T\) for the survival rate in the treatment group and \(p_C\) for the control group:

\[\hat{p}_{T} - \hat{p}_{C} = \frac{14}{40} - \frac{11}{50} = 0.35 - 0.22 = 0.13\]

We use the standard error formula previously provided. As with the one-sample proportion case, we use the sample estimates of each proportion in the formula in the confidence interval context:

\[SE \approx \sqrt{\frac{0.35 (1 - 0.35)}{40} + \frac{0.22 (1 - 0.22)}{50}} = 0.095\]

For a 90% confidence interval, we use \(z^{\star} = 1.65:\)

\[ \begin{aligned} \text{point estimate} \ &\pm \ z^{\star} \ \times \ SE \\ 0.13 \ &\pm \ 1.65 \ \times \ 0.095 \\ (-0.027 \ &, \ 0.287) \end{aligned} \]

We are 90% confident that individuals receiving blood thinners have between a 2.7% less chance of survival to a 28.7% greater chance of survival than those in the control group. Because 0% is contained in the interval, we do not have enough information to say whether blood thinners help or harm heart attack patients who have been admitted after they have undergone CPR.

Note, the problem was set up as 90% to indicate that there was not a need for a high level of confidence (such a 95% or 99%). A lower degree of confidence increases potential for error, but it also produces a more narrow interval.

A 5-year experiment was conducted to evaluate the effectiveness of fish oils on reducing cardiovascular events, where each subject was randomized into one of two treatment groups (Manson et al. 2019). We’ll consider heart attack outcomes in the patients listed in Table 17.2.

Create a 95% confidence interval for the effect of fish oils on heart attacks for patients who are well-represented by those in the study. Also interpret the interval in the context of the study.2

Table 17.2: Results for the study on n-3 fatty acid supplement and related health benefits.
heart attack no event Total
fish oil 145 12788 12933
placebo 200 12738 12938

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

17.3.3 Hypothesis test for the difference between two proportions

The details for calculating a SE and for checking technical conditions are very similar to that of confidence intervals. However, when the null hypothesis is that \(p_1 - p_2 = 0,\) we use a special proportion called the pooled proportion to estimate the SE and to check the success-failure condition.

Use the pooled proportion when \(H_0\) is \(p_1 - p_2 = 0.\)

When the null hypothesis is that the proportions are equal, use the pooled proportion \((\hat{p}_{\textit{pool}})\) of successes to verify the success-failure condition and estimate the standard error:

\[\hat{p}_{\textit{pool}} = \frac{\text{number of successes}}{\text{number of cases}} = \frac{\hat{p}_1 n_1 + \hat{p}_2 n_2}{n_1 + n_2}\]

Here \(\hat{p}_1 n_1\) represents the number of successes in sample 1 because \(\hat{p}_1 = \frac{\text{number of successes in sample 1}}{n_1}.\)

Similarly, \(\hat{p}_2 n_2\) represents the number of successes in sample 2.

The test statistic for assessing two proportions is a Z.

The Z score is a ratio of how the two sample proportions differ as compared to the expected variability of difference between the proportions.

\[Z = \frac{(\hat{p}_1 - \hat{p}_2) - 0}{\sqrt{\hat{p}_{pool}(1-\hat{p}_{pool}) \bigg(\frac{1}{n_1} + \frac{1}{n_2} \bigg)}}\]

When the null hypothesis is true and the conditions are met, Z has a standard normal distribution. See the box below for calculation of the pooled proportion of successes.

Conditions:

  • Independent observations
  • Large samples: \((n_1 p_1 \geq 10\) and \(n_1 (1-p_1) \geq 10\) and \(n_2 p_2 \geq 10\) and \(n_2 (1-p_2) \geq 10)\)
  • Check conditions using: \((n_1 \hat{p}_{\textit{pool}} \geq 10\) and \(n_1 (1-\hat{p}_{\textit{pool}}) \geq 10\) and \(n_2 \hat{p}_{\textit{pool}}\geq 10\) and \(n_2 (1-\hat{p}_{\textit{pool}}) \geq 10)\)

A mammogram is an X-ray procedure used to check for breast cancer. Whether mammograms should be used is part of a controversial discussion, and it’s the topic of our next example where we learn about 2-proportion hypothesis tests when \(H_0\) is \(p_1 - p_2 = 0\) (or equivalently, \(p_1 = p_2).\)

A 30-year study was conducted with nearly 90,000 participants who identified as female. During a 5-year screening period, each participant was randomized to one of two groups: in the first group, participants received regular mammograms to screen for breast cancer, and in the second group, participants received regular non-mammogram breast cancer exams. No intervention was made during the following 25 years of the study, and we’ll consider death resulting from breast cancer over the full 30-year period. Results from the study are summarized in Table 17.3.

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

If mammograms are much more effective than non-mammogram breast cancer exams, then we would expect to see additional deaths from breast cancer in the control group. On the other hand, if mammograms are not as effective as regular breast cancer exams, we would expect to see an increase in breast cancer deaths in the mammogram group.

Table 17.3: Summary results for breast cancer study.
Death from breast cancer?
Treatment Yes No
control 505 44,405
mammogram 500 44,425

Is this study an experiment or an observational study?3

Set up hypotheses to test whether there was a difference in breast cancer deaths in the mammogram and control groups.4

The research question describing mammograms is set up to address specific hypotheses (in contrast to a confidence interval for a parameter). In order to fully take advantage of the hypothesis testing structure, we assess the randomness under the condition that the null hypothesis is true (as we always do for hypothesis testing). Using the data from Table 17.3, we will check the conditions for using a normal distribution to analyze the results of the study using a hypothesis test.

\[ \begin{aligned} \hat{p}_{\textit{pool}} &= \frac {\text{number of patients who died from breast cancer in the entire study}} {\text{number of patients in the entire study}} \\ &= \frac{500 + 505}{500 + \text{44,425} + 505 + \text{44,405}} \\ &= 0.0112 \end{aligned} \]

This proportion is an estimate of the breast cancer death rate across the entire study, and it’s our best estimate of the proportions \(p_{MGM}\) and \(p_{C}\) if the null hypothesis is true that \(p_{MGM} = p_{C}.\) We will also use this pooled proportion when computing the standard error.

Is it reasonable to model the difference in proportions using a normal distribution in this study?


Because the patients were randomized, observations can be assumed to be independent, both within each group and between treatment groups. We also must check the success-failure condition for each group. Under the null hypothesis, the proportions \(p_{MGM}\) and \(p_{C}\) are equal, so we check the success-failure condition with our best estimate of these values under \(H_0,\) the pooled proportion from the two samples, \(\hat{p}_{\textit{pool}} = 0.0112:\)

\[ \begin{aligned} \hat{p}_{\textit{pool}} \times n_{MGM} &= 0.0112 \times \text{44,925} = 503\\ (1 - \hat{p}_{\textit{pool}}) \times n_{MGM} &= 0.9888 \times \text{44,925} = \text{44,422} \\ \hat{p}_{\textit{pool}} \times n_{C} &= 0.0112 \times \text{44,910} = 503\\ (1 - \hat{p}_{\textit{pool}}) \times n_{C} &= 0.9888 \times \text{44,910} = \text{44,407} \end{aligned} \]

The success-failure condition is satisfied since all values are at least 10. With both conditions satisfied, we can safely model the difference in proportions using a normal distribution.

In the previous example, the pooled proportion was used to check the success-failure condition5. In the next example, we see an additional place where the pooled proportion comes into play: the standard error calculation.

Compute the point estimate of the difference in breast cancer death rates in the two groups, and use the pooled proportion \(\hat{p}_{\textit{pool}} = 0.0112\) to calculate the standard error.


The point estimate of the difference in breast cancer death rates is

\[ \hat{p}_{MGM} - \hat{p}_{C} = \frac{500}{500 + 44,425} - \frac{505}{505 + 44,405} = 0.01113 - 0.01125 = -0.00012 \]

The breast cancer death rate in the mammogram group was 0.012% less than in the control group. Next, the standard error is calculated using the pooled proportion, \(\hat{p}_{\textit{pool}}:\)

\[SE = \sqrt{\frac{\hat{p}_{\textit{pool}}(1-\hat{p}_{\textit{pool}})}{n_{MGM}} + \frac{\hat{p}_{\textit{pool}}(1-\hat{p}_{\textit{pool}})}{n_{C}}}= 0.00070\]

Using the point estimate \(\hat{p}_{MGM} - \hat{p}_{C} = -0.00012\) and standard error \(SE = 0.00070,\) calculate a p-value for the hypothesis test and write a conclusion.


We first compute a test statistic and draw a picture:

\[Z = \frac{\text{point estimate} - \text{null value}}{SE} = \frac{-0.00012 - 0}{0.00070} = -0.17\]

The lower tail area is 0.4325, which we double to get the p-value: 0.8650. Because this p-value is larger than 0.05, we do not reject the null hypothesis. That is, the difference in breast cancer death rates is likely to have occurred just by chance, if the null hypothesis is true. Thus, we do not observe benefits or harm from mammograms relative to a regular breast exam.

Can we conclude that mammograms have no benefits or harm? Here are a few considerations to keep in mind when reviewing the mammogram study as well as any other medical study:

  • We do not reject the null hypothesis, which means we do not have sufficient evidence to conclude that mammograms reduce or increase breast cancer deaths.
  • If mammograms are helpful or harmful, the data suggest the effect isn’t very large.
  • Are mammograms more or less expensive than a non-mammogram breast exam? If one option is much more expensive than the other and does not offer clear benefits, then we should lean towards the less expensive option.
  • The study’s authors also found that mammograms led to over-diagnosis of breast cancer, which means some breast cancers were found (or thought to be found) but that these cancers would not cause symptoms during patients’ lifetimes. That is, something else would kill the patient before breast cancer symptoms appeared. This means some patients may have been treated for breast cancer unnecessarily, and this treatment is another cost to consider. It is also important to recognize that over-diagnosis can cause unnecessary physical or emotional harm to patients.

These considerations highlight the complexity around medical care and treatment recommendations. Experts and medical boards who study medical treatments use considerations like those above to provide their best recommendation based on the current evidence.

17.4 Chapter review

17.4.1 Summary

When the parameter of interest is the difference in population proportions across two groups, randomization tests, bootstrapping, and mathematical modeling can be applied. For confidence intervals, bootstrapping from each group separately will provide a sampling distribution for the difference in sample proportions; the mathematical model shows a similar distributional shape as long as the sample size is large enough to fulfill the success-failure conditions and so that the data are representative of the entire population. Keep in mind that some datasets will produce a confidence interval which does not capture the true parameter, this is the nature of variability! Over your lifetime, about 95% of the confidence intervals you create will capture the parameter of interest, and about 5% won’t. For hypothesis testing, repeated randomization of the explanatory variable creates a null distribution of differences in sample proportions that could have occurred under the null hypothesis. Randomization and the mathematical model will have similar null distributions, as long as the sample size is large enough to fulfill the success-failure conditions.

17.4.2 Terms

The terms introduced in this chapter are presented in Table 17.4. 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 17.4: Terms introduced in this chapter.
percentile interval pooled proportion SE interval
point estimate SE difference in proportions Z score two proportions

17.5 Exercises

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

  1. Disaggregating Asian American tobacco use, hypothesis testing. Understanding cultural differences in tobacco use across different demographic groups can lead to improved health care education and treatment. A recent study disaggregated tobacco use across Asian American ethnic groups including Asian-Indian (n = 4,373), Chinese (n = 4,736), and Filipino (n = 4,912), in comparison to non-Hispanic Whites (n = 275,025). The number of current smokers in each group was reported as Asian-Indian (n = 223), Chinese (n = 279), Filipino (n = 609), and non-Hispanic Whites (n = 50,880). (Rao et al. 2021)

    To determine whether the proportion of Asian-Indian Americans who are current smokers is different from the proportion of Chinese Americans who are smokers, a randomization simulation was performed.

    1. In both words and symbols provide the parameter and statistic of interest for this study. Do you know the numerical value of either the parameter or statistic of interest? If so, provide the numerical value.

    2. The histogram above provides the sampling distribution (under randomization) for \(\hat{p}_{Asian-Indian} - \hat{p}_{Chinese}\) under repeated null randomizations (\(\hat{p}\) is the proportion in the sample who are current smokers). Estimate the standard error of \(\hat{p}_{Asian-Indian} - \hat{p}_{Chinese}\) based on the randomization histogram.

    3. Consider the hypothesis test to determine if there is a difference in proportion of Asian-Indian Americans as compared to Chinese Americans who are current smokers. Write out the null and alternative hypotheses, estimate a p-value using the randomization histogram, and conclude the test in the context of the problem.

  1. Malaria vaccine effectiveness, hypothesis test. With no currently licensed vaccines to inhibit malaria, good news was welcomed with a recent study reporting long-awaited vaccine success for children in Burkina Faso. With 450 children randomized to either one of two different doses of the malaria vaccine or a control vaccine, 89 of 292 malaria vaccine and 106 out of 147 control vaccine children contracted malaria within 12 months after the treatment. (Datoo et al. 2021)

    1. In both words and symbols provide the parameter and statistic of interest for this study. Do you know the numerical value of either the parameter or statisic of interest? If so, provide the numerical value.

    2. The histogram above provides the sampling distribution (under randomization) for \(\hat{p}_{malaria} - \hat{p}_{control}\) under repeated null randomizations (\(\hat{p}\) is the proportion of children in the sample who contracted malaria). Estimate the standard error of \(\hat{p}_{malaria} - \hat{p}_{control}\) based on the randomization histogram.

    3. Consider the hypothesis test constructed to show a lower proportion of children contracting malaria on the malaria vaccine as compared to the control vaccine. Write out the null and alternative hypotheses, estimate a p-value using the randomization histogram, and conclude the test in the context of the problem.

  1. Disaggregating Asian American tobacco use, confidence interval. Based on a study on the degree to which smoking practices differ across ethnic groups. a confidence interval for the difference in current smoking status for Filipino versus Chinese Americans is desired. (Rao et al. 2021)

    1. Consider the bootstrap distribution of difference in sample proportions of current smokers (Filipino Americans minus Chinese Americans) in 1,000 bootstrap repetitions as above. Estimate the standard error of the difference in sample proportions, as seen in the histogram.

    2. Using the standard error from the bootstrap distribution, find a 95% bootstrap SE confidence interval for the true difference in proportion of current smokers (Filipino Americans minus Chinese Americans) in the population. Interpret the interval in the context of the problem.

    3. Using the entire bootstrap distribution, find a 95% bootstrap percentile confidence interval for the true difference in proportion of current smokers (Filipino Americans minus Chinese Americans) in the population. Interpret the interval in the context of the problem.

  2. Malaria vaccine effectiveness, confidence interval. With no currently licensed vaccines to inhibit malaria, good news was welcomed with a recent study reporting long-awaited vaccine success for children in Burkina Faso. With 450 children randomized to either one of two different doses of the malaria vaccine or a control vaccine, 89 of 292 malaria vaccine and 106 out of 147 control vaccine children contracted malaria within 12 months after the treatment. (Datoo et al. 2021)

    1. Consider the bootstrap distribution of difference in sample proportions of children who contracted malaria (malaria vaccine minus control vaccine) in 1000 bootstrap repetitions as above. Estimate the standard error of the difference in sample proportions, as seen in the histogram.

    2. Using the standard error from the bootstrap distribution, find a 95% bootstrap SE confidence interval for the true difference in proportion of children who contract malaria (malaria vaccine minus control vaccine) in the population. Interpret the interval in the context of the problem.

    3. Using the entire bootstrap distribution, find a 95% bootstrap percentile confidence interval for the true difference in proportion of children who contract malaria (malaria vaccine minus control vaccine) in the population. Interpret the interval in the context of the problem.

  1. COVID-19 and degree completion. A 2021 Gallup poll surveyed 3,941 students pursuing a bachelor’s degree and 2,064 students pursuing an associate degree (students were not randomly selected but were weighted so as to represent a random selection of currently enrolled US college students). The poll found that 51% of the bachelor’s degree students and 44% of associate degree students said that the COVID-19 pandemic will negatively impact their ability to complete the degree. (Gallup 2021)

    Below are two histograms generated with different computational approaches (both use 1,000 repetitions) to research questions which could be asked of these data. One of the histograms can be used to do a randomization test on whether the proportions of bachelor’s and associate students who think the COVID-19 pandemic will negatively impact their ability to complete the degree. The other histogram is a bootstrap distribution used to quantify the difference in the proportions of bachelor’s and associate’s students who feel this way.

    1. Are the center and standard error of the two graphs approximately the same? Explain.

    2. Write a research question that can be addressed using the histogram generated with computational method A.

    3. Write a research question that can addressed using the histogram generated with computational method B.

  2. Renewable energy. A 2021 Gallup poll surveyed 5,447 randomly sampled US adults who are Republican (or Republican leaning) and 7,962 who are Democrats (or Democrat leaning). 31% of Republicans and 81% of Democrats said “government regulations are necessary to encourage businesses and consumers to rely more on renewable energy sources”. (Gallup 2021)

    Below are two histograms generated with different computational approaches (both use 1,000 repetitions) to research questions which could be asked of these data. One of the histograms can be used to do a randomization test on whether the proportions of Republicans and Democrats who think government regulations are necessary to encourage businesses and consumers to rely more on renewable energy sources are different. The other histogram is a bootstrap distribution used to quantify the difference in the proportions of Republicans and Democrats who agree with this statement.

    1. Are the center and standard error of the two graphs approximately the same? Explain.

    2. Write a research question that can addressed using the histogram generated with computational method A.

    3. Write a research question that can addressed using the histogram generated with computational method B.

  1. HIV in sub-Saharan Africa. In July 2008 the US National Institutes of Health announced that it was stopping a clinical study early because of unexpected results. The study population consisted of HIV-infected women in sub-Saharan Africa who had been given single dose Nevaripine (a treatment for HIV) while giving birth, to prevent transmission of HIV to the infant. The study was a randomized comparison of continued treatment of a woman (after successful childbirth) with Nevaripine vs Lopinavir, a second drug used to treat HIV. 240 women participated in the study; 120 were randomized to each of the two treatments. Twenty-four weeks after starting the study treatment, each woman was tested to determine if the HIV infection was becoming worse (an outcome called virologic failure). Twenty-six of the 120 women treated with Nevaripine experienced virologic failure, while 10 of the 120 women treated with the other drug experienced virologic failure. (Lockman et al. 2007)

    1. Create a two-way table presenting the results of this study.

    2. State appropriate hypotheses to test for difference in virologic failure rates between treatment groups.

    3. Complete the hypothesis test and state an appropriate conclusion. (Reminder: Verify any necessary conditions for the test.)

  1. Supercommuters. The fraction of workers who are considered “supercommuters”, because they commute more than 90 minutes to get to work, varies by state. Suppose the 1% of Nebraska residents and 6% of New York residents are supercommuters. Now suppose that we plan a study to survey 1000 people from each state, and we will compute the sample proportions \(\hat{p}_{NE}\) for Nebraska and \(\hat{p}_{NY}\) for New York.

    1. What is the associated mean and standard deviation of \(\hat{p}_{NE}\) in repeated samples of size 1000?

    2. What is the associated mean and standard deviation of \(\hat{p}_{NY}\) in repeated samples of size 1000?

    3. Calculate and interpret the mean and standard deviation associated with the difference in sample proportions for the two groups, \(\hat{p}_{NY} - \hat{p}_{NE}\) in repeated samples of 1000 in each group.

    4. How are the standard deviations from parts (a), (b), and (c) related?

  1. National Health Plan. A Kaiser Family Foundation poll for US adults in 2019 found that 79% of Democrats, 55% of Independents, and 24% of Republicans supported a generic “National Health Plan”. There were 347 Democrats, 298 Republicans, and 617 Independents surveyed. 79% of 347 Democrats and 55% of 617 Independents support a National Health Plan. (Kaiser Family Foundation 2019)

    1. Calculate a 95% confidence interval for the difference between the proportion of Democrats and Independents who support a National Health Plan \((p_{D} - p_{I})\), and interpret it in this context. We have already checked conditions for you.

    2. True or false: If we had picked a random Democrat and a random Independent at the time of this poll, it is more likely that the Democrat would support the National Health Plan than the Independent.

  1. Sleep deprivation, CA vs. OR, confidence interval. According to a report on sleep deprivation by the Centers for Disease Control and Prevention, the proportion of California residents who reported insufficient rest or sleep during each of the preceding 30 days is 8.0%, while this proportion is 8.8% for Oregon residents. These data are based on simple random samples of 11,545 California and 4,691 Oregon residents. Calculate a 95% confidence interval for the difference between the proportions of Californians and Oregonians who are sleep deprived and interpret it in context of the data. (CDC 2008)
  1. Gender pay gap in medicine. A study examined the average pay for men and women entering the workforce as doctors for 21 different positions. (Lo Sasso et al. 2011)

    1. If each gender was equally paid, then we would expect about half of those positions to have men paid more than women and women would be paid more than men in the other half of positions. Write appropriate hypotheses to test this scenario.

    2. Men were, on average, paid more in 19 of those 21 positions. Complete a hypothesis test using your hypotheses from part (a).

  1. Sleep deprivation, CA vs. OR, hypothesis test. A CDC report on sleep deprivation rates shows that the proportion of California residents who reported insufficient rest or sleep during each of the preceding 30 days is 8.0%, while this proportion is 8.8% for Oregon residents. These data are based on simple random samples of 11,545 California and 4,691 Oregon residents.

    1. Conduct a hypothesis test to determine if these data provide strong evidence that the rate of sleep deprivation is different for the two states. (Reminder: Check conditions)

    2. It is possible the conclusion of the test in part (a) is incorrect. If this is the case, what type of error was made?

  1. Is yawning contagious? An experiment conducted by the MythBusters, a science entertainment TV program on the Discovery Channel, tested if a person can be subconsciously influenced into yawning if another person near them yawns. 50 people were randomly assigned to two groups: 34 to a group where a person near them yawned (treatment) and 16 to a group where there wasn’t a person yawning near them (control). The visualization below displays how many participants yawned in each group.6

    Suppose we are interested in estimating the difference in yawning rates between the control and treatment groups using a confidence interval. Explain why we cannot construct such an interval using the normal approximation. What might go wrong if we constructed the confidence interval despite this problem?

  1. Heart transplant success. The Stanford University Heart Transplant Study was conducted to determine whether an experimental heart transplant program increased lifespan. Each patient entering the program was officially designated a heart transplant candidate, meaning that he was gravely ill and might benefit from a new heart. Patients were randomly assigned into treatment and control groups. Patients in the treatment group received a transplant, and those in the control group did not. The visualization below displays how many patients survived and died in each group.7 (Turnbull et al. 1974)

    Suppose we are interested in estimating the difference in survival rate between the control and treatment groups using a confidence interval. Explain why we cannot construct such an interval using the normal approximation. What might go wrong if we constructed the confidence interval despite this problem?

  1. Government shutdown. The United States federal government shutdown of 2018–2019 occurred from December 22, 2018 until January 25, 2019, a span of 35 days. A Survey USA poll of 614 randomly sampled Americans during this time period reported that 48% of those who make less than $40,000 per year and 55% of those who make $40,000 or more per year said the government shutdown has not at all affected them personally. A 95% confidence interval for \((p_\text{$<$40K} - p_\text{$\ge$40K})\), where \(p\) is the proportion of those who said the government shutdown has not at all affected them personally, is (-0.16, 0.02). Based on this information, determine if the following statements are true or false, and explain your reasoning if you identify the statement as false. (Survey USA 2019)

    1. At the 5% discernibility level, the data provide convincing evidence of a real difference in the proportion who are not affected personally between Americans who make less than $40,000 annually and Americans who make $40,000 annually.

    2. We are 95% confident that 16% more to 2% fewer Americans who make less than $40,000 per year are not at all personally affected by the government shutdown compared to those who make $40,000 or more per year.

    3. A 90% confidence interval for \((p_\text{$<$40K} - p_\text{$\ge$40K})\) would be wider than the \((-0.16, 0.02)\) interval.

    4. A 95% confidence interval for \((p_\text{$\ge$40K} - p_\text{$<$40K})\) is (-0.02, 0.16).

  1. Online harassment. A Pew Research poll asked US adults aged 18-29 and 30-49 whether they have personally experienced harassment online. A 95% confidence interval for the difference between the proportions of 18-29 year-olds and 30-49 year-olds who have personally experienced harassment online \((p_{18-29} - p_{30-49})\) was calculated to be (0.115, 0.185). Based on this information, determine if the following statements are true or false, and explain your reasoning for each statement you identify as false. (Pew Research Center 2021)

    1. We are 95% confident that the true proportion of 18-29 year-olds who have personally experienced harassment online is 11.5% to 18.5% lower than the true proportion of 30-49 year-olds who have personally experienced harassment online.

    2. We are 95% confident that the true proportion of 18-29 year-olds who have personally experienced harassment online is 11.5% to 18.5% higher than the true proportion of 30-49 year-olds who have personally experienced harassment online.

    3. 95% of random samples will produce 95% confidence intervals that include the true difference between the population proportions of 18-29 year-olds and 30-49 year-olds who have personally experienced harassment online.

    4. We can conclude that there is a discernible difference between the proportions of 18-29 year-olds and 30-49 year-olds who have personally experienced harassment online is too large to plausibly be due to chance, if in fact there is no difference between the two proportions.

    5. The 90% confidence interval for \((p_{18-29} - p_{30-49})\) cannot be calculated with only the information given in this exercise.

  1. Decision errors and comparing proportions I. In the following research studies, conclusions were made based on the data provided. It is always possible that the analysis conclusion could be wrong, although we will almost never actually know if an error has been made or not. For each study conclusion, specify which of a Type I or Type II error could have been made, and state the error in the context of the problem.

    1. The malaria vaccine was seen to be effective at lowering the rate of contracting malaria (when compared to the control vaccine).

    2. In the US population, Asian-Indian Americans and Chinese Americans are not observed to have different proportions of current smokers.

    3. There is no evidence to claim a difference in the proportion of Americans who are not affected personally by a government shutdown when comparing Americans who make less than $40,000 annually and Americans who make $40,000 annually.

  1. Decision errors and comparing proportions II. In the following research studies, conclusions were made based on the data provided. It is always possible that the analysis conclusion could be wrong, although we will almost never actually know if an error has been made or not. For each study conclusion, specify which of a Type I or Type II error could have been made, and state the error in the context of the problem.

    1. Of registered voters in California, the proportion who report not knowing enough to voice an opinion on whether they support off shore drilling is different across those who have a college degree and those who do not.

    2. In comparing Californians and Oregonians, there is no evidence to support a difference in the proportion of each who are sleep deprived.

  1. Active learning. A teacher wanting to increase the active learning component of her course is concerned about student reactions to changes she is planning to make. She conducts a survey in her class, asking students whether they believe more active learning in the classroom (hands on exercises) instead of traditional lecture will helps improve their learning. She does this at the beginning and end of the semester and wants to evaluate whether students’ opinions have changed over the semester. Can she used the methods we learned in this chapter for this analysis? Explain your reasoning.
  1. An apple a day keeps the doctor away. A physical education teacher at a high school wanting to increase awareness on issues of nutrition and health asked her students at the beginning of the semester whether they believed the expression “an apple a day keeps the doctor away”. 40% of the students responded yes. Throughout the semester she started each class with a discussion of a study highlighting positive effects of eating more fruits and vegetables. She conducted the same apple-a-day survey at the end of the semester, and this time 60% of the students responded yes. Can she used a two-proportion method from this section for this analysis? Explain your reasoning.
  1. Malaria vaccine effectiveness, effect size. A randomized controlled trial on malaria vaccine effectiveness randomly assigned 450 children intro either one of two different doses of the malaria vaccine or a control vaccine. 89 of 292 malaria vaccine and 106 out of 147 control vaccine children contracted malaria within 12 months after the treatment. (Datoo et al. 2021)

    Recall that in order to reject the null hypothesis that the two vaccines (malaria and control) are equivalent, we’d need the sample proportion to be about 2 standard errors below the hypothesized value of zero.

    Say that the true difference (in the population) is given as \(\delta,\) the sample sizes are the same in both groups \((n_{malaria} = n_{control}),\) and the true proportion who contract malaria on the control vaccine is \(p_{control} = 0.7.\) If you ran your own study (in the future), how likely is it that you would get a difference in sample proportions that was sufficiently far from zero that you could reject under each of the conditions below. (Hint: Use the mathematical model.)

    1. \(\delta = -0.1\) and \(n_{malaria} = n_{control} = 20\)

    2. \(\delta = -0.4\) and \(n_{malaria} = n_{control} = 20\)

    3. \(\delta = -0.1\) and \(n_{malaria} = n_{control} = 100\)

    4. \(\delta = -0.4\) and \(n_{malaria} = n_{control} = 100\)

    5. What can you conclude about values of \(\delta\) and the sample size?

  1. Diabetes and unemployment. A Gallup poll surveyed Americans about their employment status and whether they have diabetes. The survey results indicate that 1.5% of the 47,774 employed (full or part time) and 2.5% of the 5,855 unemployed 18-29 year-olds have diabetes. (Gallup 2012)

    1. Create a two-way table presenting the results of this study.

    2. State appropriate hypotheses to test for difference in proportions of diabetes between employed and unemployed Americans.

    3. The sample difference is about 1%. If we completed the hypothesis test, we would find that the p-value is very small (about 0), meaning the difference is statistically discernible. Use this result to explain the difference between statistically discernible and practically important findings.


  1. The study is an experiment, as patients were randomly assigned an experiment group. Since this is an experiment, the results can be used to evaluate a causal relationship between blood thinner use after CPR and whether patients survived.↩︎

  2. Because the patients were randomized, the subjects are independent, both within and between the two groups. The success-failure condition is also met for both groups as all counts are at least 10. This satisfies the conditions necessary to model the difference in proportions using a normal distribution. Compute the sample proportions \((\hat{p}_{\text{fish oil}} = 0.0112,\) \(\hat{p}_{\text{placebo}} = 0.0155),\) point estimate of the difference \((0.0112 - 0.0155 = -0.0043),\) and standard error \(SE = \sqrt{\frac{0.0112 \times 0.9888}{12933} + \frac{0.0155 \times 0.9845}{12938}},\) \(SE = 0.00145.\) Next, plug the values into the general formula for a confidence interval, where we’ll use a 95% confidence level with \(z^{\star} = 1.96:\) \(-0.0043 \pm 1.96 \times 0.00145 = (-0.0071, -0.0015).\) We are 95% confident that fish oils decreases heart attacks by 0.15 to 0.71 percentage points (off of a baseline of about 1.55%) over a 5-year period for subjects who are similar to those in the study. Because the interval is entirely below 0, and the treatment was randomly assigned the data provide strong evidence that fish oil supplements reduce heart attacks in patients like those in the study.↩︎

  3. This is an experiment. Patients were randomized to receive mammograms or a standard breast cancer exam. We will be able to make causal conclusions based on this study.↩︎

  4. \(H_0:\) the breast cancer death rate for patients screened using mammograms is the same as the breast cancer death rate for patients in the control, \(p_{MGM} - p_{C} = 0.\) \(H_A:\) the breast cancer death rate for patients screened using mammograms is different than the breast cancer death rate for patients in the control, \(p_{MGM} - p_{C} \neq 0.\)↩︎

  5. For an example of a two-proportion hypothesis test that does not require the success-failure condition to be met, see Section 17.1.↩︎

  6. The yawn data used in this exercise can be found in the openintro R package.↩︎

  7. The heart_transplant data used in this exercise can be found in the openintro R package.↩︎

中文

17  比较两个比例的推断

我们现在将 第 16 将置信区间和假设检验应用于来自两组(第1组和第2组)的总体比例差异: \(p_1 - p_2.\)

在我们的研究中,我们将基于样本确定 \(p_1 - p_2\) 的一个合理的点估计,你可能已经猜到了它的形式: \(\hat{p}_1 - \hat{p}_2.\) 然后我们将以三种不同的方式进行推断分析:使用随机化检验、应用自助法进行区间估计,并且如果我们验证点估计可以用正态分布建模,我们就计算估计值的标准误,并应用数学框架。

17.1 比例差异的随机化检验

17.1.1 观测数据

让我们再来看一下我们在 Section 14.2中介绍的心肺复苏(CPR)研究。该实验对因心脏病发作而接受心肺复苏并随后入院的患者进行了两种处理。每位患者被随机分配到接受血液稀释剂(处理组)或不接受血液稀释剂(对照组)。关注的结局变量是患者是否存活至少24小时。 (Böttiger et al. 2001)

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

结果总结在 表 17.1 (它是 表 14.2的副本)。对照组 50 名患者中有 11 名存活,治疗组 40 名患者中有 14 名存活。

表 17.1:CPR 研究的结果。治疗组的患者服用了血液稀释剂,而对照组的患者没有服用。
组别 死亡 存活 总计
对照组 39 11 50
治疗 26 14 40
总计 65 25 90

这是一项观察性研究还是实验?研究类型对从结果中能推断出什么有何影响?1

在这项研究中,CPR 后接受血液稀释剂治疗的患者中,存活的比例更大,\(\hat{p}_T = \frac{14}{40} = 0.35,\) 相比于未接受血液稀释剂的患者, \(\hat{p}_C = \frac{11}{50} = 0.22.\) 然而,仅凭这些观察到的比例,我们无法确定这一差异(\(\hat{p}_T - \hat{p}_C = 0.35 - 0.22 = 0.13\))是否提供了 令人信服的证据 表明 CPR 后使用血液稀释剂是有效的。

正如我们在 第 11,我们可以在假设零假设成立的前提下,将结果(surviveddied)重新随机分配到各处理条件中,并计算可能的比例差异。将观测值随机分配到两组的过程在 图 11.8).

17.1.2 统计量的变异性

图 17.1 中进行了总结和可视化。 图 11.8展示了 100 次随机化模拟(即如

A stacked dot plot of differences from 100 simulations produced under the independence model $H_0,$ where in these simulations survival is unaffected by the treatment. Twelve of the 100 simulations had a difference of at least 13%, the difference observed in the study.
中所述的重复迭代)所得差异的堆叠图,其中每个点代表感染率之间的一次模拟差异(对照组减去治疗组)。 \(H_0,\) 图 17.1:在独立性模型

17.1.3 下由 100 次模拟产生的差异的堆叠点图,其中在这些模拟中,存活率不受治疗的影响。100 次模拟中有 12 次的差异至少为 13%,即研究中观察到的差异。

观测统计量与零假设统计量的对比。请注意,这些模拟差异的分布以 0 为中心。我们在模拟差异时假设独立性模型成立,即 CPR 后使用血液稀释剂对存活率没有影响。在零假设下,我们预期差异接近于零,并存在一些随机波动,其中 接近 在这里是一个相当宽松的说法,因为该研究的样本量非常小。

根据 图 17.1,你观察到至少 13%(0.13)的差异的频率是多少?这是一个罕见事件吗?


根据 图 17.1,如果原假设为真,仅凭偶然出现至少 13% 的差异大约有 12% 的时间会发生。这并不是一个非常罕见的事件。

13% 的差异并非罕见事件,这提示对研究结果有两种可能的解释:

  • \(H_0\) 独立模型。CPR 后使用血液稀释剂对生存没有影响,我们只是碰巧观察到了一个只在罕见情况下才会出现的差异。
  • \(H_A\) 备择模型。CPR 后使用血液稀释剂提高了生存机会,我们观察到的差异实际上是由于 CPR 后使用血液稀释剂在提高生存机会方面确实有效,这解释了 13% 的差异。

由于我们确定该结果并不那么罕见(在假设 CPR 后使用血液稀释剂对生存没有影响的前提下,观察到 13% 或更大差异的概率为 12%),我们无法拒绝 \(H_0\),并得出结论:研究结果不能提供反对独立模型的有力证据。这并不意味着我们已经证明了血液稀释剂无效,只是意味着这项研究没有提供令人信服的证据表明它们在这种情况下是有效的。

统计推断建立在评估以下问题之上:如果原假设实际上为真,这类差异因偶然因素而发生的可能性有多大。在统计推断中,数据科学家根据数据评估哪个模型最为合理。错误确实会发生,就像罕见事件一样,我们可能会选择错误的模型。虽然我们并不总是能做出正确的选择,但统计推断为我们提供了控制和评估这些错误发生频率的工具。

17.2 比例差异的自助法置信区间

。该民意调查并未提供令人信服的证据,表明大多数发薪日贷款借款人支持关于信用审查和债务偿还评估的规定。,我们利用随机化分布来理解当原假设 \(\hat{p}_1 - \hat{p}_2\) 为真时 \(H_0: p_1 - p_2 = 0\) 的分布。现在,通过自助法,我们在不假设原假设为真的情况下研究 \(\hat{p}_1 - \hat{p}_2\) 的变异性。

17.2.1 观测数据

重新考虑来自 。该民意调查并未提供令人信服的证据,表明大多数发薪日贷款借款人支持关于信用审查和债务偿还评估的规定。 该内容在 表 14.2中提供。同样,我们使用样本比例之差作为所关注的观测统计量。此处,该统计量的值为: \(\hat{p}_T - \hat{p}_C = 0.35 - 0.22 = 0.13.\)

17.2.2 样本比例之差的变异性

应用于两个样本的自助法(bootstrap)是 第 12中所述方法的扩展。现在我们有两个样本,因此每个样本都估计其来源的总体。在 CPR 的情境中, treatment 样本估计的是所有已经接受(或将要接受)治疗的个体总体; control 样本估计的是所有未接受治疗且作为对照组的个体总体。 图 17.2图 12.1 扩展,展示了同时从两个样本进行自助重抽样的过程。

Sample 1 is taken from Population 1 (3 colored marbles out of 7); Sample 2 is taken from Population 2 (5 colored marbles out of 9). Each of the two samples is used to create separate infinitely large proxy populations. Proxy population 1 has 3/7 colored marbles; proxy population 2 has 4/9 colored marbles.
图 17.2:创建两个总体,以便从中抽取各个自助样本。

与之前一样,一旦估计出总体,我们就可以随机重抽样观测值来创建自助样本,如 图 17.3.

Sample 1 is taken from Population 1 (3 colored marbles out of 7); Sample 2 is taken from Population 2 (5 colored marbles out of 9). Each of the two samples is used to create separate infinitely large proxy populations. Proxy population 1 has 3/7 colored marbles; proxy population 2 has 4/9 colored marbles. Resamples are taken from each of the proxy populations. The three resamples from proxy population 1 have 2/7, 4/7 and 5/7 colored marbles, respectively. The three resamples from proxy population 2 have 5/9, 4/9, and 7/9 colored smarbles, respectively.
所示。 图 17.3:从估计出的总体中抽取各个自助样本。

统计量(样本比例之差)的变异性可以通过从样本 1 中抽取一个自助重抽样、从样本 2 中抽取一个自助重抽样,并计算自助比例之差来求得。

The first resamples from each of the two proxy populations are compared. Resample 1 from proxy population 1 has 2/7 colored marbles; resample 1 from proxy population 2 has 5/9 colored marbles. The difference in bootstrap proportions is taken as 2/7 minus 5/9.
图 17.4:例如,来自样本 1 和样本 2 的第一次自助重抽样分别给出 2/7 和 5/9 的重抽样比例。

一如既往,比例之差的变异性只能通过反复模拟来估计,在本例中即反复进行自助重抽样。 图 17.4 展示了为每个重复的自助样本计算出的多个自助差值。

Shown are the two infinitely large proxy populations (created from sample 1 and sample 2). From each proxy population, three resamples are shown. For each pair of resamples, the difference in bootstrap proportions is taken. The first pair of resamples gives a difference in bootstrapped proportions of 2/7 minus 5/9; the second pair of resamples gives a difference in bootstrapped proportions of 4/7 minus 4/9; the last pair of resamples gives a difference in bootstrapped proportions of 5/7 minus 7/9.
图 17.5:对于每一对自助样本,我们计算样本比例的差异。

重复的自助法模拟会产生所关注统计量的自助抽样分布,此处为样本比例的差异。 图 17.6 可视化了这一过程, 图 17.7 展示了 CPR 数据的 1,000 个自助比例差异。请注意,CPR 数据在相应组中分别包含 40 人和 50 人,而图示示例的两组中分别包含 7 人和 9 人。因此,图示示例中样本比例分布的变异性更高。正如你将在 第 17.3 节中讨论的数学模型中看到的,大样本量会使比例差异的标准误更小。

Shown are the two infinitely large proxy populations (created from sample 1 and sample 2). From each proxy population, three resamples are shown. For each pair of resamples, the difference in bootstrap proportions is taken. A dotplot displays many differences in bootstrap proportions. The differences range from roughly -0.6 to +0.3.
图 17.6:将每对自助比例的差异合并起来,构成比例差异的抽样分布。
A histogram of differences in proportions from 1000 bootstrap simulations of the CPR data.
图 17.7:对 CPR 数据进行 1,000 次自助模拟所得比例差异的直方图。请注意,由于 CPR 数据的样本量大于图示示例,因此 CPR 直方图中比例差异的变异性要小得多。

17.2.3 自助百分位数置信区间与 SE 置信区间的比较

图 17.7 提供了从样本到样本的生存比例差异变异性的估计。直方图中的值可以通过两种不同的方式用于为所关注的参数构建置信区间: \(p_1 - p_2\).

第 12,自助置信区间可以直接从 图 17.7的自助差异中计算得出。由分布的百分位数构建的区间称为 百分位数区间。请注意,这里我们通过找出自助差异的 \(5^{th}\)\(95^{th}\) 百分位数值来计算 90% 置信区间。自助 5 百分位比例为 -0.032,95 百分位为 0.284。结果是:我们有 90% 的把握认为,在总体中,接受 CPR 后服用血液稀释剂的个体的真实生存概率差异,比未服用血液稀释剂者低 0.032 至高 0.284 之间。该区间表明,无论哪种情况,我们都没有关于血液稀释剂效果的明确证据。

A histogram of differences in proportions from 1000 bootstrap simulations of the CPR data. The 5th and 95th percentiles are shown as vertical lines.
图 17.8:对 CPR 数据进行 1,000 次自助抽样。每次模拟从原始数据中抽取一个样本,其中处理组的生存概率为 \(\hat{p}_{T} = 14/40\) ,对照组的生存概率为 \(\hat{p}_{C} = 11/50.\)

或者,我们可以利用自助法差值的变异性来计算差值的标准误。所得的区间称为 SE 区间. 第 17.3 节 详细给出了样本比例之差的标准误的数学模型,但自助分布通常能非常好地估计样本统计量的抽样分布的变异性。

\[ SE(\hat{p}_T - \hat{p}_C) \approx SE(\hat{p}_{T, boot} - \hat{p}_{C, boot}) = 0.098 \]

比例之差的变异性在 R 中使用 sd() 函数计算,但任何统计软件都可以计算差值的标准差,这正是我们希望近似的精确量。

请注意,我们并不知道 \(\hat{p}_T - \hat{p}_C,\) 的真实分布,因此我们将使用一个粗略的近似来为 \(p_T - p_C.\) 构建置信区间。正如自助直方图所示,分布的形状大致对称且呈钟形。因此,作为粗略近似,我们将应用 67-95-99.7 法则,该法则告诉我们,95% 的观测差值应大致不超过真实参数(比例之差)2 个标准误。 \(p_T - p_C\) 的 95% 置信区间由下式给出:

\[ \hat{p}_T - \hat{p}_C \pm 2 \cdot SE \rightarrow \ \ \ 14/40 - 11/50 \pm 2 \cdot 0.098 \ \ \ \rightarrow \ \ \ (-0.067, 0.327) \]

我们有 95% 的把握认为 \(p_T - p_C\) 的真实值介于 -0.067 和 0.327 之间。同样,这个包含零的宽置信区间表明,该研究关于血液稀释剂有效性的证据非常有限。对于其他百分比,例如 90% 的自助 SE 置信区间,我们将使用标准正态分布给出的分位数,如 第 13.2 节图 13.8.

17.2.4 所示。95% 意味着什么?

回顾一下,置信区间的目标是找出感兴趣的 参数 的一个合理取值范围。估计的统计量并不是我们关心的值,但它通常是对未知参数的最佳猜测。置信水平(通常为 95%)是一个需要一段时间才能习惯的数字。令人意外的是,这个百分比并不描述手头的数据集,而是描述许多可能的数据集。理解置信区间的一种方式是,把你作为科学家曾经做过或将来会做的所有置信区间放在一起考虑,置信水平描述的是 那些 区间。

图 17.9 展示了一个假设情境:对完全相同的人群进行25项不同的研究(目标相同,都是估计 的真实参数值) \(p_1 - p_2 = 0.47).\) 手头的研究代表一个点估计(一个点)和相应的区间。我们无法知道手头的区间是在未知的真实参数值(黑线)的右侧还是左侧。也无法知道该区间是否捕获了真实参数(是蓝色)还是没有(是红色)。如果我们构造的是95%置信区间,那么在我们一生中所构造的区间中大约有5%将 无法捕获感兴趣的参数(例如,将像 图 17.9中那样是红色的)。我们所知道的是,在我们作为科学家的整个生涯中,所构造并报告的区间中大约有95%会捕获感兴趣的参数值:因此有了“95%置信”这一说法。

A series of 25 horizontal lines are drawn, representing each of 25 different studies (where a study represents two samples, one from each of population 1 and population 2). Each vertical line starts at the value of the lower bound of the confidence interval and ends at the value of the upper bound of the confidence interval which was created from that particular sample. In the center of the line is a solid dot at the observed difference in proportion of successes for sample 1 minus sample 2. A dashed vertical line runs through the horizontal lines at p = 0.47 (which is the true value of the diffrence in population proportions). 24 of the 25 horizontal lines cross the vertical line at 0.47, but one of the horizontal lines is completely above than 0.47. The line that does not cross 0.47 is colored red because the confidence interval from that particular sample would not have captured the true difference in population proportions.
图 17.9:同一个假设总体,参数值为: \(p_1 - p_2 = 0.47.\) 25项不同的研究,每项都得出了不同的点估计、SE和置信区间。手头的研究是其中一条水平线(希望是一条蓝线!)。’

选择95%、90%甚至99%作为置信水平 admittedly 有些随意;然而,它与我们在判定p值低于0.05(或分别为0.10或0.01)时应被宣布为“可辨别”时所使用的逻辑相关。事实上,从数学上可以证明,当对相同的数据应用相同的数学工具进行分析时,95%置信区间和以0.05为临界值的双侧假设检验会得出相同的结论。对置信区间与假设检验之间明确联系的完整推导超出了本书的范围。

17.3 比例差异的数学模型

17.3.1 两个比例之差的变异性

\(\hat{p},\) 类似,当满足某些条件时,两个样本比例之差 \(\hat{p}_1 - \hat{p}_2\) 可以用正态分布来建模。首先,我们要求一个更广泛的独立性条件;其次,成功-失败条件必须同时被两组满足。

使 的抽样分布 \(\hat{p}_1 -\hat{p}_2\) 呈正态分布的条件。

差异 \(\hat{p}_1 - \hat{p}_2\) 在满足以下条件时可以用正态分布建模:

  1. 独立性 (扩展)。数据在两组内部以及两组之间相互独立。通常,如果数据来自两个独立的随机样本,或者数据来自随机化实验,则满足该条件。
  2. 成功-失败条件。 成功-失败条件对两组均成立,此时我们分别检查每组中的成功次数和失败次数。也就是说,两组中每组应至少有 10 次成功和 10 次失败。

当这些条件满足时, \(\hat{p}_1 - \hat{p}_2\) 的标准误为:

\[SE(\hat{p}_1 - \hat{p}_2) = \sqrt{\frac{p_1(1-p_1)}{n_1} + \frac{p_2(1-p_2)}{n_2}}\]

其中 \(p_1\)\(p_2\) 表示总体比例, \(n_1\)\(n_2\) 表示样本量。

请注意,在大多数情况下,标准误是使用观测数据来近似的:

\[SE(\hat{p}_1 - \hat{p}_2) = \sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}\]

其中 \(\hat{p}_1\)\(\hat{p}_2\) 表示观测到的样本比例, \(n_1\)\(n_2\) 表示样本量。

回忆一下,误差幅度由标准误差定义。 \(\hat{p}_1 - \hat{p}_2\) 的误差幅度可以直接从 \(SE(\hat{p}_1 - \hat{p}_2).\)

误差幅度(针对 \(\hat{p}_1 - \hat{p}_2.\)

误差幅度为 \(z^\star \times \sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}\) ,其中 \(z^\star\) 是根据正态分布的某个指定百分位数计算得出的。

17.3.2 两个比例之差的置信区间

我们可以应用两个比例之差的通用置信区间公式,其中使用 \(\hat{p}_1 - \hat{p}_2\) 作为点估计,并代入 \(SE\) 公式:

\[ \begin{aligned} \text{point estimate} \ &\pm \ z^{\star} \ \times \ SE \\ (\hat{p}_1 - \hat{p}_2) \ &\pm \ z^{\star} \times \sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}} \end{aligned} \]

两个比例之差的标准误, \(\hat{p}_1 -\hat{p}_2.\)

当正态模型的条件满足时, 变异性 比例差异的 \(\hat{p}_1 -\hat{p}_2,\) 可以很好地由以下公式描述:

\[SE(\hat{p}_1 -\hat{p}_2) = \sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}\]

我们重新考虑一项针对心脏病发作后接受心肺复苏(CPR)并随后入院的患者所做的实验。这些患者被随机分为接受血液稀释剂的治疗组或未接受血液稀释剂的对照组。我们关注的结果变量是患者是否存活至少24小时。结果如 表 14.2所示。请检验我们是否可以用正态分布来对样本比例的差异进行建模。


我们首先检验独立性:由于这是一项随机实验,可以合理地假设观测值是相互独立的。接下来,我们检验每个组的成功-失败条件。每个实验组中至少有10次成功和10次失败(11、14、39、26),因此该条件也得到满足。由于两个条件均满足,对于这些数据,样本比例的差异可以合理地用正态分布进行建模。

为CPR研究中存活率的差异构建并解释一个90%置信区间。


我们将使用 \(p_T\) 表示治疗组的存活率,使用 \(p_C\) 表示对照组:

\[\hat{p}_{T} - \hat{p}_{C} = \frac{14}{40} - \frac{11}{50} = 0.35 - 0.22 = 0.13\]

我们使用之前给出的标准误公式。与单样本比例的情形一样,在置信区间中我们使用每个比例的样本估计值代入公式:

\[SE \approx \sqrt{\frac{0.35 (1 - 0.35)}{40} + \frac{0.22 (1 - 0.22)}{50}} = 0.095\]

对于90%的置信区间,我们使用 \(z^{\star} = 1.65:\)

\[ \begin{aligned} \text{point estimate} \ &\pm \ z^{\star} \ \times \ SE \\ 0.13 \ &\pm \ 1.65 \ \times \ 0.095 \\ (-0.027 \ &, \ 0.287) \end{aligned} \]

我们有90%的把握认为,接受血液稀释剂的个体与对照组相比,其存活几率介于低2.7%到高28.7%之间。由于该区间包含0%,我们没有足够的信息来判断血液稀释剂对接受CPR后入院的心脏病发作患者是有帮助还是有害。

注意,该问题被设定为90%,这表明不需要很高的置信水平(例如95%或99%)。较低的置信度会增加潜在误差,但也会产生更窄的区间。

一项为期5年的实验旨在评估鱼油在减少心血管事件方面的有效性,每位受试者被随机分配到两个治疗组之一 (Manson et al. 2019)。我们将考虑 表 17.2.

中所列患者的心脏病发作结果。请为鱼油对心脏病发作的影响构建一个95%置信区间,适用于与研究中的患者具有良好代表性的患者群体,并在研究背景下解释该区间。2

表 17.2:关于 n-3 脂肪酸补充剂及其相关健康益处的研究结果。
心脏病发作 无事件 总计
鱼油 145 12788 12933
安慰剂 200 12738 12938

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

17.3.3 两个比例之差的假设检验

计算标准误(SE)和检查技术条件的细节与置信区间非常相似。然而,当原假设为 \(p_1 - p_2 = 0,\) 时,我们使用一个称为 合并比例 的特殊比例来估计标准误并检查成功-失败条件。

何时使用合并比例 \(H_0\) 在学生每周外出超过两个晚上时为 \(p_1 - p_2 = 0.\)

当原假设为两个比例相等时,使用合并比例 \((\hat{p}_{\textit{pool}})\) 来验证成功-失败条件并估计标准误:

\[\hat{p}_{\textit{pool}} = \frac{\text{number of successes}}{\text{number of cases}} = \frac{\hat{p}_1 n_1 + \hat{p}_2 n_2}{n_1 + n_2}\]

这里 \(\hat{p}_1 n_1\) 表示样本 1 中成功的次数,因为 \(\hat{p}_1 = \frac{\text{number of successes in sample 1}}{n_1}.\)

类似地, \(\hat{p}_2 n_2\) 表示样本 2 中成功的次数。

用于评估两个比例的检验统计量是 Z。

Z 分数是一个比值,表示两个样本比例之间的差异相对于比例差异的预期变异程度。

\[Z = \frac{(\hat{p}_1 - \hat{p}_2) - 0}{\sqrt{\hat{p}_{pool}(1-\hat{p}_{pool}) \bigg(\frac{1}{n_1} + \frac{1}{n_2} \bigg)}}\]

当原假设为真且条件满足时,Z 服从标准正态分布。合并的成功比例的计算见下方方框。

F 统计量是各组之间差异程度(MSG)与组内观测值变异程度(MSE)的比值。

  • 独立观测
  • 大样本: \((n_1 p_1 \geq 10\)\(n_1 (1-p_1) \geq 10\)\(n_2 p_2 \geq 10\)\(n_2 (1-p_2) \geq 10)\)
  • 使用以下方法检查条件: \((n_1 \hat{p}_{\textit{pool}} \geq 10\)\(n_1 (1-\hat{p}_{\textit{pool}}) \geq 10\)\(n_2 \hat{p}_{\textit{pool}}\geq 10\)\(n_2 (1-\hat{p}_{\textit{pool}}) \geq 10)\)

乳房 X 光检查是一种用于检查乳腺癌的 X 射线程序。是否应该使用乳房 X 光检查是一个有争议的话题,这也是我们下一个例子的主题,在该例子中我们将学习 2 比例假设检验,当 \(H_0\) 在学生每周外出超过两个晚上时为 \(p_1 - p_2 = 0\) (或等价地, \(p_1 = p_2).\)

一项为期 30 年的研究共招募了近 90,000 名自认为女性的参与者。在 5 年的筛查期内,每位参与者被随机分配到两组之一:第一组的参与者定期接受乳房 X 光检查以筛查乳腺癌,第二组的参与者定期接受非乳房 X 光检查的乳腺癌检查。在随后的 25 年研究期间没有进行任何干预,我们将考察整个 30 年期间因乳腺癌导致的死亡。研究结果总结在 表 17.3.

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

如果乳房 X 光检查比非乳房 X 光检查的乳腺癌检查有效得多,那么我们会预期对照组出现更多因乳腺癌导致的死亡。另一方面,如果乳房 X 光检查不如定期乳腺癌检查有效,我们会预期乳房 X 光检查组的乳腺癌死亡人数增加。

表 17.3:乳腺癌研究的总结结果。
是否死于乳腺癌?
治疗
控制 505 44,405
乳房 X 光检查 500 44,425

这项研究是实验研究还是观察性研究?3

建立假设,以检验乳房 X 光检查组和对照组的乳腺癌死亡人数是否存在差异。4

描述乳房 X 光检查的研究问题是为了检验特定的假设而设立的(与参数的置信区间相反)。为了充分利用假设检验的结构,我们在原假设为真的条件下评估随机性(正如我们进行假设检验时一贯的做法)。使用 表 17.3中的数据,我们将通过假设检验来检查使用正态分布分析研究结果的条件。

\[ \begin{aligned} \hat{p}_{\textit{pool}} &= \frac {\text{number of patients who died from breast cancer in the entire study}} {\text{number of patients in the entire study}} \\ &= \frac{500 + 505}{500 + \text{44,425} + 505 + \text{44,405}} \\ &= 0.0112 \end{aligned} \]

这个比例是对整个研究中乳腺癌死亡率的估计,也是我们对比例的最佳估计 \(p_{MGM}\)\(p_{C}\) 如果原假设为真,即 \(p_{MGM} = p_{C}.\) 我们在计算标准误时也将使用这个合并比例。

在这项研究中,用正态分布来对比例差异建模是否合理?


由于患者是随机分配的,可以假设观测值是相互独立的,包括组内和治疗组之间。我们还必须对每组检验成功-失败条件。在原假设下,比例 \(p_{MGM}\)\(p_{C}\) 相等,所以我们用这些值在 \(H_0,\) 下的最佳估计值,即来自两个样本的合并比例,来检验成功-失败条件, \(\hat{p}_{\textit{pool}} = 0.0112:\)

\[ \begin{aligned} \hat{p}_{\textit{pool}} \times n_{MGM} &= 0.0112 \times \text{44,925} = 503\\ (1 - \hat{p}_{\textit{pool}}) \times n_{MGM} &= 0.9888 \times \text{44,925} = \text{44,422} \\ \hat{p}_{\textit{pool}} \times n_{C} &= 0.0112 \times \text{44,910} = 503\\ (1 - \hat{p}_{\textit{pool}}) \times n_{C} &= 0.9888 \times \text{44,910} = \text{44,407} \end{aligned} \]

由于所有数值都至少为10,成功-失败条件得到满足。由于两个条件都满足,我们可以放心地用正态分布来对比例差异建模。

在前一个例子中,合并比例被用于检验成功-失败条件5。在下一个例子中,我们将看到合并比例发挥作用的另一个地方:标准误的计算。

计算两组乳腺癌死亡率的差异的点估计值,并使用合并比例 \(\hat{p}_{\textit{pool}} = 0.0112\) 来计算标准误。


两组乳腺癌死亡率差异的点估计值为

\[ \hat{p}_{MGM} - \hat{p}_{C} = \frac{500}{500 + 44,425} - \frac{505}{505 + 44,405} = 0.01113 - 0.01125 = -0.00012 \]

乳房X光检查组的乳腺癌死亡率比对照组低0.012%。接下来,计算标准误, 使用合并比例, \(\hat{p}_{\textit{pool}}:\)

\[SE = \sqrt{\frac{\hat{p}_{\textit{pool}}(1-\hat{p}_{\textit{pool}})}{n_{MGM}} + \frac{\hat{p}_{\textit{pool}}(1-\hat{p}_{\textit{pool}})}{n_{C}}}= 0.00070\]

使用点估计值 \(\hat{p}_{MGM} - \hat{p}_{C} = -0.00012\) 和标准误 \(SE = 0.00070,\) 为假设检验计算 p 值并写出结论。


我们首先计算一个检验统计量并画一张图:

\[Z = \frac{\text{point estimate} - \text{null value}}{SE} = \frac{-0.00012 - 0}{0.00070} = -0.17\]

下尾面积为 0.4325,将其加倍得到 p 值:0.8650。由于该 p 值大于 0.05,我们不拒绝原假设。也就是说,如果原假设为真,乳腺癌死亡率的差异很可能只是偶然发生的。因此,相对于常规乳腺检查,我们没有观察到乳房 X 光检查的益处或危害。

我们能得出乳房 X 光检查没有益处或危害的结论吗?在审视乳房 X 光检查研究以及任何其他医学研究时,需要牢记以下几点考虑:

  • 我们不拒绝原假设,这意味着我们没有足够的证据得出乳房 X 光检查会减少或增加乳腺癌死亡的结论。
  • 如果乳房 X 光检查有益或有害,数据表明其影响并不大。
  • 乳房 X 光检查是否比非乳房 X 光乳腺检查更贵或更便宜?如果一种选择比另一种贵得多且没有明显的益处,那么我们应该倾向于较便宜的选择。
  • 该研究的作者还发现,乳房 X 光检查导致了乳腺癌的过度诊断,这意味着发现了一些乳腺癌(或被认为发现了),但这些癌症在患者的有生之年不会引起症状。也就是说,在乳腺癌症状出现之前,其他原因会先导致患者死亡。这意味着一些患者可能接受了不必要的乳腺癌治疗,而这种治疗是另一个需要考虑的成本。同样重要的是要认识到,过度诊断可能给患者带来不必要的身体或情感伤害。

这些考虑凸显了医疗护理和治疗建议的复杂性。研究医疗治疗的专家和医学委员会会使用上述类似的考虑,根据当前证据提供他们最佳的建议。

17.4 本章复习

17.4.1 小结

当感兴趣的参数是两组总体比例的差异时,可以应用随机化检验、自助法和数学建模。对于置信区间,分别对每组进行自助抽样将得到样本比例差异的抽样分布;只要样本量足够大以满足成功-失败条件并使数据能够代表整个总体,数学模型就会显示出类似的分布形状。请记住,某些数据集产生的置信区间不会包含真实参数,这就是变异性的本质!在你的一生中,你创建的置信区间大约有 95% 会包含感兴趣的参数,大约有 5% 不会。对于假设检验,对解释变量进行重复随机化会产生在原假设下可能出现的样本比例差异的原分布。只要样本量足够大以满足成功-失败条件,随机化和数学模型将具有类似的原分布。

17.4.2 术语

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

表 17.4:本章介绍的术语。
百分位数区间 合并比例 SE 区间
点估计 比例差异的 SE 两比例的 Z 分数

17.5 练习

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

  1. 对亚裔美国人烟草使用情况进行细分,假设检验。 了解不同人口群体在烟草使用方面的文化差异可以改善健康教育与治疗。最近一项研究按亚裔美国人的族裔群体细分了烟草使用情况,包括亚裔印度人(n = 4,373)、华人(n = 4,736)和菲律宾裔(n = 4,912),并与非西班牙裔白人(n = 275,025)进行比较。各组当前吸烟者人数报告如下:亚裔印度人(n = 223)、华人(n = 279)、菲律宾裔(n = 609)、非西班牙裔白人(n = 50,880)。 (Rao et al. 2021)

    为了确定目前吸烟的亚裔印度裔美国人的比例是否与华裔美国人中吸烟者的比例不同,进行了随机化模拟。

    1. 请用文字和符号给出本研究感兴趣的参数和统计量。你知道参数或统计量中任何一个的数值吗?如果知道,请给出该数值。

    2. 上面的直方图提供了在重复零假设随机化下 \(\hat{p}_{Asian-Indian} - \hat{p}_{Chinese}\) 的抽样分布(随机化条件下)(\(\hat{p}\) 是样本中目前吸烟者的比例)。请根据随机化直方图估计 \(\hat{p}_{Asian-Indian} - \hat{p}_{Chinese}\) 的标准误。

    3. 考虑用假设检验来确定目前吸烟的亚裔印度裔美国人与华裔美国人的比例是否存在差异。请写出原假设和备择假设,利用随机化直方图估计 p 值,并结合问题背景得出检验结论。

  1. 疟疾疫苗有效性,假设检验。 由于目前尚无获得许可的抑制疟疾的疫苗,最近一项研究报告了布基纳法索儿童期待已久的疫苗成功,这是一个受欢迎的好消息。450 名儿童被随机分配到两种不同剂量的疟疾疫苗之一或对照疫苗,其中疟疾疫苗组的 292 名儿童中有 89 名、对照疫苗组的 147 名儿童中有 106 名在治疗后 12 个月内感染了疟疾。 (Datoo 等人。 2021)

    1. 请用文字和符号给出本研究感兴趣的参数和统计量。你知道参数或统计量中任何一个的数值吗?如果知道,请给出该数值。

    2. 上面的直方图提供了在重复零假设随机化下 \(\hat{p}_{malaria} - \hat{p}_{control}\) 的抽样分布(随机化条件下)(\(\hat{p}\) 是样本中感染疟疾的儿童比例)。请根据随机化直方图估计 \(\hat{p}_{malaria} - \hat{p}_{control}\) 的标准误。

    3. 考虑为证明接种疟疾疫苗的儿童感染疟疾的比例低于对照疫苗而构建的假设检验。写出原假设和备择假设,利用随机化直方图估计 p 值,并结合问题背景得出检验结论。

  1. 细分亚裔美国人的烟草使用情况,置信区间。 基于一项关于吸烟习惯在不同族裔群体之间差异程度的研究,希望得到菲律宾裔美国人与华裔美国人当前吸烟状况差异的置信区间。 (Rao et al. 2021)

    1. 考虑如上所述的 1,000 次 bootstrap 重复中当前吸烟者样本比例之差(菲律宾裔美国人减去华裔美国人)的 bootstrap 分布。从直方图中估计样本比例之差的标准误。

    2. 利用 bootstrap 分布的标准误,求总体中当前吸烟者真实比例之差(菲律宾裔美国人减去华裔美国人)的 95% bootstrap SE 置信区间。并结合问题背景解释该区间。

    3. 利用整个 bootstrap 分布,求总体中当前吸烟者真实比例之差(菲律宾裔美国人减去华裔美国人)的 95% bootstrap 百分位置信区间。并结合问题背景解释该区间。

  2. 疟疾疫苗有效性,置信区间。 由于目前尚无获得许可的抑制疟疾的疫苗,最近一项研究报告了布基纳法索儿童期待已久的疫苗成功,这是一个受欢迎的好消息。450 名儿童被随机分配到两种不同剂量的疟疾疫苗之一或对照疫苗,其中疟疾疫苗组的 292 名儿童中有 89 名、对照疫苗组的 147 名儿童中有 106 名在治疗后 12 个月内感染了疟疾。 (Datoo 等人。 2021)

    1. 考虑如上所述的 1000 次 bootstrap 重复中感染疟疾的儿童样本比例之差(疟疾疫苗减去对照疫苗)的 bootstrap 分布。从直方图中估计样本比例之差的标准误。

    2. 利用 bootstrap 分布的标准误,求总体中感染疟疾的儿童真实比例之差(疟疾疫苗减去对照疫苗)的 95% bootstrap SE 置信区间。并结合问题背景解释该区间。

    3. 利用整个 bootstrap 分布,求总体中感染疟疾的儿童真实比例之差(疟疾疫苗减去对照疫苗)的 95% bootstrap 百分位置信区间。并结合问题背景解释该区间。

  1. COVID-19 与学位完成情况。 2021 年的一项盖洛普民意调查调查了 3,941 名攻读学士学位的学生和 2,064 名攻读副学士学位的学生(学生并非随机抽取,但经过加权以代表当前就读的美国大学生的随机样本)。该调查发现,51% 的学士学位学生和 44% 的副学士学位学生表示 COVID-19 疫情将对她们完成学位的能力产生负面影响。 (盖洛普 2021)

    下面是使用不同计算方法(均使用 1,000 次重复)生成的两个直方图,用于研究可以基于这些数据提出的问题。其中一个直方图可用于对学士学位和副学士学位学生中认为 COVID-19 疫情将对其完成学位能力产生负面影响的比例是否相等进行随机化检验。另一个直方图是用于量化持这种看法的学士学位和副学士学位学生比例之差的 bootstrap 分布。

    1. 两个图形的中心和标准误是否大致相同?请解释。

    2. 写出一个可以使用计算方法 A 生成的直方图来解答的研究问题。

    3. 写出一个可以使用计算方法 B 生成的直方图来解答的研究问题。

  2. 可再生能源。 2021 年盖洛普的一项民意调查随机抽样调查了 5,447 名共和党人(或倾向共和党者)和 7,962 名民主党人(或倾向民主党者)的美国成年人。31% 的共和党人和 81% 的民主党人表示“政府监管对于鼓励企业和消费者更多地依赖可再生能源是必要的”。 (盖洛普 2021)

    下面是使用不同计算方法(均使用 1,000 次重复)生成的两个直方图,用于研究可以针对这些数据提出的问题。其中一个直方图可用于进行随机化检验,检验认为政府监管对于鼓励企业和消费者更多地依赖可再生能源是必要的共和党人和民主党人的比例是否不同。另一个直方图是自助法(bootstrap)分布,用于量化同意这一说法的共和党人和民主党人比例之间的差异。

    1. 两个图形的中心和标准误是否大致相同?请解释。

    2. 写出一个可以使用计算方法 A 生成的直方图来解答的研究问题。

    3. 写出一个可以使用计算方法 B 生成的直方图来解答的研究问题。

  1. 撒哈拉以南非洲的 HIV 问题。 2008 年 7 月,美国国立卫生研究院宣布因出现意外结果而提前终止一项临床研究。研究对象是撒哈拉以南非洲感染 HIV 的女性,她们在分娩时接受了单剂量奈韦拉平(Nevaripine,一种 HIV 治疗药物)以防止 HIV 传播给婴儿。该研究是一项随机比较,比较成功分娩后继续使用奈韦拉平治疗与使用洛匹那韦(Lopinavir,另一种用于治疗 HIV 的药物)治疗的效果。240 名女性参与了该研究,每种治疗各随机分配 120 人。在开始研究治疗二十四周后,对每位女性进行检测,以确定 HIV 感染是否在恶化(这一结果称为 病毒学失败)。接受奈韦拉平治疗的 120 名女性中有 26 人出现病毒学失败,而接受另一种药物治疗的 120 名女性中有 10 人出现病毒学失败。 (Lockman 等人。 2007)

    1. 创建一个双向表来呈现这项研究的结果。

    2. 写出适当的假设,以检验两个治疗组之间病毒学失败率的差异。

    3. 完成该假设检验并给出适当的结论。(提醒:请验证检验所需的必要条件。)

  1. 超级通勤者。 被视为“超级通勤者”的工人比例(即通勤时间超过90分钟才能到达工作地点)因州而异。假设内布拉斯加州居民中有1%,纽约州居民中有6%是超级通勤者。现在假设我们计划开展一项调查,从每个州各调查1000人,并计算内布拉斯加州的样本比例 \(\hat{p}_{NE}\) 和纽约州的样本比例 \(\hat{p}_{NY}\)

    1. 其相关的均值和标准差是多少? \(\hat{p}_{NE}\) 在每次样本量为1000的重复抽样中是多少?

    2. 其相关的均值和标准差是多少? \(\hat{p}_{NY}\) 在每次样本量为1000的重复抽样中是多少?

    3. 计算并解释与两组样本比例之差相关的均值和标准差 \(\hat{p}_{NY} - \hat{p}_{NE}\) (每组重复抽样1000人)。

    4. (a)、(b) 和 (c) 部分的标准差之间有什么关系?

  1. 国家健康计划。 凯泽家庭基金会在2019年对美国成年人的一项民意调查发现,79%的民主党人、55%的独立人士和24%的共和党人支持一项泛指的“国家健康计划”。调查对象包括347名民主党人、298名共和党人和617名独立人士。347名民主党人中的79%和617名独立人士中的55%支持国家健康计划。 (凯泽家庭基金会2019)

    1. 计算支持国家健康计划的民主党人与独立人士比例之差的95%置信区间 \((p_{D} - p_{I})\),并结合此情境进行解释。我们已为你检查过条件。

    2. 判断对错:如果在此次民意调查时随机选取一名民主党人和一名独立人士,民主党人支持国家健康计划的可能性比独立人士更大。

  1. 睡眠不足,加州 vs. 俄勒冈州,置信区间。 根据美国疾病控制与预防中心关于睡眠不足的一份报告,加州居民报告在过去30天内每天休息或睡眠不足的比例为8.0%,而俄勒冈州居民的这一比例为8.8%。这些数据基于对11,545名加州居民和4,691名俄勒冈州居民的简单随机样本。计算睡眠不足的加州人与俄勒冈州人比例之差的95%置信区间,并结合数据情境进行解释。 (CDC 2008)
  1. 医学领域的性别薪酬差距。 一项研究考察了以医生身份进入职场的男性和女性在21个不同职位上的平均薪酬。 (Lo Sasso et al. 2011)

    1. 如果两种性别的薪酬相等,那么我们预期大约一半的职位中男性薪酬高于女性,而在另一半职位中女性薪酬高于男性。写出用于检验这一情景的适当假设。

    2. 在这21个职位中,有19个职位的男性平均薪酬更高。使用你在(a)部分写出的假设完成一次假设检验。

  1. 睡眠不足,加州 vs. 俄勒冈州,假设检验。 美国疾控中心(CDC)关于睡眠不足率的一份报告显示,在过去30天中每天均报告休息或睡眠不足的加州居民比例为8.0%,而俄勒冈州居民的这一比例为8.8%。这些数据基于对11,545名加州居民和4,691名俄勒冈州居民的简单随机样本。

    1. 进行一次假设检验,以确定这些数据是否提供了有力证据,表明两个州的睡眠不足率不同。(提醒:请检查条件)

    2. (a)部分检验的结论有可能是错误的。如果是这样,犯了哪种类型的错误?

  1. 打哈欠会传染吗? 探索频道科学娱乐电视节目《流言终结者》进行了一项实验,测试当附近有人打哈欠时,一个人是否会在潜意识影响下也打哈欠。50人被随机分配到两组:34人被分配到附近有人打哈欠的组(处理组),16人被分配到附近没有人打哈欠的组(对照组)。下面的可视化图表显示了每组中打哈欠的参与者人数。6

    假设我们想用置信区间来估计对照组和处理组之间打哈欠率的差异。请解释为什么不能使用正态近似来构造这样的区间。如果无视这一问题仍然构造了置信区间,可能会出现什么问题?

  1. 心脏移植成功率。 斯坦福大学心脏移植研究旨在确定一项实验性心脏移植项目是否能延长寿命。每位进入该项目的患者都被正式指定为心脏移植候选人,这意味着他病情严重,可能会从新的心脏中获益。患者被随机分配到处理组和对照组。处理组的患者接受了移植,而对照组的患者没有。下面的可视化图表显示了每组中存活和死亡的患者人数。7 (Turnbull 等,1974)

    假设我们想用置信区间来估计对照组和处理组之间存活率的差异。请解释为什么不能使用正态近似来构造这样的区间。如果无视这一问题仍然构造了置信区间,可能会出现什么问题?

  1. 政府停摆。 2018–2019年美国联邦政府停摆从2018年12月22日持续到2019年1月25日,历时35天。在此期间,Survey USA对614名随机抽样的美国人进行的一项民意调查显示,年收入低于4万美元的人中有48%,年收入4万美元或以上的人中有55%表示政府停摆完全没有对他们个人造成影响。关于 \((p_\text{$<$40K} - p_\text{$\ge$40K})\),其中 \(p\) (即表示政府停摆完全没有对其个人造成影响的人的比例)的一个95%置信区间为 (-0.16, 0.02)。根据这些信息,判断以下陈述是真是假,如果你认为某陈述为假,请解释你的理由。 (Survey USA 2019)

    1. 在5%的显著性水平下,数据提供了令人信服的证据,表明年收入低于4万美元的美国人与年收入4万美元的美国人之间在未受个人影响的比例上存在真实差异。

    2. 我们有95%的把握认为,与年收入4万美元或以上的人相比,年收入低于4万美元的美国人中受政府停摆完全没有个人影响的比例高出16%到低出2%。

    3. 关于 \((p_\text{$<$40K} - p_\text{$\ge$40K})\) 的90%置信区间会比 \((-0.16, 0.02)\) 置信区间更宽。

    4. 关于 \((p_\text{$\ge$40K} - p_\text{$<$40K})\) 的95%置信区间为 (-0.02, 0.16)。

  1. 网络骚扰。 皮尤研究中心(Pew Research)的一项民意调查询问了18-29岁和30-49岁的美国成年人是否亲身经历过网络骚扰。关于18-29岁人群与30-49岁人群中亲身经历过网络骚扰的比例之差 \((p_{18-29} - p_{30-49})\) 的95%置信区间经计算为 (0.115, 0.185)。根据这些信息,判断以下陈述是真是假,并对你认为为假的每个陈述解释你的理由。 (皮尤研究中心 2021)

    1. 我们有95%的把握认为,18-29岁人群中亲身经历过网络骚扰的真实比例比30-49岁人群中亲身经历过网络骚扰的真实比例低11.5%到18.5%。

    2. 我们有95%的把握认为,18-29岁人群中亲身经历过网络骚扰的真实比例比30-49岁人群中亲身经历过网络骚扰的真实比例高11.5%到18.5%。

    3. 95%的随机样本将产生包含18-29岁人群与30-49岁人群中亲身经历过网络骚扰的总体比例真实差异的95%置信区间。

    4. 我们可以得出结论:18-29岁与30-49岁人群中亲身经历过网络骚扰的比例之间存在可察觉的差异,且该差异大到不太可能仅由偶然造成——前提是假设这两个比例实际上并无差异。

    5. 的90%置信区间 \((p_{18-29} - p_{30-49})\) 仅凭本练习中给出的信息无法计算。

  1. 决策错误与比例比较 I。 在以下研究中,结论是基于所提供的数据得出的。分析结论总是有可能出错,尽管我们几乎永远不会真正知道是否犯了错误。对于每个研究结论,指出可能犯的是第一类错误还是第二类错误,并结合问题情境陈述该错误。

    1. 与对照疫苗相比,疟疾疫苗在降低感染疟疾的比率方面被证明是有效的。

    2. 在美国人口中,未观察到亚裔印度裔美国人和华裔美国人之间当前吸烟者的比例存在差异。

    3. 没有证据表明,在年收入低于40,000美元的美国人与年收入为40,000美元的美国人之间,未受到政府停摆个人影响的美国人比例存在差异。

  1. 决策错误与比例比较 II。 在以下研究中,结论是基于所提供的数据得出的。分析结论总是有可能出错,尽管我们几乎永远不会真正知道是否犯了错误。对于每个研究结论,指出可能犯的是第一类错误还是第二类错误,并结合问题情境陈述该错误。

    1. 在加利福尼亚州的登记选民中,表示自己了解不够、无法就支持近海钻探发表意见的比例,在拥有大学学位的人群与没有大学学位的人群之间是不同的。

    2. 在比较加利福尼亚州人和俄勒冈州人时,没有证据支持两者睡眠不足的比例存在差异。

  1. 主动学习。 一位想增加课程中主动学习成分的老师担心学生对她计划进行的改变的反应。她在班上进行了一项调查,询问学生是否认为课堂上更多的主动学习(动手练习)代替传统讲授会有助于改善他们的学习。她在学期初和学期末各做了一次调查,想评估学生的观点在学期中是否发生了变化。她可以使用我们在本章中学到的方法进行这一分析吗?请解释你的理由。
  1. 一天一苹果,医生远离我。 一位高中体育老师想提高学生对营养与健康问题的认识,她在学期初询问学生是否相信“一天一苹果,医生远离我”这句话。40%的学生回答是。在整个学期中,她每节课都以讨论一项强调多吃水果和蔬菜的积极影响的研究开始。她在学期末进行了同样的“一天一苹果”调查,这次60%的学生回答是。她可以使用本节中的双比例方法进行这一分析吗?请解释你的理由。
  1. 疟疾疫苗有效性,效应量。 一项关于疟疾疫苗有效性的随机对照试验将450名儿童随机分配到两种不同剂量的疟疾疫苗之一或对照疫苗组。292名接种疟疾疫苗的儿童中有89名,147名接种对照疫苗的儿童中有106名在治疗后12个月内感染了疟疾。 (Datoo 等人。 2021)

    回想一下,为了拒绝两种疫苗(疟疾疫苗和对照疫苗)等效的原假设,我们需要样本比例比假设值零低大约2个标准误。

    假设真实差异(在总体中)为 \(\delta,\) 两组的样本量相同 \((n_{malaria} = n_{control}),\) 且接种对照疫苗后感染疟疾的真实比例为 \(p_{control} = 0.7.\) 如果你(在未来)进行自己的研究,在下面每种条件下,你得到的样本比例之差离零足够远从而能够拒绝原假设的可能性有多大。(提示: 请使用数学模型。)

    1. \(\delta = -0.1\)\(n_{malaria} = n_{control} = 20\)

    2. \(\delta = -0.4\)\(n_{malaria} = n_{control} = 20\)

    3. \(\delta = -0.1\)\(n_{malaria} = n_{control} = 100\)

    4. \(\delta = -0.4\)\(n_{malaria} = n_{control} = 100\)

    5. 关于 \(\delta\) 的取值和样本量,你能得出什么结论?

  1. 糖尿病与失业。 一项盖洛普民意调查就美国人的就业状况以及是否患有糖尿病进行了调查。调查结果显示,47,774名在职(全职或兼职)的18-29岁年轻人中有1.5%,5,855名失业的18-29岁年轻人中有2.5%患有糖尿病。 (盖洛普 2012)

    1. 创建一个双向表来呈现这项研究的结果。

    2. 写出适当的假设,以检验在职与失业美国人之间糖尿病比例的差异。

    3. 样本差异约为1%。如果我们完成假设检验,会发现p值非常小(约为0),这意味着该差异在统计上可辨识。请利用这一结果解释统计上可辨识与实际重要之间的区别。


  1. 该研究是一项实验,因为患者被随机分配到实验组。由于这是一项实验,其结果可用于评估心肺复苏(CPR)后使用血液稀释剂与患者是否存活之间的因果关系。↩︎

  2. 由于患者是随机分配的,受试者在两组内部和两组之间都是独立的。两组的成功-失败条件也得到满足,因为所有计数都至少为10。这满足了使用正态分布对比例差异建模所需的条件。计算样本比例 \((\hat{p}_{\text{fish oil}} = 0.0112,\) \(\hat{p}_{\text{placebo}} = 0.0155),\) 差异的点估计 \((0.0112 - 0.0155 = -0.0043),\) 和标准误 \(SE = \sqrt{\frac{0.0112 \times 0.9888}{12933} + \frac{0.0155 \times 0.9845}{12938}},\) \(SE = 0.00145.\) 接下来,将数值代入置信区间的一般公式,我们将使用95%的置信水平,其中 \(z^{\star} = 1.96:\) \(-0.0043 \pm 1.96 \times 0.00145 = (-0.0071, -0.0015).\) 我们有95%的信心认为,对于与研究对象相似的人群,鱼油在5年期间将心脏病发作减少0.15至0.71个百分点(相对于约1.55%的基线)。由于该区间完全低于0,且治疗是随机分配的,数据提供了强有力的证据,表明鱼油补充剂能减少与研究对象相似的患者的心脏病发作。↩︎

  3. 这是一项实验。患者被随机分配接受乳房X光检查或标准乳腺癌检查。我们将能够基于这项研究得出因果结论。↩︎

  4. \(H_0:\) 使用乳房X光检查筛查的患者乳腺癌死亡率与对照组患者的乳腺癌死亡率相同, \(p_{MGM} - p_{C} = 0.\) \(H_A:\) 使用乳房X光检查筛查的患者乳腺癌死亡率与对照组患者的乳腺癌死亡率不同, \(p_{MGM} - p_{C} \neq 0.\)↩︎

  5. 有关不需要满足成功-失败条件的双比例假设检验示例,请参见 。该民意调查并未提供令人信服的证据,表明大多数发薪日贷款借款人支持关于信用审查和债务偿还评估的规定。.↩︎

  6. yawn 本练习中使用的数据可在 openintro R 包中找到。↩︎

  7. heart_transplant 本练习中使用的数据可在 openintro R 包中找到。↩︎