Showing posts with label confidence intervals. Show all posts
Showing posts with label confidence intervals. Show all posts

Saturday, March 1, 2014

Notes for February 25 and 27


The dependent probabilities in a 52 card deck

One of the simplest mathematical models of dependency is sampling without replacement, which is the way most card games or lotteries or the game of Bingo works. You have a set of outcomes which get effectively randomized and a trial is performed, meaning a card is taken from the deck or a ping pong ball is removed from the hopper or a bingo marker is removed from the spinner. Once removed, the number of possible outcomes has been reduced by one and probabilities for success and failure of certain outcomes change.

Looking for an ace: There are 52 cards is a standard deck and 4 of them are aces. If I draw a card from a randomized deck, the chances are 4/52 = 1/13 ~= 7.7% that the card will be an ace. What are the chances the second card is an ace?

That depends on the first card.

Probability that the second card is an ace, given the first card is an ace is 3/51 = 1/17 ~= 5.9%.

Probability that the second card is an ace, given the first card is not an ace is 4/51 ~= 7.8%.

Unlike the mathematical model of free throw shooting where we re-calculate the probabilities by adding the most recent make or miss into the percentage, which means a miss brings the odds down and a make brings the odds up, not getting an ace makes the odds a little better next time, and getting an ace makes the odds worse.


This is the formula for the dependent probability model of sampling without replacement is given at the left. The two numbers in parentheses are a binomial coefficient, the numbers you get when you use nCr on your calculator, which I pronounce "n choose r" in class. The pairs of numbers that look like a base and an exponent, except that the exponent is underlined, is the convention developed by Donald Knuth at Stanford for writing the numbers that you get on your calculator using the nPr function, which I pronounce "n fall r", referring to the name "the falling factorial". If we think about a deck of cards, the lowercase letters refer to the size of the hand n, where r is the number of successful trials (r for right) and w is the number of unsuccessful trials (w for wrong), and r+w=n. The uppercase letters refer to the size of the deck, where T is the size of the deck, G is the number of cards we consider success if we draw them and B is the number of cards we consider a failed trial if we draw them. The letter T stands for Total, G for Good and B for Bad. Again, we have an equation, G+B=T.

Example: If we want consider drawing a heart a success and anything else a failure, what is the probability of drawing three hearts and two non hearts in a five card hand from a well-shuffled 52 card deck.

Here are the six numbers we need.
n = 5
r = 3
w = 2
T = 52
G = 13
B = 39

On a TI-30XIIs, here are the keys you would press.

5[prb][right]3×13[prb]3×39[prb]2÷52[prb]5[enter]

The calculator will read as follows.

5 nCr 3*13 nPr 3*39 nPr 2/52 nPr 5
0.081542617

This means the probability of exactly three hearts and two cards of some other suit is about 8.15%.

Let's say instead the deck had 10,000 cards and 2,500 hearts. our numbers would change.
n = 5
r = 3
w = 2
T = 10000
G = 2500
B = 7500

On a TI-30XIIs, here are the keys you would press.

5[prb][right]3×2500[prb]3×7500[prb]2÷10000[prb]5[enter]

The calculator will read as follows.

5 nCr 3*2500 nPr 3*7500 nPr 2/10000 nPr 5
0.0878613102

The difference is small, but the second number is much closer to the odds of 3 out of 5 when the probability of success is .25 every time


5 nCr 3*.25^3*.75^2
0.087890625

The point of this is that as the size of the deck gets larger, dependent and independent probabilities get closer together.

When we use categorical data, the most important statistic we try to predict is the proportion of a value in the population, which we call p, which we will estimate using the proportion from the sample, known as p-hat.

Again we will create a confidence interval, and the formula for standard deviation is very different.

sp-hat = sqrt(p-hat * q-hat/n)

The confidence level multipliers for xx% are taken from the z-score table (Table A-2) instead of the t-score table, and this is because the standard deviation for the sample and the standard deviation for the population are expected to be relatively close to one another. The values for the CLMxx% are given on the first page of your yellow sheets in the lower left hand corner.

