Hypothesis Testing for a Single Normal Population

Testing the Mean of a Single Normal Population

When the Variance Is Known (Z Test)

Population: X∼N(μ,σ2)X \sim N(\mu, \sigma^2), with σ2\sigma^2 known

Hypotheses:

  • H0:μ=μ0H_0: \mu = \mu_0
  • H1:μ≠μ0H_1: \mu \neq \mu_0 (two-sided test)
  • H1:μ>μ0H_1: \mu > \mu_0 (right one-sided test)
  • H1:μ<μ0H_1: \mu < \mu_0 (left one-sided test)

Test statistic: Z=X‾−μ0σ/n∼N(0,1)Z = \frac{\overline{X} - \mu_0}{\sigma/\sqrt{n}} \sim N(0,1)

Rejection region:

  • Two-sided test: ∣Z∣>zα/2|Z| > z_{\alpha/2}
  • Right one-sided test: Z>zαZ > z_{\alpha}
  • Left one-sided test: Z<−zαZ < -z_{\alpha}

Example 1: the lengths of the parts produced by a factory follow the normal distribution N(μ,0.04)N(\mu, 0.04). 16 parts are drawn at random from the products, and the measured average length is 10.2cm. At the significance level α=0.05\alpha = 0.05, test whether the part length equals 10cm.

Solution:

  1. State the hypotheses: H0:μ=10H_0: \mu = 10, H1:μ≠10H_1: \mu \neq 10
  2. Test statistic: Z=X‾−100.04/16=10.2−100.2/4=4Z = \frac{\overline{X} - 10}{\sqrt{0.04}/\sqrt{16}} = \frac{10.2 - 10}{0.2/4} = 4
  3. Rejection region: ∣Z∣>1.96|Z| > 1.96
  4. Decision: ∣Z∣=4>1.96|Z| = 4 > 1.96, so reject the null hypothesis
  5. Conclusion: the part length is not equal to 10cm

When the Variance Is Unknown (T Test)

Population: X∼N(μ,σ2)X \sim N(\mu, \sigma^2), with σ2\sigma^2 unknown

Hypotheses:

  • H0:μ=μ0H_0: \mu = \mu_0
  • H1:μ≠μ0H_1: \mu \neq \mu_0 (two-sided test)
  • H1:μ>μ0H_1: \mu > \mu_0 (right one-sided test)
  • H1:μ<μ0H_1: \mu < \mu_0 (left one-sided test)

Test statistic: T=X‾−μ0S/n∼t(n−1)T = \frac{\overline{X} - \mu_0}{S/\sqrt{n}} \sim t(n-1)

Rejection region:

  • Two-sided test: ∣T∣>tα/2(n−1)|T| > t_{\alpha/2}(n-1)
  • Right one-sided test: T>tα(n−1)T > t_{\alpha}(n-1)
  • Left one-sided test: T<−tα(n−1)T < -t_{\alpha}(n-1)

Example 2: the service life of a brand of batteries follows a normal distribution. 10 batteries of this brand are drawn at random, and the measured average service life is 120 hours with a sample standard deviation of 8 hours. At the significance level α=0.05\alpha = 0.05, test whether the average service life of the batteries is greater than 115 hours.

Solution:

  1. State the hypotheses: H0:μ≤115H_0: \mu \leq 115, H1:μ>115H_1: \mu > 115
  2. Test statistic: T=120−1158/10=52.53=1.98T = \frac{120 - 115}{8/\sqrt{10}} = \frac{5}{2.53} = 1.98
  3. Rejection region: T>t0.05(9)=1.833T > t_{0.05}(9) = 1.833
  4. Decision: T=1.98>1.833T = 1.98 > 1.833, so reject the null hypothesis
  5. Conclusion: the average service life of the batteries is greater than 115 hours

Testing the Variance of a Single Normal Population (Chi-Square Test)

When the Mean Is Known

Population: X∼N(μ,σ2)X \sim N(\mu, \sigma^2), with μ\mu known

Hypotheses:

  • H0:σ2=σ02H_0: \sigma^2 = \sigma_0^2
  • H1:σ2≠σ02H_1: \sigma^2 \neq \sigma_0^2 (two-sided test)
  • H1:σ2>σ02H_1: \sigma^2 > \sigma_0^2 (right one-sided test)
  • H1:σ2<σ02H_1: \sigma^2 < \sigma_0^2 (left one-sided test)

Test statistic: χ2=∑i=1n(Xi−μ)2σ02∼χ2(n)\chi^2 = \frac{\sum_{i=1}^n (X_i - \mu)^2}{\sigma_0^2} \sim \chi^2(n)

