> For the complete documentation index, see [llms.txt](https://kmis.gitbook.io/statistics/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kmis.gitbook.io/statistics/chapter-8.-testing-hypotheses/8-2.-large-sample-tests-for-a-population-mean.md).

# 8-2. Large Sample Tests for a Population Mean

In this section we describe and demonstrate the procedure for conducting a test of hypotheses about the mean of a population in the case that the sample size *n* is at least 30. The Central Limit Theorem states that $$\bar{X}$$ is approximately normally distributed, and has mean $$μ\_\bar{X}=μ$$ and standard deviation $$σ\_\bar{X}=σ/\sqrt{n}$$ , where $$μ$$ and $$σ$$ are the mean and the standard deviation of the population. This implies that the statistic&#x20;

![](https://2234305379-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lqmt1Wp54aKlZ5eVcaS%2F-LrSdCyagrSpEy4mZOnJ%2F-LrSdEYlmYnwmyPjwZDF%2Fimage.png?alt=media\&token=286721db-da96-431e-a589-ea4aad3250ea)

has the standard normal distribution, which means that probabilities related to it are given in [Figure 12.2 "Cumulative Normal Probability"](https://saylordotorg.github.io/text_introductory-statistics/s16-appendix.html) and the last line in [Figure 12.3 "Critical Values of "](https://saylordotorg.github.io/text_introductory-statistics/s16-appendix.html).

If we know $$σ$$ then the statistic in the display is our test statistic. If, as is typically the case, we do not know $$σ$$, then we replace it by the sample standard deviation $$s$$. Since the sample is large the resulting test statistic still has a distribution that is approximately standard normal.

> **Standardized Test Statistics for Large Sample Hypothesis Tests** Concerning a Single Population Mean&#x20;
>
>  If $$σ$$ is known:  $$z\_o=\frac {\bar{x}−μ\_0}{σ/\sqrt{n} }$$&#x20;
>
> If $$σ$$ is unknown: $$t\_o=\frac {\bar{x}−μ\_0}{s/\sqrt{n} }$$
>
> The test statistic has the standard normal distribution.

The distribution of the standardized test statistic and the corresponding rejection region for each form of the alternative hypothesis (left-tailed, right-tailed, or two-tailed), is shown in [Figure 8.4 "Distribution of the Standardized Test Statistic and the Rejection Region"](https://saylordotorg.github.io/text_introductory-statistics/s12-02-large-sample-tests-for-a-popul.html).

Figure 8.4&#x20;

![Distribution of the Standardized Test Statistic and the Rejection Region](https://saylordotorg.github.io/text_introductory-statistics/section_12/526c9e81a596b999ae191031b1b8bc47.jpg)

**EXAMPLE 4.** It is hoped that a newly developed pain reliever will more quickly produce perceptible reduction in pain to patients after minor surgeries than a standard pain reliever. The standard pain reliever is known to bring relief in an average of 3.5 minutes with standard deviation 2.1 minutes. To test whether the new pain reliever works more quickly than the standard one, 50 patients with minor surgeries were given the new pain reliever and their times to relief were recorded. The experiment yielded sample mean $$\bar{x} = 3.1$$ minutes and sample standard deviation $$s = 1.5$$ minutes. Is there sufficient evidence in the sample to indicate, at the 5% level of significance, that the newly developed pain reliever does deliver perceptible relief more quickly?

**\[ Solution ]**

* **Step 1.**  $$H\_0:μ=3.5$$  vs. $$Ha:μ=<3.5 , \space α=0.05$$&#x20;
* **Step 2.**  the test statistic is\
  &#x20;                                                 $$z\_o=\frac {\bar{x} - μ\_0}{s/\sqrt{n}}$$&#x20;

  and has the standard normal distribution.
* **Step 3.** Compute the test statistic\
  &#x20;                                  $$z\_o=\frac{\bar{x}−μ\_0}{s/\sqrt{n}} = \frac {(3.1−3.5)} { 1.5/ \sqrt{50}}=−1.886$$&#x20;
* **Step 4.** Since the symbol in $$H\_a$$ is “ $$<$$ ” this is a **left-tailed test**, \
  so there is **a single critical value**,  $$−z\_α=−z\_{0.05} = −1.645$$ \
  rejection region : $$(−∞,−1.645].$$&#x20;
* **Step 5.** the test statistic **falls in the rejection region**. The decision is **to reject** $$H\_0$$ .
* **Conclusion:** \
  *The data provide sufficient evidence, at the 5% level of significance, to conclude that the average time until patients experience perceptible relief from pain using the new pain reliever is smaller than the average time for the standard pain reliever.*

Figure 8.5 Rejection Region and Test Statistic for [Note 8.27 "Example 4"](https://saylordotorg.github.io/text_introductory-statistics/s12-02-large-sample-tests-for-a-popul.html#fwk-shafer-ch08_s02_n03)

![](https://saylordotorg.github.io/text_introductory-statistics/section_12/c18d107b4145b363951540fc519137b2.jpg)

{% tabs %}
{% tab title="R Source" %}

```
n <- 50
x <- 3.1
mu <- 3.5
sd <- 1.5
alpha <- 0.05

# in case of left-tail test
se <- sd / sqrt(n)

z_c <- qnorm(1-alpha); z_c
z_o <- (x-mu)/se; z_o

if (z_o <= - z_c) cat("Reject Ho.\n") else 
                cat ("Can not reject Ho.\n")
```

{% endtab %}

{% tab title="Result" %}

```
> z_c <- qnorm(1-alpha); z_c
## [1] 1.644854
> z_o <- (x-mu)/se; z_o
## [1] -1.885618
> 
> if (z_o <= - z_c) cat("Reject Ho.\n") else 
+                   cat ("Can not reject Ho.\n")
## Reject Ho.
```

{% endtab %}
{% endtabs %}

* Using **Rstat** Package : `meantest1.plot()`

{% tabs %}
{% tab title="R Source" %}

```
library(Rstat)

meantest1.plot(xb=3.1, mu0=3.5, sig=1.5, n=50, side="low")
```

{% endtab %}

{% tab title="Result" %}

```
> meantest1.plot(xb=3.1, mu0=3.5, sig=1.5, n=50, side="low")
## Z0 = (3.1 - 3.5) / (1.5/√50) = -1.8856 
## P-v = P(Z < Z0) = 0.0297 
```

{% endtab %}

{% tab title="Plot" %}
![](https://2234305379-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lqmt1Wp54aKlZ5eVcaS%2F-LxsheY_2Yy5YsrU95GR%2F-LxsibbySmIAHsIwY2Wt%2Fimage.png?alt=media\&token=4c6809ec-5b74-45ab-bb70-2fc49b947f47)

**\[Decision Rule]**

* p-value=0.0297 => if p-value is less than alpha, **reject Ho.** Otherwise, Can not reject Ho.
  {% endtab %}
  {% endtabs %}

**EXAMPLE 5.** A cosmetics company fills its best-selling 8-ounce jars of facial cream by an automatic dispensing machine. The machine is set to dispense a mean of 8.1 ounces per jar. Uncontrollable factors in the process can shift the mean away from 8.1 and cause either underfill or overfill, both of which are undesirable. In such a case the dispensing machine is stopped and recalibrated. Regardless of the mean amount dispensed, the standard deviation of the amount dispensed always has value 0.22 ounce. A quality control engineer routinely selects 30 jars from the assembly line to check the amounts filled. On one occasion, the sample mean is $$\bar{x} = 8.2$$ ounces and the sample standard deviation is $$s = 0.25$$ ounce. Determine if there is sufficient evidence in the sample to indicate, at the 1% level of significance, that the machine should be recalibrated.

**\[ Solution ]**

* **Step 1**. the **hypothesis** test is\
  &#x20;             $$H\_0:μ=8.1 vs.   H\_a:μ≠8.1, @ α=0.01$$
* **Step 2**. **The sample is large and the population standard deviation is known.** Thus the **test statistic** \
  &#x20;             $$z\_o=\frac {\bar{x}−μ\_0}{σ/\sqrt{n} }$$

  &#x20;             and has the standard normal distribution.
* **Step 3.** Inserting the data into the formula for the test statistic gives\
  &#x20;             $$z\_o=\frac {\bar{x}−μ\_0}{σ/\sqrt{n} } = \frac {(8.2 -8.0)}{  0.22 / \sqrt{30}  } = 2.490$$
* **Step 4**. Since the symbol in $$H\_a$$ is “ $$≠$$ ” this is a two-tailed test, so there are two critical values, $$±z\_{α∕2}=±z\_{0.005} = 2.576$$ .\
  &#x20;The rejection region is  $$(−∞,−2.576]∪\[2.576,∞).$$ .
* **Step 5.** **the test statistic does not fall in the rejection region.** The decision is **not to reject** $$H\_0$$.
* **conclusion is**:

  *The data do not provide sufficient evidence, at the 1% level of significance, to conclude that the average amount of product dispensed is different from 8.1 ounce. We conclude that the machine does not need to be recalibrated.*

Figure 8.6

![Rejection Region and Test Statistic for Note 8.28 "Example 5"](https://saylordotorg.github.io/text_introductory-statistics/section_12/98f4ee32ab4fe3e9766adeca42e127e9.jpg)

{% tabs %}
{% tab title="First Tab" %}

```
n <- 30
x <- 8.2
mu <- 8.1
sd <- 0.22
alpha <- 0.01

# in case of two test
se <- sd / sqrt(n)

z_c <- qnorm(1-alpha/2); z_c
z_o <- (x-mu)/se; z_o


if (z_o <= -z_c || z_o >= z_c ) cat("Reject Ho.\n") else 
                cat ("Can not reject Ho.\n")
```

{% endtab %}

{% tab title="Second Tab" %}

```
> z_c <- qnorm(1-alpha/2); z_c
## [1] 2.575829
> z_o <- (x-mu)/se; z_o
## [1] 2.489648
> 
> 
> if (z_o <= -z_c || z_o >= z_c ) cat("Reject Ho.\n") else 
+                 cat ("Can not reject Ho.\n")
## Can not reject Ho.
```

{% endtab %}
{% endtabs %}

* Using **Rstat** Package : `meantest1.plot()`

{% tabs %}
{% tab title="R Source" %}

```
library(Rstat)

meantest1.plot(xb=8.2, mu0=8.1, sig=0.22, n=30, side="two")
```

{% endtab %}

{% tab title="Result" %}

```
> meantest1.plot(xb=8.2, mu0=8.1, sig=0.22, n=30, side="two")
## Z0 = (8.2 - 8.1) / (0.22/√30) = 2.4896 
## P-v = 2×P(Z > |Z0|) = 0.0128
```

{% endtab %}

{% tab title="Plot" %}
![](https://2234305379-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lqmt1Wp54aKlZ5eVcaS%2F-LxsheY_2Yy5YsrU95GR%2F-LxslH23Mrmf6gINu7nn%2Fimage.png?alt=media\&token=50b5d521-2b08-4a1b-9631-faeeebf14515)

**\[Decision Rule]**

* p-value=0.0128 => if p-value is less than alpha(=0.01), reject Ho. Otherwise, **Can not reject Ho**.
  {% endtab %}
  {% endtabs %}
