Skip to main content

Chapter 7 Hypothesis Testing, One-Sample Inference

  • In a one-sample problem, hypotheses are specified about a single distribution.
  • In a two-sample problem, two different distributions are compared.

The null hypothesis, denoted by H0H_0, is the hypothesis that is to be tested. The alternative hypothesis, denoted by H1H_1 is the hypothesis that in some sense contradicts the null hypothesis.

Four possible outcomes in hypothesis testing

Truth: H0H_0Truth: H1H_1
Decision: Accept H0H_0H0H_0 is true and H0H_0 is acceptedH1H_1 is true and H0H_0 is accepted (type II error, β\beta)
Decision: Reject H0H_0H0H_0 is true and H0H_0 is rejected (type I error, α\alpha)H1H_1 is true and H0H_0 is rejected (power, 1β1-\beta)
  • The probability of a type I error is the probability of rejecting the H0H_0 when H0H_0 is true, usually denoted by α\alpha and is commonly referred to as the significance level of a test.
  • The probability of a type II error is the probability of accepting H0H_0 when H1H_1 is true, usually denoted by β\beta.
  • The power of a test is
    1β=1The probability of a type II error=P(rejecting H0H1 is true)1 - \beta = 1 - \text{The probability of a type II error} = P(\text{rejecting } H_0|H_1 \text{ is true})
    The general aim in hypothesis testing is to use statistical tests that make α\alpha and β\beta as small as possible.

One-sample tt test for the mean of a normal distribution: One-Sided Alternatives

Critical-value method

Under H0H_0, For random variable (Xˉμ0)/(S/n)tn1(\bar{X}-\mu_0) / (S/ \sqrt n) \sim t_{n-1}, thus P(tn1<tn1,α)=αP(t_{n-1} < t_{n-1, \alpha}) = \alpha. To test H0:μ=μ0H_0: \mu = \mu_0 (σ\sigma unknown) vs. H1:μ<μ0H_1: \mu < \mu_0 (σ\sigma unknown) with a specified significance level α\alpha, compute the value

t=xˉμ0s/nt = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}
  • If t<tn1,αt < t_{n-1,\, \alpha}, reject H0H_0. Which means the sample results is extremely rare under H0H_0, less than α\alpha, it's unusual.
  • If ttn1,αt \geq t_{n-1,\, \alpha}, accept H0H_0.

Some concepts

  • The value tt in Equation 7.2 is a test statistic; the test procedure is based on this statistic.
  • The value tn1,αt_{n-1,\, \alpha} is a critical value; if t<tn1,αt < t_{n-1,\, \alpha}, reject H0H_0; if ttn1,αt \geq t_{n-1,\, \alpha}, accept H0H_0.
  • Computing a test statistic and comparing it with a critical value determined by the type I error is the critical-value method of hypothesis testing.
  • Traditionally, an α\alpha level of exactly .05 is used most frequently.

p-value method

We can also compute pp-value: the α\alpha level at which the given value of the test statistic (such as tt) is on the borderline between the acceptance and rejection regions:

p=P(tn1t)p = P(t_{n-1} \leq t)

Thus pp is the area to the left of tt under a tn1t_{n−1} distribution. Given the above formula, The pp-value can also be thought of as the probability of obtaining a test statistic as extreme as or more extreme than the actual test statistic obtained, given that the null hypothesis is true. For the above figure, we know tt statistic follows a tn1t_{n-1} distribution. Hence the probability of obtaining a tt statistic that is no larger than the actual tt under H0H_0 is P(tn1t)=pP(t_{n-1} \leq t)=p-value.

pp-value tells us exactly how significant our results are without performing repeated significance tests at different α\alpha levels (like α=0.05,0.1,...\alpha = 0.05, 0.1, ...)

Guidelines for judging the significance of a pp-value

  • If .01p<.05.01 \le p < .05, the results are significant.
  • If .001p<.01.001 \le p < .01, the results are highly significant.
  • If p<.001p < .001, the results are very highly significant.
  • If p>.05p > .05, the results are not statistically significant (sometimes denoted NS).
  • If .05p<.10.05 \le p < .10, a trend toward statistical significance is sometimes noted.