CLM90% = 1.645
CLM95% = 1.96
CLM99% = 2.575

Example: Consider data sets #1 and #2, and the proportion of males. Let's find the 95% confidence interval for the underlying population, which we will limit to students at Laney who take statistics.

Data set #1:
n = 38
f(males) = 18
p-hat(males) = 18/38 ~= .474
q-hat(males) = 1 - p-hat(males) ~= .526

.474 - 1.96*sqrt(.474*.526/38) < p < .474 + 1.96*sqrt(.474*.526/38)
.315 < p < .633

Given this sample of 38 students, we are 95% confident the percentage of male students taking statistics at Laney is between 31.5% and 63.3%.


Data set #2: n = 42
f(males) = 12
p-hat(males) = 12/42 ~= .286
q-hat(males) = 1 - p-hat(males) ~= .714

.286 - 1.96*sqrt(.286*.714/42) < p < .286 + 1.96*sqrt(.286*.714/42)
.149 < p < .423

Given this sample of 42 students, we are 95% confident the percentage of male students taking statistics at Laney is between 14.9% and 42.3%.

Data sets #1 and #2 combined: n = 80
f(males) = 30
p-hat(males) = 30/80 = .375
q-hat(males) = 1 - p-hat(males) = .625

.375 - 1.96*sqrt(.375*.625/80) < p < .375 + 1.96*sqrt(.375*.625/38)
.269 < p < .481


Given this sample of 40 students, we are 95% confident the percentage of male students taking statistics at Laney is between 26.9% and 48.1%.

Notice how much our intervals disagree with one another. This is because our best point estimates from the three sets are .474, .286 and .375. Also notice that the width of the 95% confidence interval tends to be smaller as n gets bigger. When the sample size is 38, the width of the confidence interval is .318. At n = 42, it is .274 wide. At n = 80, the width is .212. The most common way to make a confidence interval narrower is to increase the size of the sample.

There are two other ways to change the width. If you ask for a higher confidence level, the interval will get wider. If p and q are close to 50%, the confidence interval will be wider than if the are both far away from 50%.


Thursday, October 4, 2012

Confidence intervals for proportions.

In Excel, we can find the z-scores that give us the end points of the confidence intervals as follows.

90% confidence interval.  The middle 90% is between 5% and 95%. The Excel formulas are

=norminv(.05, 0, 1)

= norminv(.95, 0, 1)

Rounded to four places after the decimal, we get -1.645 and 1.645.

95% confidence interval.  The middle 95% is between 2.5% and 97.5%. The Excel formulas are

=norminv(.025, 0, 1)

= norminv(.975, 0, 1)

Rounded to four places after the decimal, we get -1.960 and 1.960.


99% confidence interval.  The middle 90% is between 0.5% and 99.5%. The Excel formulas are

=norminv(.005, 0, 1)

= norminv(.995, 0, 1)

Rounded to four places after the decimal, we get -2.576 and 2.576.
In our first sample of 180 m&ms, there were 15 red m&ms. This says p_hat(red) = 15/180 ~= 8.3% when rounded to the nearest tenth of a percent.

The standard deviation for this proportion sp_hat(red) = sqrt(.083(1-.083)/180) or .020600514, which I will round to 2.1%

Here are the confidence intervals for this sample.

90% confidence interval.

0.083 + 1.645(.021) = .117545 about 11.8%
0.083 - 1.645(.021) = .048455 about 4.8%

Given this sample, we are 90% confident the true proportion of red m&ms in the population is between 4.8% and 11.8%


95% confidence interval.

0.083 + 1.960(.021) = .12416 about 12.4%
0.083 - 1.960(.021) = .04184 about 4.2%

Given this sample, we are 95% confident the true proportion of red m&ms in the population is between 4.2% and 12.4%



99% confidence interval. 

0.083 + 2.576(.021) = .137096 about 13.7%
0.083 - 2.576(.021) = .028904 about 2.8%

Given this sample, we are 99% confident the true proportion of red m&ms in the population is between 2.8% and 13.7%


As we increase the confidence, the interval gets larger.

