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")
x <- seq(0.005,0.1,by=0.005)
E <- x
n_grid <- ( (z_alpha_over_2 * sigma) / E )^2
par(cex = 2.0, mar = c(5, 4, 4, 2) + 0.3)
plot(E, n_grid, xlab = "Error tolerance", ylab="Necessary sample size", type="b")
This plot illustrates the fact that the sample size is growing like
\[ \begin{align} n=C_{\alpha, \sigma} \times \frac{1}{x^2} \end{align} \]
where \( C_{\alpha,\sigma} \) is a constant that depends on the confidence level and the population standard deviation.
Courtesy of Sethi, R.J. et al. Gait recognition using motion physics in a neuromorphic computing framework. 2010.
One-Sided Confidence Bounds on the Mean, Variance Known
The \( (1-\alpha)\times 100\% \) upper-confidence bound for \( \mu \) is \[ \begin{align} \mu &\leq \overline{x} + z_\alpha \sigma_{\overline{X}} \\ &= \overline{x} + z_\alpha \frac{\sigma}{\sqrt{n}} \end{align} \] and the \( (1 − \alpha)\times 100\% \) lower-confidence bound for \( \mu \) is \[ \begin{align} \mu & \geq \overline{x} - z_\alpha \sigma_\overline{X} \\ & = \overline{x} - \frac{\sigma}{\sqrt{n}} \end{align} \]
In the case that we need to compute a one-sided confidence interval, we can revise our earlier solution as follows:
\[ \sigma_\overline{X} = \frac{0.5}{\sqrt{25}} = \frac{0.5}{5} = 0.1 \]
If we want to solve for a \( 95\% \) confidence bound, we compute the sample mean \( \overline{x} \), the standard error and \( z_\alpha \) as
x_bar = 10
se <- 0.1
z_alpha <- qnorm(0.95)
ci_lower <- c(x_bar - se * z_alpha, Inf)
ci_lower
[1] 9.835515 Inf
We have \( 95\% \) confidence that the population mean exceeds 9.835515.
ci_upper <- c(-Inf, x_bar + se * z_alpha)
ci_upper
[1] -Inf 10.16449
We have \( 95\% \) confidence that the population mean falls below 10.16449.
ci_lower
[1] 9.835515 Inf
ci_upper
[1] -Inf 10.16449
c(x_bar- se * z_alpha, x_bar + se * z_alpha)
[1] 9.835515 10.164485
the two-sided confidence interval above corresponds to a \( 90\% \) confidence level.
This is because the two-sided confidence interval above uses the \( z_\alpha \) critical value, with
In practice, we almost never know the true population standard deviation \( \sigma \) and we must use the sample standard deviation \( s \) as a point estimate.
Our standard error estimate is \( \hat{\sigma}_\overline{X}= \frac{s}{\sqrt{n}} \), and this will be utilized for a more general construction of confidence intervals.
If we have a large sample size, with \( n>40 \), we can use this estimate of the standard error effectively within the confidence interval as follows.
Large-Sample Confidence Interval on the Mean
When n is large, the quantity \[ \frac{\overline{X} - \mu}{\frac{s}{\sqrt{n}}} \] has an approximate standard normal distribution. Consequently, \[ x − z_\frac{\alpha}{2} \frac{s}{\sqrt{n}} \leq \mu \leq x + z_\frac{\alpha}{2} \frac{s}{\sqrt{n}} \] is a large-sample confidence interval for \( \mu \), with confidence level of approximately \( (1-\alpha)\times 100\% \).
This is a form of the central limit theorem being used again where the underlying population distribution does not matter;
However, when the sample is small and \( \sigma^2 \) is unknown, we must make an assumption about the form of the underlying distribution to obtain a valid CI procedure.
A reasonable assumption in many cases is that the underlying distribution is normal.
Many populations encountered in practice are well approximated by the normal distribution, so this assumption will lead to confidence interval procedures of wide applicability.
In fact, moderate departure from normality will have little effect on validity.
When the assumption is unreasonable, an alternative is to use nonparametric statistical procedures that are valid for any underlying distribution.
Suppose that the population of interest has a normal distribution with unknown mean \( \mu \) and unknown variance \( \sigma^2 \).
Assume that a random sample of size \( n \), say, \( X_1, X_2 , \cdots , X_n \), is available, and let \( \overline{X} \) and \( S^2 \) be the sample mean and variance, respectively.
We wish to construct a two-sided CI on \( \mu \);
\[ Z = \frac{\overline{X} - \mu}{\frac{\sigma}{\sqrt{n}}} \]
has a standard normal distribution.
The random variable \( Z \) now becomes
\[ T = \frac{\overline{X} − \mu}{\frac{S}{\sqrt{n}}}. \]
For the random variable
\[ T = \frac{\overline{X} − \mu}{\frac{S}{\sqrt{n}}}. \]
logical questions are:
If \( n \) is large, the distribution differs very little from the standard normal by the central limit theorem.
However, \( n \) is usually small in most engineering problems, and in this situation, a different distribution must be employed to construct the CI.
Courtesy of Mario Triola, Essentials of Statistics, 6th edition