Rejection region:

  • Two-sided test: χ2<χ1−α/22(n)\chi^2 < \chi^2_{1-\alpha/2}(n) or χ2>χα/22(n)\chi^2 > \chi^2_{\alpha/2}(n)
  • Right one-sided test: χ2>χα2(n)\chi^2 > \chi^2_{\alpha}(n)
  • Left one-sided test: χ2<χ1−α2(n)\chi^2 < \chi^2_{1-\alpha}(n)

When the Mean Is Unknown

Population: X∼N(μ,σ2)X \sim N(\mu, \sigma^2), with μ\mu unknown

Hypotheses:

  • H0:σ2=σ02H_0: \sigma^2 = \sigma_0^2
  • H1:σ2≠σ02H_1: \sigma^2 \neq \sigma_0^2 (two-sided test)
  • H1:σ2>σ02H_1: \sigma^2 > \sigma_0^2 (right one-sided test)
  • H1:σ2<σ02H_1: \sigma^2 < \sigma_0^2 (left one-sided test)

Test statistic: χ2=(n−1)S2σ02∼χ2(n−1)\chi^2 = \frac{(n-1)S^2}{\sigma_0^2} \sim \chi^2(n-1)

Rejection region:

  • Two-sided test: χ2<χ1−α/22(n−1)\chi^2 < \chi^2_{1-\alpha/2}(n-1) or χ2>χα/22(n−1)\chi^2 > \chi^2_{\alpha/2}(n-1)
  • Right one-sided test: χ2>χα2(n−1)\chi^2 > \chi^2_{\alpha}(n-1)
  • Left one-sided test: χ2<χ1−α2(n−1)\chi^2 < \chi^2_{1-\alpha}(n-1)

Example 3: the lengths of the parts produced by a factory follow a normal distribution. 10 parts are drawn at random from the products, and the measured sample variance is 0.04. At the significance level α=0.05\alpha = 0.05, test whether the variance of the part lengths equals 0.03.

Solution:

  1. State the hypotheses: H0:σ2=0.03H_0: \sigma^2 = 0.03, H1:σ2≠0.03H_1: \sigma^2 \neq 0.03
  2. Test statistic: χ2=(10−1)×0.040.03=9×0.040.03=12\chi^2 = \frac{(10-1) \times 0.04}{0.03} = \frac{9 \times 0.04}{0.03} = 12
  3. Rejection region: χ2<χ0.9752(9)=2.7\chi^2 < \chi^2_{0.975}(9) = 2.7 or χ2>χ0.0252(9)=19.0\chi^2 > \chi^2_{0.025}(9) = 19.0
  4. Decision: 2.7<χ2=12<19.02.7 < \chi^2 = 12 < 19.0, so the null hypothesis is not rejected
  5. Conclusion: the variance of the part lengths equals 0.03

Comparison of Testing Methods

Comparison of the Z Test and the T Test

Z test:

  • Applicable condition: the variance is known
  • Test statistic: Z∼N(0,1)Z \sim N(0,1)
  • Advantages: simple to compute, no need to consult the t distribution table
  • Disadvantages: requires knowing the population variance

T test:

  • Applicable condition: the variance is unknown
  • Test statistic: T∼t(n−1)T \sim t(n-1)
  • Advantages: does not require knowing the population variance
  • Disadvantages: requires consulting the t distribution table

Comparison of Mean Testing and Variance Testing

Mean testing:

  • Object of the test: the population mean
  • Application scenarios: testing product quality, treatment effects, and so on
  • Test statistic: the Z statistic or the T statistic

Variance testing:

  • Object of the test: the population variance
  • Application scenarios: testing production stability, measurement precision, and so on
  • Test statistic: the chi-square statistic

Power Analysis of Tests

Power Function

Power Function

The power function 1−β1 - \beta gives the probability of rejecting the null hypothesis when the null hypothesis is false.

Factors that influence it:

  1. Sample size: the larger the sample size, the higher the power
  2. Significance level: the higher the significance level, the higher the power
  3. Effect size: the larger the effect size, the higher the power

Determining the Sample Size

Problem: given the significance level, the power, and the effect size, determine the sample size required.

Example 4: for testing the mean of a normal population, given the significance level α=0.05\alpha = 0.05, the power 1−β=0.81 - \beta = 0.8, and the effect size d=0.5d = 0.5, find the sample size nn.

Solution:

  1. Use the power analysis formula
  2. Consult the table or use software to compute
  3. We obtain n≈26n \approx 26

Assumptions of the Tests

The Normality Assumption

Importance: the normality assumption is the basis of the Z test and the T test.

Testing methods:

  1. Graphical methods: Q-Q plots, histograms
  2. Statistical tests: the Shapiro-Wilk test, the Kolmogorov-Smirnov test

Handling non-normal data:

  1. Data transformation: logarithmic transformation, square root transformation, and so on
  2. Nonparametric tests: the Wilcoxon signed-rank test, and so on