As the sample size n gets larger, sqrt(p_hat*q_hat/n) will tend to get smaller, so larger sample sizes will give us smaller intervals, assuming p_hat doesn't change much.

Saturday, October 9, 2010

Practice problems for confidence of victory and confidence intervals

Links to earlier posts about confidence of victory.

Data from recent polls.

Boxer vs. Fiorina U.S. Senate (CA)
Date: 10/2
Boxer: 49%
Fiorina: 44%
n = 448

Brown vs. Whitman Governor (CA)
Brown: 50%
Whitman: 43%
n = 448

For both of these polls:
1) Find the 95% confidence interval for both candidates
2) Since the two top candidate poll over 90% total, do the confidence of victory, rounding to the nearest 5% if the value is under 90% and to the nearest 1% if the value of over 90%.

Answers in the comments.

Wednesday, September 22, 2010

Practice problems for homework 4

Here is a sample of pulse rates for females.

100, 97, 90, 88, 83, 82, 80, 80, 78, 77, 73, 72, 70, 69, 68, 67, 67, 60, 60, 60

1) Find n, x-bar, sx and the median.

2) Is -0.5 < z(median) < 0.5?

3) is proportion(z(high)) - proportion(z(low)) > 88%?

4) If yes to both question 2) and question 3), Find the 95% confidence interval for mux, where the endpoints are rounded to one place after the decimal point.

5) Find the 95% confidence interval for sigmax.

Answers in the comments.

Tuesday, March 31, 2009

Class notes for 3/30


One of the most common uses of statistics is in opinion polling, which is most popular in election years. TV, radio and newspapers are nearly constantly reporting on the results of polls, new ones being released every day. The numbers for the candidates, or at least how much of a lead one candidate has over the major competitor, is reported up front, and sometimes at the end of the report the margin of error will be given. Almost never is the margin of error given with a confidence level attached. The one major exception to this oversight is The New York Times, which does explain the confidence level in a sidebar, that confidence level always being 95% in opinion polls.

As we see in the sidebar above, the true percentage of the population p is expected to be inside an interval that surrounds p-hat, the percentage of our sample. The Confidence Level Multipliers are taken from the z-score table instead of the t-score table. They are given in the lower right hand corner of the Positive z Score table (Table A-2), where they are labeled Common Critical Values.

CLM90% = 1.645
CLM95% = 1.96
CLM99% = 2.575

Let's take some polling data from last year's election and find the margins of error.

Final poll from Florida - 2008
n = 678
p-hat(Obama) = 49%
p-hat(McCain) = 48%
p-hat(undecided or other candidates) = 3%

Margin of error for Obama = 1.96*sqrt(.49*.51/678) = 0.037629145... ~ 3.7%
Margin of error for McCain = 1.96*sqrt(.48*.52/678) = 0.037606552... ~ 3.7%

The margin of error is typically rounded to the nearest tenth of a percent, and unless there is a lot of undecided or support for other candidates, it is very common in a two person race that the margin or error for each candidate will round to the same number.

The correct sentence to explain the following data would be as follows: If the election were held the day the poll was taken, we are 95% confident that Obama would get between 45.2% to 52.7% of the vote, while McCain would garner between 44.2% to 51.7% of the vote.

The final election results in Florida, rounded to the nearest thousand, were as follows.

Obama 4,282, 000 51.0%
McCain 4,045,000 48.2%
Other 63,000 0.8%

Both candidates were inside the 95% confidence intervals stated in the final poll. The other candidate vote is significantly lower than the 3% of the final poll, but that included undecided voters, who may have chosen one candidate over another, or not voted at all.

Final poll from North Dakota - 2008
n = 500
p-hat(Obama) = 46%
p-hat(McCain) = 47%
p-hat(undecided or other candidates) = 7%

Margin of error for Obama = 1.96*sqrt(.46*.54/500) = 0.043686461... ~ 4.4%
Margin of error for McCain = 1.96*sqrt(.47*.53/500) = 0.043747973... ~ 4.4%

Again, the two margins of error round to the same tenth of a percent.

