A study guide for STAT 200, taught by professor Sagara, Yutaka, at the University of Maryland University College. The majority of the text is taken from Introductory Statistics by OpenStax College, available under the Creative Commons Attribution 3.0 Unported license, professor Sagara's slides, and in-class materials. This is a work in progess...
TODO-List
According to the central limit theorem, the distribution of sample means and the sums tend to follow a normal distribution. If we were to collect samples of size n that are "large enough," calculate the sum of each sample and create a historgram, then the resulting histogram will again tend to have a normal-bell-shape.
import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt np.random.seed(19680801) # example data mu = 100 # mean of distribution sigma = 15 # standard deviation of distribution x = mu + sigma * np.random.randn(437) num_bins = 50 fig, ax = plt.subplots() # the histogram of the data n, bins, patches = ax.hist(x, num_bins, normed=1) # add a 'best fit' line y = mlab.normpdf(bins, mu, sigma) ax.plot(bins, y, '--') ax.set_xlabel('Smarts') ax.set_ylabel('Probability density') ax.set_title(r'Histogram of IQ: $\mu=100$, $\sigma=15$') # Tweak spacing to prevent clipping of ylabel fig.tight_layout() plt.show()
The mean of a sample mean is represented as
The sample standard deviation is represnted as and can be calculated by using the following formula:
In a recent study reported Oct. 29, 2012 on the Flurry Blog, the mean age of tablet users is 34 years. Suppose the standard deviation is 15 years. Take a sample of size = 100.
Before finding the solution we must identify the information given.
a.) Since is representative of , we can say that , or that the mean of the sample is 34. To find the standard deviation, we use the formula
Then we plug in the values that we were given
Therefore, we can say that , or that the standard deviation for the sample is 1.5.
b.) The second question is asking for the probability that the sample mean age is more than 30 years. We can find this information by determening the z-score and then looking for the area or percentage to the RIGHT of z.
So we begin by finding the z-score using the information provided and the result of from the previous question:
As you can see the area to the LEFT of the z value is 0.0038, this means that there is a 0.38% probability that the sample mean age is 30 years or less. However, the problem is asking for 30 years or more.
Therefore, we must subtract 0.38% from 100%.
Our result for the probability that the sample mean age is more than 30 years, is 99.62%.
c.) In this scenerio, we are told to find the 95th percentile of the sample mean, meaning we need to find the sample mean that has a probability of 95% or less.
We start by using the z-score formula.
In this case we are looking for the value of . We can use the z-score formula to solve for .
We can then use the z-score table to find the value of z given the probability of 95% or 0.95.
| Z | 0.00 | 0.01 | 0.02 | 0.03 | 0.04 | 0.05 | 0.06 | 0.07 | 0.08 | 0.09 |
|---|---|---|---|---|---|---|---|---|---|---|
| 1.40 | 0.9192 | 0.9207 | 0.9222 | 0.9236 | 0.9251 | 0.9265 | 0.9279 | 0.9292 | 0.9306 | 0.9319 |
| 1.50 | 0.9332 | 0.9345 | 0.9357 | 0.9370 | 0.9382 | 0.9394 | 0.9406 | 0.9418 | 0.9429 | 0.9441 |
| 1.60 | 0.9452 | 0.9463 | 0.9474 | 0.9484 | 0.9495 | 0.9505 | 0.9515 | 0.9525 | 0.9535 | 0.9545 |
As you can see, in our table, 0.95 falls between 1.64 and 1.65, so we can estimate z to be 1.645.
Now we go back to our formula using our z value and solve for .
Our result for the 95th percentile for the sample mean age, is 36.5.
Confidence Interval (CI) gives the range with various certainty (90%, 95%, 99%, etc.).
Margin of error (EBM) depends on the confidence level, sample size, and known or estimated deviation
If none of those criterias are met, then use nonparametric or bootstrapping methods.
A study of 415 kindergarten students showed that they have seen on average 5,000 hours of TV. If the sample standard deviation of the population is 900, find the 95% confidence level of the mean for all students. If a parent claimed that his children watched 4,000 hours, would the claim be believable.
Lets identify the information given.
And the questions being asked are
First we must determine whether to use the z-score or the t-score distribution. The problem provides us with = 900. Therefore, we should use the z-score distribution.
Then we look at the first question in the problem which asks us to find the 95% confidence level of the mean of all students. In other words, we are being told that = 95% or 0.95, and we need to find the confidence interval estimate of that percentage. Remember that , or the confidence level, is the area in the middle of the standard normal distribution, and that the confidence interval is not just one number, it is a set of numbers.
We can take a look at the graph below to understand it better.

The confidence interval can be expressed in defferent ways
So if we update the graph we have