The Independence Assumption

Importance: the sample observations should be mutually independent.

Testing methods:

  1. Time series analysis: the autocorrelation function
  2. Spatial data analysis: spatial autocorrelation

Cautions for Testing

The Multiple Comparison Problem

Problem: when performing several hypothesis tests, the probability of committing a Type I error increases.

Solution:

  1. Bonferroni correction: divide the significance level by the number of tests
  2. Holm correction: adjust the significance level step by step
  3. FDR control: control the false discovery rate

Effect Size

Effect Size

The effect size is an indicator that measures the magnitude of an actual difference.

Common effect sizes:

  1. Cohen’s d: d=μ1−μ2σd = \frac{\mu_1 - \mu_2}{\sigma}
  2. Correlation coefficient: r=tt2+dfr = \frac{t}{\sqrt{t^2 + df}}

Significance: even if the result is statistically significant, a small effect size may mean little practical significance.

Exercises

Exercise 1

Let X∼N(μ,σ2)X \sim N(\mu, \sigma^2) with σ\sigma known. To test H0:μ=μ0H_0: \mu=\mu_0, write the test statistic.

hypothesis testingZ testmean of a normal population

Approach: Use the test statistic of the normal distribution.

Steps:

  1. Test statistic: Z=X‾−μ0σ/nZ = \frac{\overline{X} - \mu_0}{\sigma/\sqrt{n}}
  2. Under the condition that the null hypothesis holds, Z∼N(0,1)Z \sim N(0,1)

Answer: Z=X‾−μ0σ/nZ = \frac{\overline{X} - \mu_0}{\sigma/\sqrt{n}}

Exercise 2

Let X∼N(μ,σ2)X \sim N(\mu, \sigma^2) with σ\sigma unknown. To test H0:μ=μ0H_0: \mu=\mu_0, write the test statistic.

hypothesis testingt testmean of a normal population

Approach: Use the test statistic of the t distribution.

Steps:

  1. Test statistic: T=X‾−μ0S/nT = \frac{\overline{X} - \mu_0}{S/\sqrt{n}}
  2. Under the condition that the null hypothesis holds, T∼t(n−1)T \sim t(n-1)

Answer: T=X‾−μ0S/nT = \frac{\overline{X} - \mu_0}{S/\sqrt{n}}

Exercise 3

Let X∼N(μ,σ2)X \sim N(\mu, \sigma^2) with μ\mu unknown. To test H0:σ2=σ02H_0: \sigma^2=\sigma_0^2, write the test statistic.

hypothesis testingchi-square testvariance of a normal population

Approach: Use the test statistic of the chi-square distribution.

Steps:

  1. Test statistic: χ2=(n−1)S2σ02\chi^2 = \frac{(n-1)S^2}{\sigma_0^2}
  2. Under the condition that the null hypothesis holds, χ2∼χ2(n−1)\chi^2 \sim \chi^2(n-1)

Answer: χ2=(n−1)S2σ02\chi^2 = \frac{(n-1)S^2}{\sigma_0^2}

Exercise 4

Let the sample mean be x‾=52\overline{x} = 52, the population standard deviation be σ=10\sigma = 10, and the sample size be n=25n = 25. Test H0:μ=50H_0: \mu = 50, H1:μ≠50H_1: \mu \neq 50 at the significance level α=0.05\alpha = 0.05.

hypothesis testingZ testtwo-sided test

Approach: Use the Z test for a two-sided test.

Steps:

  1. Test statistic: Z=52−5010/25=1Z = \frac{52 - 50}{10/\sqrt{25}} = 1
  2. Rejection region: ∣Z∣>1.96|Z| > 1.96
  3. Decision: ∣Z∣=1<1.96|Z| = 1 < 1.96, so the null hypothesis is not rejected
  4. Conclusion: the population mean equals 50

Answer: the null hypothesis is not rejected

Exercise 5

Let the sample mean be x‾=120\overline{x} = 120, the sample standard deviation be s=8s = 8, and the sample size be n=10n = 10. Test H0:μ≤115H_0: \mu \leq 115, H1:μ>115H_1: \mu > 115 at the significance level α=0.05\alpha = 0.05.

hypothesis testingt testone-sided test

Approach: Use the T test for a right one-sided test.

Steps:

  1. Test statistic: T=120−1158/10=1.98T = \frac{120 - 115}{8/\sqrt{10}} = 1.98
  2. Rejection region: T>t0.05(9)=1.833T > t_{0.05}(9) = 1.833
  3. Decision: T=1.98>1.833T = 1.98 > 1.833, so reject the null hypothesis
  4. Conclusion: the population mean is greater than 115

Answer: reject the null hypothesis

Found an issue with this content?

Tell us what could be improved.