One-sample tt test (H1:μ>μ0H_1: \mu > \mu_0)

In many situations, we wish to use an alternative hypothesis that μ>μ0\mu > \mu_0, To test H0:μ=μ0H_0: \mu = \mu_0 (σ\sigma unknown) vs. H1:μ>μ0H_1: \mu > \mu_0 (σ\sigma unknown) with significance level α\alpha, compute

t=xˉμ0s/nt = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}
  • If t>tn1,1αt > t_{n-1,\, 1-\alpha}, reject H0H_0.
  • If ttn1,1αt \le t_{n-1,\, 1-\alpha}, accept H0H_0.

The pp-value is

p=P(tn1>t)p = P(t_{n-1} > t)

One-sample tt test for the mean of a normal distribution: Two-Sided Alternatives

In the previous section the alternative hypothesis was assumed to be in a specific direction relative to the null hypothesis (μ>μ0\mu > \mu_0 or μ<μ0\mu < \mu_0). In most instances this prior knowledge is unavailable.

A two-tailed test is a test in which the values of the parameter being studied (in this case μ\mu) under the alternative hypothesis are allowed to be either greater than or less than the value of the parameter under the null hypothesis (μ0\mu_0).

For a two-sided alternative, a reasonable decision rule is to reject H0H_0 if the test statistic tt is either too small or too large. That is, reject H0H_0 if t<c1t < c_1 or t>c2t > c_2, and accept H0H_0 if c1tc2c_1 \le t \le c_2.

The constants c1c_1 and c2c_2 are chosen so that the total type I error is α\alpha:

P(reject H0H0 true)=P(tn1<c1H0 true)+P(tn1>c2H0 true)=αP(\text{reject } H_0 \mid H_0 \text{ true}) = P(t_{n-1} < c_1 \mid H_0 \text{ true}) + P(t_{n-1} > c_2 \mid H_0 \text{ true}) = \alpha

For a two-tailed test, half of the type I error is placed in each tail:

P(tn1<c1H0 true)=P(tn1>c2H0 true)=α/2P(t_{n-1} < c_1 \mid H_0 \text{ true}) = P(t_{n-1} > c_2 \mid H_0 \text{ true}) = \alpha/2

Under H0H_0,

P(tn1<tn1,α/2)=P(tn1>tn1,1α/2)=α/2P(t_{n-1} < t_{n-1,\, \alpha/2}) = P(t_{n-1} > t_{n-1,\, 1-\alpha/2}) = \alpha/2

Therefore,

c1=tn1,α/2=tn1,1α/2,c2=tn1,1α/2c_1 = t_{n-1,\, \alpha/2} = -t_{n-1,\, 1-\alpha/2}, \quad c_2 = t_{n-1,\, 1-\alpha/2}

One-sample tt test for a two-sided alternative: to test H0:μ=μ0H_0: \mu = \mu_0 vs. H1:μμ0H_1: \mu \ne \mu_0 with significance level α\alpha, compute

t=xˉμ0s/nt = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}
  • If t>tn1,1α/2|t| > t_{n-1,\, 1-\alpha/2}, reject H0H_0.
  • If ttn1,1α/2|t| \le t_{n-1,\, 1-\alpha/2}, accept H0H_0.

Alternatively, we might want to compute a pp-value as we did in the one-sided case.

pp-value for the two-sided one-sample tt test: let

t=xˉμ0s/nt = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}

Then