The correct sentence to explain the following data would be as follows: If the election were held the day the poll was taken, we are 95% confident that Obama would get between 41.6% to 50.4% of the vote, while McCain would garner between 42.6% to 51.4% of the vote.

The final election results in North Dakota, rounded to the nearest thousand, were as follows.

Obama 141,000 44.6%
McCain 169,000 53.5%
Other 6,000 1.9%

While Obama's result was inside the 95% confidence interval stated in the final poll, McCain did better than expected. 95% confidence means there will be mistakes about 5% of the time, which is about 1 chance in 20 of being wrong. If the polling company had used the 99% confidence interval, and in polling data no one ever does, the numbers would have been as follows.

Margin of error for Obama = 2.575*sqrt(.46*.54/500) = 0.057394203... ~ 5.7%
Margin of error for McCain = 2.575*sqrt(.47*.53/500) = 0.057475015... ~ 5.7%

McCain's 53.5% is still above the high end of the 99% confidence interval.

In class, we did samples of m&m's. Here are the totals for the second class, with both samples put together.

n= 1700
p-hat(red) = 221/1700 = 13.0%
p-hat(blue) = 382/1700 ~ 22.5%

sp-hat(red) = sqrt(.13*.87/1700) = 0.008156556...
sp-hat(blue) = sqrt(.225*.775/1700) = 0.010127859...

Here are the confidence intervals for the percentage of red m&m's in the current world population of milk chocolate m&m's, or at least those manufactured in Hackettstown, New Jersey

90% confidence interval: 13% +/- 1.645*sqrt(.13*.87/1700) = 13% +/- 1.3% = 11.7% to 14.3%
95% confidence interval: 13% +/- 1.96*sqrt(.13*.87/1700) = 13% +/- 1.6% = 11.4% to 14.6%
99% confidence interval: 13% +/- 2.575*sqrt(.13*.87/1700) = 13% +/- 2.1% = 10.9% to 15.1%

Practice problems:

Find the confidence intervals for the true percentage of blue milk chocolate m&m's, for 90% confidence, 95% confidence and 99% confidence. Do the 99% confidence intervals for blue and red overlap?

Answers in the comments.

Tuesday, March 24, 2009

Class notes for 3/23

So far, we have been using numerical data and coming up with confidence intervals for the average or standard deviation of the underlying population using formulas involving n, x-bar and sx, as well as multipliers from the Student's t-score tables (Table A-3) and the Chi square table (Table A-4). We use Student's t-scores instead of z-scores because the standard deviation of the sample (sx) might not be very close to the standard deviation of the population (sigmax), and the t-scores numerically deal with the extra uncertainty created by this variation.

When we use categorical data, the most important statistic we try to predict is the proportion of a value in the population, which we call p, which we will estimate using the proportion from the sample, known as p-hat.

Again we will create a confidence interval, and the formula for standard deviation is very different.

sp-hat = sqrt(p-hat * q-hat/n)

The confidenced level multipliers for xx% are taken from the z-score table (Table A-2) instead of the t-score table, and this is because the standard deviation for the sample and the standard deviation for the population are expected to be relatively close to one another. The values for the CLMxx% are given on the first page of your yellow sheets in the lower left hand corner.

CLM90% = 1.645
CLM95% = 1.96
CLM99% = 2.575

Example: Consider data sets #1 and #2, and the proportion of males. Let's find the 95% confidence interval for the underlying population, which we will limit to students at Laney who take statistics.

Data set #1:
n = 38
f(males) = 18
p-hat(males) = 18/38 ~= .474
q-hat(males) = 1 - p-hat(males) ~= .526

.474 - 1.96*sqrt(.474*.526/38) < p < .474 + 1.96*sqrt(.474*.526/38)
.315 < p < .633

Given this sample of 38 students, we are 95% confident the percentage of male students taking statistics at Laney is between 31.5% and 63.3%.


Data set #2: n = 42
f(males) = 12
p-hat(males) = 12/42 ~= .286
q-hat(males) = 1 - p-hat(males) ~= .714

.286 - 1.96*sqrt(.286*.714/42) < p < .286 + 1.96*sqrt(.286*.714/42)
.149 < p < .423

