04/12/2021
Use the left and right arrow keys to navigate the presentation forward and backward respectively. You can also use the arrows at the bottom right of the screen to navigate with a mouse.
FAIR USE ACT DISCLAIMER: This site is for educational purposes only. This website may contain copyrighted material, the use of which has not been specifically authorized by the copyright holders. The material is made available on this website as a way to advance teaching, and copyright-protected materials are used to the extent necessary to make this class function in a distance learning environment. The Fair Use Copyright Disclaimer is under section 107 of the Copyright Act of 1976, allowance is made for “fair use” for purposes such as criticism, comment, news reporting, teaching, scholarship, education and research.
The following topics will be covered in this lecture:
Courtesy of Mario Triola, Essentials of Statistics, 6th edition
Courtesy of Mario Triola, Essentials of Statistics, 6th edition
The last argument also required that the variance \( \sigma^2 \) was known.
To compute the confidence intervals as above, we need to introduce a new function, the quantile function:
qnorm(p, mean, sd)
– this is the quantile function that gives the critical value associated to the value \( \alpha=p \).qnorm(0.025)
[1] -1.959964
qnorm(0.975)
[1] 1.959964
qnorm(p)
where \( p=1-\frac{\alpha}{2} \).Suppose we know that, \( \overline{X} \) is the sample mean from a normal population with (unknown) mean \( \mu= 10 \), standard deviation \( \sigma= 2 \) and sample size \( n=16 \), then
\[ \overline{X} \sim N\left(10, \frac{4}{16}\right). \]
Notice that the standard error is thus given as \( \sigma_\overline{X} = \sqrt{\frac{1}{4}} = \frac{1}{2} \)
If \( \overline{X} \) is observed to take the value \( \overline{x}=9 \), then we can construct the \( 95\% \) confidence interval for \( \mu \) as,
se <- 0.5
z_alpha_over_2 <- qnorm(0.975)
ci <- c(9 - se*z_alpha_over_2 , 9+se*z_alpha_over_2)
ci
[1] 8.020018 9.979982
Let's suppose instead we repeat the argument but select \( \alpha=0.01 \).
This corresponds to a critical value \( z_\frac{\alpha}{2}=z_{0.005} \).
To compute the the corresponding critical value, we are looking for p
=\( 1-\frac{\alpha}{2}=0.995 \)
se <- 0.5
z_alpha_over_2 <- qnorm(0.995)
ci <- c(9 - se*z_alpha_over_2 , 9+se*z_alpha_over_2)
ci
[1] 7.712085 10.287915
Notice that this \( (1-\alpha)\times 100\% = 99\% \) confidence interval does contain the true mean.
This confidence interval is somewhat wider as we want to guarantee that the procedure will work \( 99\% \) of the time.
Therefore, we need to include a wider range of plausible values when we construct such an interval.
Courtesy of Montgomery & Runger, Applied Statistics and Probability for Engineers, 7th edition
Courtesy of Montgomery & Runger, Applied Statistics and Probability for Engineers, 7th edition
Sample Size for Specified Error on the Mean, Variance Known
If \( \overline{X} \) is used as an estimate of \( \mu \), we can be \( (1 − \alpha)\times 100\% \) confident that the error \( \vert \overline{x} - \mu\vert \) will not exceed a specified amount \( E \) when the sample size is \[ n = \left(\frac{z_\frac{\alpha}{2} \sigma}{E}\right)^2. \]
Note that the above was directly a consequence of the central limit theorem, and the fact that
\[ \overline{X} \sim N\left(\mu, \frac{\sigma^2}{n}\right). \]
when the underlying population is normal (or approximately for large \( n \) for non-normal populations).
Suppose that we want to determine how many specimens must be tested to ensure that the \( 95\% \) CI on \( \mu \) for a normal population with known standard deviation \( \sigma=1 \) falls below some specified error tolerance.
For a \( 95\% \) confidence interval, we have \( \alpha=1-0.95=0.05 \).
We therefore require that \( 1-\frac{\alpha}{2} = 1-0.025=0.975 \) of the area lies to the left and \( \frac{\alpha}{2}=0.025 \) lies to the right of \( z_\frac{\alpha}{2} \).
If \( E=10\% \), we would write,
\[ \begin{align} n &= \left(\frac{z_\frac{\alpha}{2} \sigma}{E}\right)^2\\ &= \left(\frac{z_{0.025} \times 1}{0.10}\right)^2 \end{align} \]
In R we can write
E <- 0.1
sigma <- 1.0
z_alpha_over_2 <- qnorm(0.975)
n_ten_percent <- ( (z_alpha_over_2 * sigma) / E )^2
n_ten_percent
[1] 384.1459
n_ten_percent
[1] 384.1459
Suppose we require this estimate to be more precise, say \( E=5\% \) or \( E=1\% \).
We can revise our previous estimate by
E <- 0.05
n_five_percent <- ( (z_alpha_over_2 * sigma) / E )^2
n_five_percent
[1] 1536.584
E <- 0.01
n_one_percent <- ( (z_alpha_over_2 * sigma) / E )^2
n_one_percent
[1] 38414.59
x_vals <- c(0.01, 0.05, 0.10)
y_vals <- c(n_one_percent, n_five_percent, n_ten_percent)
par(cex = 2.0, mar = c(5, 4, 4, 2) + 0.3)
plot(x_vals, y_vals, xlab = "Error tolerance", ylab="Necessary sample size", type="b")