In order to find the confidence interval, or , we need to first find the value of , which is the margin of error.
As you know,
If we plug in the values that we were given, we're left with the following
We need to find in order to solve the equation above.
Since , we can infer that .
Since , we can say that . This means that the area to the RIGHT of is 0.025, and the area to the LEFT of is . In our scenario, we are concerned with the area to the LEFT of , wich is 0.975.
We can then use the z-score table to look up the value given an area of 0.975.
| Z | 0.00 | 0.01 | 0.02 | 0.03 | 0.04 | 0.05 | 0.06 | 0.07 | 0.08 | 0.09 |
|---|---|---|---|---|---|---|---|---|---|---|
| 1.70 | 0.9554 | 0.9564 | 0.9573 | 0.9582 | 0.9591 | 0.9599 | 0.9608 | 0.9616 | 0.9625 | 0.9633 |
| 1.80 | 0.9641 | 0.9649 | 0.9656 | 0.9664 | 0.9671 | 0.9678 | 0.9686 | 0.9693 | 0.9699 | 0.9706 |
| 1.90 | 0.9713 | 0.9719 | 0.9726 | 0.9732 | 0.9738 | 0.9744 | 0.9750 | 0.9756 | 0.9761 | 0.9767 |
| 2.00 | 0.9772 | 0.9778 | 0.9783 | 0.9788 | 0.9793 | 0.9798 | 0.9803 | 0.9808 | 0.9812 | 0.9817 |
Looking at the table we can then say that given that the area to the left of is 0.975, the z-score is 1.96.
We can then go back to our confidence interval formula and plugin the remaining value
This result means that the margin of error is 86.60.
Now we have all the information neccessary to answer . Lets plug in the values.
a.) So the answer the first question is .
With this information we can then answer the second question.
b.) If a parent claimed that his children watched 4,000 hours, it would not be believable since it is outside of the confidence interval, 4,000 < 4,913.
A health care professional wishes to estimate the birth weights of infants. How large a sample must be obtained if she desires to be 90% confident that the true mean is within 2 ounces of the sample mean? Assume ounces.
Lets list all the given information.
The problem is asking for "how large a sample must be", meaning the value of .
Lets begin be determining if we can use the z-score or the t-distribution. We are given . Therefore we can use the z-score distribution.
In order to find with the information that we have, we can use:
Using that formula we can solve for and we're left with:
As the previous example, we need to find the value of , more specifically the area to the LEFT of .
We know that , and since we were given = 0.90, we can say that or .
Therefore, , and the area to the LEFT of is .
So if we search for the value of in the z-score table for the area of 0.95...
| Z | 0.00 | 0.01 | 0.02 | 0.03 | 0.04 | 0.05 | 0.06 | 0.07 | 0.08 | 0.09 |
|---|---|---|---|---|---|---|---|---|---|---|
| 1.40 | 0.9192 | 0.9207 | 0.9222 | 0.9236 | 0.9251 | 0.9265 | 0.9279 | 0.9292 | 0.9306 | 0.9319 |
| 1.50 | 0.9332 | 0.9345 | 0.9357 | 0.9370 | 0.9382 | 0.9394 | 0.9406 | 0.9418 | 0.9429 | 0.9441 |
| 1.60 | 0.9452 | 0.9463 | 0.9474 | 0.9484 | 0.9495 | 0.9505 | 0.9515 | 0.9525 | 0.9535 | 0.9545 |
...we don't have 0.95 exactly in this table, but we can estimate that it is between 1.64 and 1.65, so we can go with 1.645.
Now we can go back to our formula to find the value of .
Notice that , but we must always round UP to the next higher integer to ensure that the sample size is large enough.
Therefore, our final answer is .
Suppose that a committee is studying whether or not there is waste of time in our judicial system. It is interested in the mean amount of time individuals waste at the courthouse waiting to be called for jury duty. The committee randomly surveyed 81 people who recently served as jurors. The sample mean wait time was eight hours with a sample standard deviation of four hours.
a. Construct a 95% confidence interval for the population mean time wasted.
Lets list all the information we were given.
Once again, lets determine what distribution we should use. We were told that 81 people were surveyed, or that = 81. This information meets one of the criterias for the z-score and t-score. Now lets look further into the problem to decide which distribution we should use out of those two. The next key information is that the sample standard deviation is four hours, or that = 4. The fact that we were told the standard deviation of the sample () and not of the population (), meets the criteria for using the t-score distribution.
Remember that given that either n > 30, or that the population is normally distributed, you would use the z-score distribution when the standard deviation of the population is known (), but if is unknown, then you would use the t-score distribution.
a.) Before finding the 95% confidence interval for the population mean time wasted, lets update the information that we have.
We know from previous examples that in order to find the confidence interval we can use the formula
But before we do that we need to find the value of .
We know that . Therefore, in this scenerio, 95% or 0.95 = 1 - . To find alpha we can say:
Now that we know that , we can say that
Before moving on, it is important to recall that gives us the area to the RIGHT of . This fact can be confusing, but it is crucial.
Next, in order to find the value of we can use the t-distribution table.
var TESTER = document.getElementById('tester') Plotly.plot(TESTER, [{ x: [1, 2, 3, 4], y: [1, 2, 3, 4] }, { margin: {f: 0} }]) ''
var y0=[],y1=[] for (var i = 0; i < 50; i ++) { y0[i] = Math.random(); y1[i] = Math.random(); } var trace1 = { y: y0, type: 'box' }; var trace2 = { y: y1, type: 'box' }; var data = [trace1, trace2]; Plotly.newPlot('myDiv', data);
var trace1 = { x: [1, 2, 3, 4, 4, 4, 8, 9, 10], type: 'box', name: 'Set 1' }; var trace2 = { x: [2, 3, 3, 3, 3, 5, 6, 6, 7], type: 'box', name: 'Set 2' }; var data = [trace1, trace2]; var layout = { title: 'Horizontal Box Plot' }; Plotly.newPlot('myDiv2', data, layout);
import matplotlib.pyplot as plt plt.plot([1,2,3, 4]) plt.show()
import numpy as np import matplotlib.pyplot as plt x1 = np.linspace(0.0, 5.0) x2 = np.linspace(0.0, 2.0) y1 = np.cos(2 * np.pi * x1) * np.exp(-x1) y2 = np.cos(2 * np.pi * x2) plt.subplot(2, 1, 1) plt.plot(x1, y1, 'o-') plt.title('A tale of 2 subplots') plt.ylabel('Damped oscillation') plt.subplot(2, 1, 2) plt.plot(x2, y2, '.-') plt.xlabel('time (s)') plt.ylabel('Undamped') plt.show()