Given this sample of 42 students, we are 95% confident the percentage of male students taking statistics at Laney is between 14.9% and 42.3%.

Data sets #1 and #2 combined: n = 80
f(males) = 30
p-hat(males) = 30/80 = .375
q-hat(males) = 1 - p-hat(males) = .625

.375 - 1.96*sqrt(.375*.625/80) < p < .375 + 1.96*sqrt(.375*.625/38)
.269 < p < .481


Given this sample of 40 students, we are 95% confident the percentage of male students taking statistics at Laney is between 26.9% and 48.1%.

Notice how much our intervals disagree with one another. This is because our best point estimates from the three sets are .474, .286 and .375. Also notice that the width of the 95% confidence interval tends to be smaller as n gets bigger. When the sample size is 38, the width of the confidence interval is .318. At n = 42, it is .274 wide. At n = 80, the width is .212. The most common way to make a confidence interval narrower is to increase the size of the sample.

There are two other ways to change the width. If you ask for a higher confidence level, the interval will get wider. If p and q are close to 50%, the confidence interval will be wider than if the are both far away from 50%.

Question:

1. Use data set #1 to find the 95% confidence interval for the proportion of 20-29 year olds among Laney statistic students. Write the sentence explaining the confidence interval.

2. Use data set #2 to find the 95% confidence interval for the proportion of 20-29 year olds among Laney statistic students. Write the sentence explaining the confidence interval.

3. Use data sets #1 and #2 combined to find the 95% confidence interval for the proportion of 20-29 year olds among Laney statistic students. Write the sentence explaining the confidence interval.

Answers in the comments.

Thursday, March 19, 2009

Class notes for 3/18

Tests before confidence interval for average of population

We have discussed finding a confidence interval for mux by using x-bar, the average of a sample taken from that population. Because we don't know the average of the population, we can't know the standard deviation of the population, since you need the average to compute the standard deviation. Because of this uncertainty, we use Student's t-scores instead of z-scores for the Confidence Level Multipliers for xx%, or CLMxx% for short.

There are times when we aren't allowed to use this method for approximation. We have two questions, and if we answer no to both of them, this method should not be used and only non-parametric methods are useful when dealing with this data set. (We will learn a few non-parametric methods later in the class, but most of these methods are taught in more advanced stats classes.)

Question #1: Is n > 30? If a sample is big enough, Gossett decided that his t-scores are going to give a reasonable approximation. This is always the first question because it is so easy to answer, and if we get a yes here, we don't even need to ask Question #2.

Question #2: Is the underlying data set normally distributed? It might be that we will be told the answer to this question without having to do any work to test this ourselves, and if we are told "yes" we can proceed. If we aren't told, here are two tests. There are other tests than can be done, but these two are easy and useful, and if the data set passes both these tests, we will assume we can move forward.


The z(mid-range) test. Recall that the mid-range is the average of the highest and lowest values in the data set. If one of these scores is a lot farther away from average than the other, we can consider that the data set may be too skewed to be reliable. What this test does is look to see if one extreme value (the highest or lowest) is more than one standard deviation farther away from average than the other extreme value. Understand that one standard deviation is an arbitrary value. The formula in this inequality is z(mid-range), which is where the test's name comes from.


The mean to median test. If the data is normally distributed, then the mean and median of the underlying population should be equal. If the mean and median of the sample are significantly different, then this test should produce a number greater than 1.353. (This is a simple version of a goodness-of-fit test, which we will be exploring in greater depth later in the semester.)

Once we have the average value x-bar, count how many values are greater than x-bar, and call this value above. We should expect that random samples from a normally distributed set should have about a 50%-50% split of values above and below average, so about n/2 in each group.

Again, the cut-off point 1.353 is arbitrary, and it is derived from the chi squared table. If we get a yes to both these questions, we can answer yes to the question about the normally distributed underlying population and proceed to find the interval for mux, which is the following inequality.

x-bar - CLMxx%*sx/sqrt(n) < mux < x-bar + CLMxx%*sx/sqrt(n)

Confidence interval for standard deviation of population


