Contents

- 1 Sample size to test hypothesis about mean
- 2 Sample size required to test hypothesis about mean
- 3 Sample size Calculator to test mean
- 4 How to use calculator to determine sample size to test mean?
- 5 Sample size to test mean Example 1
- 6 Sample size to test mean Example 2
- 7 Sample size to test mean Example 3
- 8 Endnote

## Sample size to test hypothesis about mean

In inferential statistics, knowing how many samples to take from the population is extremely important.

In this tutorial we will explore how to determine minimum sample size needed to estimate population mean with a given amount of error and desired confidence level.

## Sample size required to test hypothesis about mean

The effect size $ES$ is defined as

` $$ ES=\frac{|\mu_1-\mu_0|}{\sigma} $$ `

where $\mu_0$ is the mean under $H_0$ and $\mu_1$ is the mean under $H_1$, $\sigma$ is the standard deviation.

### For two-tailed alternative hypothesis

The formula for determining the sample size required to ensure that the test has a specified power with two-tailed alternative hypothesis is

` $$ n =\bigg(\frac{Z_{1-\alpha/2}+Z_{1-\beta}}{ES}\bigg)^2 $$ `

### For one-tailed alternative hypothesis

The formula for determining the sample size required to ensure that the test has a specified power with two-tailed alternative hypothesis is

` $$ n =\bigg(\frac{Z_{1-\alpha}+Z_{1-\beta}}{ES}\bigg)^2 $$ `

where $\alpha$ is the selected level of significance, $1-\beta$ is the selected power and $ES$ is the effect size.

## Sample size Calculator to test mean

Use this calculator to find the minimum sample size required to test mean $\mu$.

Sample Size to test mean | ||
---|---|---|

Confidence Level ($1-\alpha$) | ||

Power ($1-\beta$) | ||

Mean under H0 : ($\mu_0$) | ||

Mean under H1 : ($\mu_1$) | ||

Standard Deviation ($\sigma$) | ||

Results |
||

Effect Size ($ES$) | ||

Z value: $Z_{1-\alpha/2}$ | ||

Z value: $Z_{1-\beta}$ | ||

Required Sample Size : ($n$) | ||

## How to use calculator to determine sample size to test mean?

Step 1 - Select the confidence level $(1-\alpha)$

Step 2 - Select the power $(1-\beta)$

Step 3 - Enter the mean under null hypothesis $\mu_0$

Step 4 - Enter the mean under alternative hypothesis $\mu_1$

Step 5 - Enter the standard deviation $(\sigma)$

Step 6 - Click on "Calculate" button to get the Effect size, $Z$-values and the required sample size

## Sample size to test mean Example 1

A researcher wishes to test the hypothesis $H_0:\mu=94$ against $H_a:\mu=97$ at $0.05$ level of significance. The population standard deviation is $\sigma= 4.8$. How large a sample size will be to achieve the power of 80%?

#### Solution

Given that $\mu_0=94$, $\mu_1=97$. The population standard deviation is $\sigma =4.8$. The level of significance is $\alpha =0.05$, and power of the test is $=1-\beta = 0.8$.

The $ES$ is given by

` $$ \begin{aligned} ES &= \frac{|\mu_1-\mu_0|}{\sigma}\\ &= \frac{|97-94|}{4.8}\\ &= 0.625. \end{aligned} $$ `

The critical value of $Z$ is `$Z_{1-\alpha/2}=Z_{0.975}=1.96$`

.

The formula for determining the sample size required to ensure that the test has a power $1-\beta= 0.8$ is

` $$ \begin{aligned} n &= \bigg(\frac{Z_{1-\alpha/2}+Z_{1-\beta}}{ES}\bigg)^2\\ &= \bigg(\frac{Z_{1-0.05/2}+Z_{1-0.2}}{0.625}\bigg)^2\\ &= \bigg(\frac{Z_{0.975}+Z_{0.8}}{0.625}\bigg)^2\\ &= \bigg(\frac{1.96+0.8416}{0.625}\bigg)^2\\ &=20.0933\\ &\approx 21 \end{aligned} $$ `

Thus the sample of size $n=21$ will ensure that a two tailed test with $\alpha = 0.05$ has $80$ % power to detect the difference of $3$ in the means.

## Sample size to test mean Example 2

Find a sample size large enough to have a power of 0.80 when differentiating between a mean of 110 and mean of 112 with $\alpha=0.05$, one tail, and a population standard deviation of 15.

#### Solution

Given that $\mu_0=110$, $\mu_1=112$. The population standard deviation is $\sigma =15$. The level of significance is $\alpha =0.05$, and power of the test is $=1-\beta = 0.8$.

The $ES$ is given by

` $$ \begin{aligned} ES &= \frac{|\mu_1-\mu_0|}{\sigma}\\ &= \frac{|112-110|}{15}\\ &= 0.1333. \end{aligned} $$ `

The critical value of $Z$ is `$Z_{1-\alpha/2}=Z_{0.975}=1.96$`

.

The formula for determining the sample size required to ensure that the test has a power $1-\beta= 0.8$ is

` $$ \begin{aligned} n &= \bigg(\frac{Z_{1-\alpha/2}+Z_{1-\beta}}{ES}\bigg)^2\\ &= \bigg(\frac{Z_{1-0.05/2}+Z_{1-0.2}}{0.1333}\bigg)^2\\ &= \bigg(\frac{Z_{0.975}+Z_{0.8}}{0.1333}\bigg)^2\\ &= \bigg(\frac{1.96+0.8416}{0.1333}\bigg)^2\\ &=441.725\\ &\approx 442 \end{aligned} $$ `

Thus the sample of size $n=442$ will ensure that a two tailed test with $\alpha = 0.05$ has $80$ % power to detect the difference of $2$ in the means.

## Sample size to test mean Example 3

Find a sample size large enough to have a power of 0.80 when differentiating between a mean of 110 and mean of 112 with $\alpha=0.01$, two tailed test, and a population standard deviation of 15.

#### Solution

Given that $\mu_0=110$, $\mu_1=112$. The population standard deviation is $\sigma =15$. The level of significance is $\alpha =0.01$, and power of the test is $=1-\beta = 0.8$.

The $ES$ is given by

` $$ \begin{aligned} ES &= \frac{|\mu_1-\mu_0|}{\sigma}\\ &= \frac{|112-110|}{15}\\ &= 0.1333. \end{aligned} $$ `

The critical value of $Z$ is `$Z_{1-\alpha}=Z_{0.99}=2.3263$`

.

The formula for determining the sample size required to ensure that the test has a power $1-\beta= 0.8$ is

` $$ \begin{aligned} n &= \bigg(\frac{Z_{1-\alpha}+Z_{1-\beta}}{ES}\bigg)^2\\ &= \bigg(\frac{Z_{1-0.01}+Z_{1-0.2}}{0.1333}\bigg)^2\\ &= \bigg(\frac{Z_{0.99}+Z_{0.8}}{0.1333}\bigg)^2\\ &= \bigg(\frac{2.3263+0.8416}{0.1333}\bigg)^2\\ &=564.7843\\ &\approx 565 \end{aligned} $$ `

Thus the sample of size $n=565$ will ensure that a two tailed test with $\alpha = 0.01$ has $80$ % power to detect the difference of $2$ in the means.

## Endnote

In this tutorial, you learned about how to determine the sample size required to test population mean. You also learned how to solve numerical examples on sample size determination to test mean.

To learn more about other calculators for the determination of sample size, please refer to the following tutorials:

Let me know in the comments if you have any questions on **determination of sample size required to test mean** and your thought on this article.