p={2P(tn1t),if t02[1P(tn1t)],if t>0p = \begin{cases} 2P(t_{n-1} \le t), & \text{if } t \le 0 \\ 2\left[1 - P(t_{n-1} \le t)\right], & \text{if } t > 0 \end{cases}

In words, if t0t \le 0, the pp-value is two times the area to the left of tt under a tn1t_{n-1} distribution. If t>0t > 0, the pp-value is two times the area to the right of tt.

For a two-sided alternative, the pp-value is the probability under H0H_0 of obtaining a test statistic as extreme as or more extreme than the observed test statistic. Because the alternative is two-sided, extremeness is measured by the absolute value of the test statistic.

The power of a test

One-Sided Alternatives: μ1\mathbf{\mu_1} less than μ0\mathbf{\mu_0}

Suppose H0:μ=μ0H_0: \mu = \mu_0 vs. H1:μ=μ1H_1: \mu = \mu_1. (μ1<μ0\mu_1 < \mu_0) where the underlying distribution was assumed to be normal and the population variance was assumed to be known. Under H0H_0,

Z=(Xˉμ0)/(σ/n)N(0,1)Z = (\bar{X}-\mu_0) / (\sigma / \sqrt{n}) \sim N(0,1)

We can calculate test statistic zz, and for a type I error of α\alpha, H0H_0 is rejected if z<zαz < z_{\alpha} and H0H_0 is accepted if zzαz ≥ z_{\alpha}.

The power of the test is the probability of rejecting H0H_0 when H1H_1 is true. If the true mean under H1H_1 is μ1\mu_1, then

Power=P(reject H0H1 True)=P(Z<zαμ=μ1)=P(Xˉμ0σ/n<zαμ=μ1)=P(Xˉ<μ0+zασnμ=μ1)\begin{aligned} \text{Power} &= P(\text{reject } H_0 \mid H_1 \text{ True}) \\ &= P(Z < z_{\alpha} \mid \mu = \mu_1) \\ &= P\left(\frac{\bar{X} - \mu_0}{\sigma/\sqrt{n}} < z_{\alpha} \mid \mu = \mu_1\right) \\ &= P\left(\bar{X} < \mu_0 + z_{\alpha}\frac{\sigma}{\sqrt{n}} \mid \mu = \mu_1\right) \end{aligned}

Under H1H_1, XˉN(μ1,σ2n)\bar{X} \sim N\left(\mu_1, \frac{\sigma^2}{n}\right). After standardizing the limit,

Power=Φ(μ0+zασ/nμ1σ/n)=Φ(zα+μ0μ1σn)\text{Power} = \Phi\left(\frac{\mu_0 + z_{\alpha}\sigma/\sqrt{n} - \mu_1}{\sigma/\sqrt{n}}\right) = \Phi\left(z_{\alpha} + \frac{\mu_0 - \mu_1}{\sigma}\sqrt{n}\right)

IMPORTANT: The power of a test tells us how likely it is that a statistically significant difference will be detected based on a finite sample size nn. If the power is too low, then there is little chance of finding a significant difference and nonsignificant results are likely even if real differences exist between the true mean μ\mu of the group being studied and the null mean μ0\mu_0.

Example: Birthweight data Compute the power of the test for the birthweight data with an alternative mean of 115115 oz and α=.05\alpha = .05, assuming the true standard deviation is σ=24\sigma = 24 oz. We have μ0=120\mu_0 = 120 oz, μ1=115\mu_1 = 115 oz, α=.05\alpha = .05, σ=24\sigma = 24, and n=100n = 100. Thus,

Power=Φ[z.05+(120115)10024]=Φ[1.645+5(10)24]=Φ(0.438)=.669\begin{aligned} \text{Power} &= \Phi\left[z_{.05} + \frac{(120 - 115)\sqrt{100}}{24}\right] \\ &= \Phi\left[-1.645 + \frac{5(10)}{24}\right] \\ &= \Phi(0.438) \\ &= .669 \end{aligned}

Therefore, there is about a 67%67\% chance of detecting a significant difference using a 5%5\% significance level with this sample size.

One-Sided Alternatives: μ1\mathbf{\mu_1} greater than μ0\mathbf{\mu_0}

Suppose H0:μ=μ0H_0: \mu = \mu_0 vs. H1:μ=μ1H_1: \mu = \mu_1. (μ1>μ0\mu_1 > \mu_0) H0H_0 is rejected if z>z1αz > z_{1 - \alpha} and H0H_0 is accepted if zz1αz \leq z_{1-\alpha}.

Power=P(reject H0H1 True)=P(Z>z1αμ=μ1)=P(Xˉμ0σ/n>z1αμ=μ1)=P(Xˉ>μ0+z1ασnμ=μ1)=1P(Xˉ<μ0+z1ασnμ=μ1)=1Φ(μ0+z1ασ/nμ1σ/n)=1Φ(z1α+(μ0μ1)nσ)\begin{aligned} \text{Power} &= P(\text{reject } H_0 \mid H_1 \text{ True}) \\ &= P(Z > z_{1-\alpha} \mid \mu = \mu_1) \\ &= P\left(\frac{\bar{X} - \mu_0}{\sigma/\sqrt{n}} > z_{1-\alpha} \mid \mu = \mu_1\right) \\ &= P\left(\bar{X} > \mu_0 + z_{1-\alpha}\frac{\sigma}{\sqrt{n}} \mid \mu = \mu_1\right) \\ &= 1-P\left(\bar{X} < \mu_0 + z_{1-\alpha}\frac{\sigma}{\sqrt{n}} \mid \mu = \mu_1\right) \\ &= 1 - \Phi\left(\frac{\mu_0 + z_{1-\alpha}\sigma/\sqrt{n} - \mu_1}{\sigma/\sqrt{n}}\right) \\ &= 1 - \Phi\left(z_{1-\alpha} + \frac{(\mu_0 - \mu_1)\sqrt{n}}{\sigma}\right) \end{aligned}

Using the relationships Φ(x)=1Φ(x)\Phi(-x) = 1 - \Phi(x) and zα=z1αz_{\alpha} = -z_{1-\alpha}, the power expression can also be rewritten as

Φ[z1α+(μ1μ0)nσ]=Φ[zα+(μ1μ0)nσ],if μ1>μ0\Phi\left[-z_{1-\alpha} + \frac{(\mu_1 - \mu_0)\sqrt{n}}{\sigma}\right] = \Phi\left[z_{\alpha} + \frac{(\mu_1 - \mu_0)\sqrt{n}}{\sigma}\right], \quad \text{if } \mu_1 > \mu_0

Summery: Power for the one-sample zz test with known variance

For the hypothesis H0:μ=μ0H_0: \mu = \mu_0 vs. H1:μ=μ1H_1: \mu = \mu_1, where the underlying distribution is normal and the population variance σ2\sigma^2 is known, the power is

Power=Φ(zα+μ0μ1nσ)=Φ(z1α+μ0μ1nσ)\text{Power} = \Phi\left(z_{\alpha} + \frac{|\mu_0 - \mu_1|\sqrt{n}}{\sigma}\right) = \Phi\left(-z_{1-\alpha} + \frac{|\mu_0 - \mu_1|\sqrt{n}}{\sigma}\right)

The power depends on four factors: significance level α\alpha, effect size μ0μ1|\mu_0 - \mu_1|, sample size nn, and standard deviation σ\sigma.

Factors affecting the power

  1. If the significance level decreases (α\alpha decreases), then zαz_{\alpha} increases and the power decreases.
  2. If the alternative mean is farther from the null mean (μ0μ1|\mu_0 - \mu_1| increases), then the power increases.
  3. If the standard deviation increases (σ\sigma increases), then the power decreases.
  4. If the sample size increases (nn increases), then the power increases.

Power Curve

For given levels of α=.05\alpha = .05, σ=24\sigma = 24 oz, n=100n = 100, and μ0=120\mu_0 = 120 oz, a power curve can be drawn for the power of the test under various alternative means μ1\mu_1.

For the birthweight data in Example 7.2, the power ranges from 99% when μ=110\mu = 110 oz to about 20% when μ=118\mu = 118 oz.

Two-Sided Alternatives

Power for the one-sample zz test for the mean of a normal distribution

For the two-sided test

H0:μ=μ0vs.H1:μμ0H_0: \mu = \mu_0 \quad \text{vs.} \quad H_1: \mu \neq \mu_0

with a specific alternative μ=μ1\mu = \mu_1, where the underlying distribution is normal and the population variance σ2\sigma^2 is known, the exact power is

Power=Φ[z1α/2+(μ0μ1)nσ]+Φ[z1α/2+(μ1μ0)nσ]\text{Power} = \Phi\left[-z_{1-\alpha/2} + \frac{(\mu_0 - \mu_1)\sqrt{n}}{\sigma}\right] + \Phi\left[-z_{1-\alpha/2} + \frac{(\mu_1 - \mu_0)\sqrt{n}}{\sigma}\right]

This is approximately

PowerΦ[z1α/2+μ0μ1nσ]\text{Power} \approx \Phi\left[-z_{1-\alpha/2} + \frac{|\mu_0 - \mu_1|\sqrt{n}}{\sigma}\right]

Derivation To see this, for a two-sided zz test we reject H0H_0 if

z=Xˉμ0σ/n<zα/2orz=Xˉμ0σ/n>z1α/2z = \frac{\bar{X} - \mu_0}{\sigma/\sqrt{n}} < z_{\alpha/2} \quad \text{or} \quad z = \frac{\bar{X} - \mu_0}{\sigma/\sqrt{n}} > z_{1-\alpha/2}

Multiplying each inequality by σ/n\sigma/\sqrt{n} and adding μ0\mu_0, the rejection criteria can be written in terms of xˉ\bar{x} as

xˉ<μ0+zα/2σnorxˉ>μ0+z1α/2σn\bar{x} < \mu_0 + z_{\alpha/2}\frac{\sigma}{\sqrt{n}} \quad \text{or} \quad \bar{x} > \mu_0 + z_{1-\alpha/2}\frac{\sigma}{\sqrt{n}}

The power of the test against the specific alternative μ=μ1\mu = \mu_1 is

Power=P(Xˉ<μ0+zα/2σnμ=μ1)+P(Xˉ>μ0+z1α/2σnμ=μ1)=Φ(μ0+zα/2σ/nμ1σ/n)+1Φ(μ0+z1α/2σ/nμ1σ/n)=Φ[zα/2+(μ0μ1)nσ]+1Φ[z1α/2+(μ0μ1)nσ]\begin{aligned} \text{Power} &= P\left(\bar{X} < \mu_0 + z_{\alpha/2}\frac{\sigma}{\sqrt{n}} \mid \mu = \mu_1\right) + P\left(\bar{X} > \mu_0 + z_{1-\alpha/2}\frac{\sigma}{\sqrt{n}} \mid \mu = \mu_1\right) \\ &= \Phi\left(\frac{\mu_0 + z_{\alpha/2}\sigma/\sqrt{n} - \mu_1}{\sigma/\sqrt{n}}\right) + 1 - \Phi\left(\frac{\mu_0 + z_{1-\alpha/2}\sigma/\sqrt{n} - \mu_1}{\sigma/\sqrt{n}}\right) \\ &= \Phi\left[z_{\alpha/2} + \frac{(\mu_0 - \mu_1)\sqrt{n}}{\sigma}\right] + 1 - \Phi\left[z_{1-\alpha/2} + \frac{(\mu_0 - \mu_1)\sqrt{n}}{\sigma}\right] \end{aligned}

Using the relationship 1Φ(x)=Φ(x)1 - \Phi(x) = \Phi(-x), the last two terms can be combined as

Power=Φ[zα/2+(μ0μ1)nσ]+Φ[z1α/2+(μ1μ0)nσ]\text{Power} = \Phi\left[z_{\alpha/2} + \frac{(\mu_0 - \mu_1)\sqrt{n}}{\sigma}\right] + \Phi\left[-z_{1-\alpha/2} + \frac{(\mu_1 - \mu_0)\sqrt{n}}{\sigma}\right]

Finally, because zα/2=z1α/2z_{\alpha/2} = -z_{1-\alpha/2}, we have

Power=Φ[z1α/2+(μ0μ1)nσ]+Φ[z1α/2+(μ1μ0)nσ]\text{Power} = \Phi\left[-z_{1-\alpha/2} + \frac{(\mu_0 - \mu_1)\sqrt{n}}{\sigma}\right] + \Phi\left[-z_{1-\alpha/2} + \frac{(\mu_1 - \mu_0)\sqrt{n}}{\sigma}\right]

Note: The exact two-sided power formula is more tedious to use than is usually necessary. Specifically, if μ1<μ0\mu_1 < \mu_0, then the second term is usually negligible relative to the first term. However, if μ1>μ0\mu_1 > \mu_0, then the first term is usually negligible relative to the second term. Therefore, the approximate power formula is usually used for a two-sided test because it represents the dominant term in the exact formula.

Illustration of power for a two-sided test for the mean of a normal distribution with known variance

Sample-Size Determination

One-Sided Alternatives

The problem of determining sample size can be summarized as follows: Given that a one-sided significance test will be conducted at level α\alpha and that the true alternative mean is expected to be μ1\mu_1, what sample size is needed to be able to detect a significant difference with probability 1β1 - \beta? Typical values for the desired power are 80%, 90%, ..., and so forth.

For a one-sided test, we set the desired power equal to 1β1 - \beta:

Power=Φ(zα+μ0μ1nσ)=1β\text{Power} = \Phi\left(z_{\alpha} + \frac{|\mu_0 - \mu_1|\sqrt{n}}{\sigma}\right) = 1 - \beta

We want to solve for nn in terms of α\alpha, β\beta, μ0μ1|\mu_0 - \mu_1|, and σ\sigma. Since

Φ(z1β)=1β\Phi(z_{1-\beta}) = 1 - \beta

we have

zα+μ0μ1nσ=z1βz_{\alpha} + \frac{|\mu_0 - \mu_1|\sqrt{n}}{\sigma} = z_{1-\beta}

Subtract zαz_{\alpha} from both sides and multiply by σ/μ0μ1\sigma/|\mu_0 - \mu_1|:

n=(zα+z1β)σμ0μ1\sqrt{n} = \frac{(-z_{\alpha} + z_{1-\beta})\sigma}{|\mu_0 - \mu_1|}

Since zα=z1α-z_{\alpha} = z_{1-\alpha}, squaring both sides gives

n=(z1α+z1β)2σ2(μ0μ1)2n = \frac{(z_{1-\alpha} + z_{1-\beta})^2\sigma^2}{(\mu_0 - \mu_1)^2}

Factors affecting the sample size

  1. The sample size increases as σ2\sigma^2 increases.
  2. The sample size increases as the significance level is made smaller (α\alpha decreases).
  3. The sample size increases as the required power increases (1β1 - \beta increases).
  4. The sample size decreases as the absolute distance between the null and alternative means, μ0μ1|\mu_0 - \mu_1|, increases.

Note: Sample-size estimates are usually only ballpark estimates because μ1\mu_1 and σ2\sigma^2 are often unknown. These values may be estimated from previous studies, similar experiments, prior knowledge, or a small pilot study. In practice, sample-size calculations are often used to check whether the proposed sample size is reasonably close to what is needed, rather than to determine an exact number.

Two-Sided Alternatives

The one-sided sample-size formula is appropriate when the direction of the alternative mean is specified in advance. If it is not known whether the alternative mean μ1\mu_1 is greater than or less than the null mean μ0\mu_0, then a two-sided test is appropriate.

For testing

H0:μ=μ0vs.H1:μμ0H_0: \mu = \mu_0 \quad \text{vs.} \quad H_1: \mu \neq \mu_0

with significance level α\alpha and desired power 1β1 - \beta, the sample size needed is

n=σ2(z1β+z1α/2)2(μ0μ1)2n = \frac{\sigma^2\left(z_{1-\beta} + z_{1-\alpha/2}\right)^2}{(\mu_0 - \mu_1)^2}

To see this, use the approximate power formula for a two-sided test and solve for nn:

Φ(z1α/2+μ0μ1nσ)=1β\Phi\left(-z_{1-\alpha/2} + \frac{|\mu_0 - \mu_1|\sqrt{n}}{\sigma}\right) = 1 - \beta

Since Φ(z1β)=1β\Phi(z_{1-\beta}) = 1 - \beta, we have

z1α/2+μ0μ1nσ=z1β-z_{1-\alpha/2} + \frac{|\mu_0 - \mu_1|\sqrt{n}}{\sigma} = z_{1-\beta}

Add z1α/2z_{1-\alpha/2} to both sides and multiply by σ/μ0μ1\sigma/|\mu_0 - \mu_1|:

n=(z1β+z1α/2)σμ0μ1\sqrt{n} = \frac{\left(z_{1-\beta} + z_{1-\alpha/2}\right)\sigma}{|\mu_0 - \mu_1|}

Squaring both sides gives

n=(z1β+z1α/2)2σ2(μ0μ1)2n = \frac{\left(z_{1-\beta} + z_{1-\alpha/2}\right)^2\sigma^2}{(\mu_0 - \mu_1)^2}

This required sample size is always larger than the corresponding sample size for a one-sided test, because z1α/2>z1αz_{1-\alpha/2} > z_{1-\alpha}.

Based on CI Width

Sometimes the treatment effect is already believed to exist, so the main goal is not hypothesis testing but estimating the effect with a desired degree of precision. In this case, sample size can be chosen based on the desired width of a confidence interval.

Example: Cardiology Suppose propranolol is known to lower heart rate over 48 hours in patients with angina at standard dosage levels. A new study uses a higher dose, and investigators want to estimate the drop in heart rate with high precision.

If precision is measured by the width of a two-sided 100(1α)%100(1-\alpha)\% confidence interval, then the CI for the true mean decline μ\mu is

xˉ±tn1,1α/2sn\bar{x} \pm t_{n-1,1-\alpha/2}\frac{s}{\sqrt{n}}

The width of this interval is

2tn1,1α/2sn2t_{n-1,1-\alpha/2}\frac{s}{\sqrt{n}}

If we want the CI width to be no wider than LL, then

2tn1,1α/2sn=L2t_{n-1,1-\alpha/2}\frac{s}{\sqrt{n}} = L

so

n=4tn1,1α/22s2L2n = \frac{4t_{n-1,1-\alpha/2}^2s^2}{L^2}

Because tn1,1α/2t_{n-1,1-\alpha/2} is often approximated by z1α/2z_{1-\alpha/2}, the required sample size is approximately

n=4z1α/22s2L2n = \frac{4z_{1-\alpha/2}^2s^2}{L^2}

Example: Cardiology

Find the minimum sample size needed to estimate the change in heart rate μ\mu if the two-sided 95%95\% CI for μ\mu must be no wider than 55 beats per minute and the sample standard deviation for change in heart rate is s=10s = 10 beats per minute.

We have α=.05\alpha = .05, s=10s = 10, and L=5L = 5. Therefore,

n=4z.9752(10)2(5)2=4(1.96)2(100)25=61.5\begin{aligned} n &= \frac{4z_{.975}^2(10)^2}{(5)^2} \\ &= \frac{4(1.96)^2(100)}{25} \\ &= 61.5 \end{aligned}

Thus, at least 62 patients need to be studied.

The Relationship Between Hypothesis Testing and Confidence Intervals

Two-Sided Case

Suppose we are testing

H0:μ=μ0vs.H1:μμ0H_0: \mu = \mu_0 \quad \text{vs.} \quad H_1: \mu \neq \mu_0

For a two-sided level α\alpha test:

  • H0H_0 is rejected if and only if the two-sided 100(1α)%100(1-\alpha)\% confidence interval for μ\mu does not contain μ0\mu_0.
  • H0H_0 is accepted if and only if the two-sided 100(1α)%100(1-\alpha)\% confidence interval for μ\mu does contain μ0\mu_0.

Note: The hypothesis-testing approach and the confidence-interval approach often lead to the same conclusion, but they emphasize different information. A p-value tells us how statistically significant the result is, while a confidence interval shows the likely range of the parameter and helps judge the practical size of the effect. Therefore, it is good practice to report both the p-value and the confidence interval whenever possible.

Example: Cardiovascular Disease For the cholesterol data, the p-value of .037.037 tells us how statistically significant the result is. The 95%95\% confidence interval for μ\mu, (173.58,189.46)(173.58, 189.46), gives a range of likely values that μ\mu might assume. These two types of information are complementary.