The confidence interval formula for sigmax is completely different than the formula for mux, and uses values from a new table, Table A-4, known as the chi squared table. Chi is pronounced like the chi in chiropractor, "kai", not "chee" or "chai".

Note that we don't have to test for normal distribution of the underlying data.

Let's give an example. If we have a set where n = 13 and sx = 3.21, we use n-1 as our degrees of freedom. Here is the line from Table A-4 for the row that corresponds to 12.

_____0.995___0.99___0.975___0.95___0.90___0.10____0.05___0.025____0.01___0.005
_12__3.074__3.571___4.404__5.226__6.304__18.549__21.026__23.337__26.217__28.299

The values of chi^2R and chi^2L are taken from the table as follows.

90% confidence: The right value is from the 0.05 column, the left value s from the 0.95 column. (Note that 0.95 - 0.05 = 0.90 or 90%)


95% confidence: The right value is from the 0.025 column, the left value s from the 0.975 column. (Note that 0.975 - 0.025 = 0.95 or 95%)99% confidence: The right value is from the 0.005 column, the left value s from the 0.995 column. (Note that 0.995 - 0.005 = 0.99 or 99%)

In this instance, here are the confidence intervals for each of the standard percentages of confidence.

90% confidence: sqrt(3.21^2*12/21.026) < sigmax <
sqrt(3.21^2*12/5.226)95% confidence: sqrt(3.21^2*12/23.337) < sigmax < sqrt(3.21^2*12/4.404)99% confidence: sqrt(3.21^2*12/28.299) < sigmax < sqrt(3.21^2*12/3.074)

For practice, use your calculator to give the answers above, rounded to two places after the decimal. Answers in the comments.

More practice sets will be posted later today.

Tuesday, March 17, 2009

Class notes for 3/16

One of the major uses of statistics is to find confidence intervals for parameters from statistics, which means to find the approximate range of a value of the population from taking the associated value from a sample, and assigning a confidence level to that range. For the average of a numerical variable, this means finding a range for mux using x-bar, sx, n and looking up a Confidence Level Multiplier on the Student's t-score table, the fifth page of yellow handout, labeled Table A-3.

x-bar - CLMxx%*sx/sqrt(n) < mux < x-bar + CLMxx%*sx/sqrt(n)

There are some things we need to test before we create the interval. We have two questions to ask about the data, and if we get a yes answer to either question, we can proceed. If we get no answers to both, then we should not use this data set to create a confidence interval.

Question #1: Is n > 30?
Question #2: Is the underlying data set normally distributed?

Question #1 is easy to answer, and if the answer is yes, we don't have to bother with Question #2. It might be that you are simply told by the person who collected the data that the answer is yes. But if that is not the case, here are two tests the data set should pass to get a yes answer to Question #2. Both of these tests are using arbitrary cut-off points, the second test being a preview of tests we are going to do later in the class called goodness of fit.

Test #1: The Mid-range Outlier test. Recall that the mid-range is (high + low)/2. Take the z-score for the mid-range, (mid-range - x-bar)/sx, and if this value is more than 0.5 or less than -0.5, we will answer no to Question #2. If we answer yes, this means there is an outlier either high or low, that either the low value is one full standard deviation farther from the average than the high value, or vice versa. In a small data set, this can skew the statistics and make us less confident about the values being near the parameters from the underlying population.

Test #2: The Goodness of Fit test. We can do this test as long as n is 10 or more. If the data set has less than 10 entries and it failed Test #1, you shouldn't try to do the confidence interval. In this test, count the number of entries that are more than x-bar and call that value above. If the underlying data set is normally distributed, we would expect about half the entries would be above average and half below average, so about n/2 in each group. The Goodness of Fit test for this data set is done by plugging in these values into this formula, and making this check.

Is (above - n/2)^2 < face="courier new">1.2 4.7 13.1 3.2 8.8 18.2 3.5 12.5 4.8 8.2 0.7
17.1 0.2 11.4 3.2 8.6 6.3 17.4 17.1 17.8
1.2 0.2 0.1 8.9 4.0 8.6 0.7 2.8 0.5 0.4

x-bar = 6.85
sx = 6.17
n = 30
mid-range = (18.2 + 0.1)/2 = 9.15

Test #1: z(mid-range) = (9.15-6.85)/6.17 = 0.37

Because this is less than one half, we can answer yes and move on to test #2.

Test #2: number of values above average, which we call above = 13. n/2 = 15, so the test is

(13-15)^2/15 = 4/15, which rounds to 0.267 and is below 1.353, so we can answer yes to this and proceed.

n = 30 so degrees of freedom = 29. Here are the three most commonly used CLM values.

CLM90% = 1.699
CLM95% = 2.045
CLM99% = 2.756

Using the formula. here are the values for each of the confidence levels.

x-bar - CLMxx%*sx/sqrt(n) < mux < x-bar + CLMxx%*sx/sqrt(n)

90% confidence:
6.85 - 1.699*6.17/sqrt(30) < mux < style="font-size:100%;">mux < style="font-weight: bold;">


95% confidence:
6.85 - 2.045*6.17/sqrt(30) < mux 6.85 + 2.045*6.17/sqrt(30)
4.55 < mux < style="font-weight: bold;">99% confidence:
6.85 - 2.756*6.17/sqrt(30) < mux < 6.85 + 2.756*6.17/sqrt(30)
3.75 < mux < face="georgia">The sentence explaining the confidence interval would go as follows.

Given a sample of the carries per game of 30 running backs from the 2008 NFL season, we are 99% confident the true average number of carries per game for all NFL running backs that season is between 3.75 and 9.75.

Practice problem set

Here is the data for average yards per carry for the same 30 randomly selected NFL running backs for the 2008 season.


4.6 2.6 3.9 4.4 4.2 3.8 5.5 3.6 3.1 3.7
6.8 5.5 2.0 5.6 4.4
4.8 5.7 3.6 4.3 3.5
5.0 0.0 -2.0 2.8 3.3 4.4 2.0 6.0 1.3 4.0


Problem #1: Find x-bar and sx, rounded to two places after the decimal point.
Problem #2: Do the z(mid-range) test. Does the set pass or fail?
Problem #3: Do the second test for normal distribution. Does the set pass or fail?
Problem #4: Find the endpoints for the 95% confidence interval.
Problem #5: Write the sentence explaining the interval.

Answers in the comments.

Thursday, March 12, 2009

Class notes for 3/11

The positive and negative z-score tables connect z-scores to proportions, numbers between 0 and 1 written to four decimal places of accuracy. For example, z = 1.23 corresponds to .8907, which means that 89.07% of data in a normally distributed set should have a z-score of 1.23 or less, while (100-89.07)% = 10.93% of data will have a z-score of 1.23 or more. Moreover, the normal curve is symmetric around z = 0. This means when z = -1.23, that is the cut-off point between the low 10.93% of the data and the high 89.07% of the data, just the opposite of the percentages that correspond to z = 1.23.



Critical values, or Confidence Level Multipliers (CLMxx%)

Sometimes, instead of being interested in the highest n% or the lowest, we will need to deal with the middle n% for what is known as a confidence interval. In the bottom right hand corner of the Positive z Scores table (first page of yellow handout), there is a small table labeled Common Critical Values. On tests and homework, I will call these Confidence Level Multipliers, or CLMxx%, where xx% is the percentage of confidence associated with the z-scores. The table gives the z-scores I will be calling CLM90%, CLM95% and CLM99%.

CLM90%: The end points are -1.645 and +1.645
CLM95%: The end points are -1.96 and +1.96
CLM99%: The end points are -2.575 and +2.575

For example, what this means for the case of CLM90% is that the low 5% of the data is below z=-1.645, the middle 90% is between z=-1.645 and z=+1.645, and the high 5% is above z=+1.645.


Student's t-scores

Confidence intervals are used over and over again in statistics, most especially in trying to find out what value the parameter of the population has, when all we can effectively gather is a statistic from a sample. For numerical data, we aren't allowed to use the normal distribution table for this process, because the standard deviation sx of a sample isn't a very precise estimator of sigmax of the underlying population. To deal with this extra level of uncertainty, a statistician named William Gossett came up with the t-score distribution, also known as Student's t-score because Gossett published all his work under the pseudonym Student. He used this fake name for publishing to get around a ban on publishing in journals established by his superiors at the Guinness Brewing Company where he worked.

The critical t-score values are published on table A-3. The values depend on the Degrees of Freedom, which in the case of a single sample set of data is equal to n-1. For every degree of freedom, we could have another positive and negative t-score table two pages long, just like the z-score table, but that would take up way too much room, so statistics textbooks have reverted instead to publishing just the highlights. There are five columns on the table, each column labeled with a number from "Area in One Tail" and "Area in Two Tails". Let's look at the degrees of freedom row for the number 13.

1 tail___0.005______0.01_____0.025______0.05______0.10
2 tails__0.01_______0.02_____0.05_______0.10______0.20

13_______3.012_____2.650_____2.160_____1.771_____1.333

What this means is that if we have a sample of size 14, then the degrees of freedom are 13 and we can use these numbers to find the cut-off points for certain percentages. The formula for t-scores looks like the formula for z-scores, t = (x - x-bar)/sigmax, but we use the different look-up table to decide what these numbers mean. For example, the second column in row 13 is the number 2.650. This means that in a sample of 14, a Student's t-score of -2.650 is the cutoff for the bottom 1%, the t-score of +2.650 is the cutoff for the top 1% and the middle 98% is between t-scores of -2.650 and +2.650.

As the degrees of freedom get larger, the numbers in the columns get smaller. The last row has the label Large and reads as follows.

Large____2.576_____2.326_____1.960_____1.645_____1.282

These values exactly correspond to the z-score table. As the data set size gets larger, the differences between the z-distribution and the t-distribution shrink down to nothing.

When can we use t-scores?

Because we don't know sigmax, we are prohibited from using the z-score tables. But there are cases when we shouldn't use the t-score tables either. Here is the decision method.

Step 1: Is n at least 30? If yes, we are good. If no, go to Step 2.

Step 2: Is the sample normally distributed or can we assume the underlying data set is normally distributed? If yes, we can continue. If no, we would only be able to use non-parametric statistical techniques, which are not covered in this course.

For example, the cotinine data sets we have on the handout sheet have one set that looks normally distributed, the smokers data, and two that do not look normally distributed, the exposed and unexposed non-smoker data. Because n=40 for all the sets, we can use the t-score method because we answered yes to Step 1. If the data sets had less than 30 subjects, we would not be able to use the non-smoker data because we would have answered no to the questions from both Step 1 and Step 2.


The formula for a confidence interval for the mean of a population given the mean of a sample.

The confidence interval for the mean of a population given the mean of the sample is a formula that gives us two endpoints as follows

x-bar - CLMxx%*sx/sqrt(n) < mux < x-bar + CLMxx%*sx/sqrt(n)

Let's take an example. We have the heights of males from Data Set #1. The statistics from that set are as follows.

n = 18
x-bar = 71.17
sx = 2.57

The sample size is 18, which is less than 30, so since we answer no in Step 1, we have to move on to Step 2. Here we can answer yes, because we can assume that human height is a normally distributed set. Let's now move on to finding the 95% confidence interval for the average male height given this sample.

Since n = 18, degrees of freedom = 17, and the CLM95% = 2.110. This is because the area in two tails of 5% is the same as the middle region having 95%. Here is our formula with these numbers plugged in.

71.17 - 2.110*2.57/sqrt(18) < mux < style="font-style: italic;">mux < 72.4

From census information, we know the average height of males in the United States is 69.5 inches, so this interval does not contain the true value. This semester, both the data sets had averages for male heights well above average, largely because of how many football and baseball players are enrolled in the classes, as well as a few other tall males who are not on the sports teams. This is a good example that a confidence interval is NOT a promise of a correct answer, and that statistical methods include confidence intervals exactly for this reason. (note: If we changed the interval to the 99% confidence interval, our confidence level multiplier would be 2.898 instead of 2.110, and the 99% confidence interval would contain the correct answer.)