Transcript for:
Understanding Confidence Intervals in Statistics

part two confidence intervals I'm Dennis Davis in video one on the sampling distribution we considered a population and described the characteristics of a sample drawn from it in video 2 and 3 we're going to go backwards we'll examine the characteristics of a sample and make inferences about the populations from which that sample could have reasonably been drawn this is where inferential statistics or statistical inference gets its name to infer something means to draw a conclusion based on observed evidence and prior knowledge for example if you see smoke you may infer there's a fire the smoke is the observed evidence and knowing that fire makes smoke is your prior knowledge in inferential statistics the sample is the observed evidence and knowing something about probability and statistics in general and the sampling distribution in particular is our prior knowledge we'll make inferences about the population based on a sample and our knowledge there are two types of inferences this video covers confidence intervals the next video will cover hypothesis testing the topics in this video are Point estimates and interval estimates confidence levels and Alpha levels confidence intervals and confidence statements margin of error critical value standard error Sigma known and unknown and T distributions and confidence intervals for proportions outline on the left vocabulary words in yellow we're almost ready to create a confidence interval one more thought experiment and then we'll put the pieces together suppose we have a golfer who's so good that if we gave him a Target on a driving range he can hit the ball within 5.28 yards of the target eighty percent of the time so if he hits shot after shot we can expect that 80 percent will land within 5.28 yards and 20 percent won't no matter where the target is now suppose we don't know where the target was but we know the golfer hit one shot that landed here where do you think the target was it over here over here maybe but probably not the golfer has a high likelihood of Landing closer to the Target in fact our prior knowledge tells us that there's an 80 percent chance that the golf ball is within 5.28 yards of the target suppose the golfer shot landed at 124.73 yards if we had to guess where the target was this would be our single best guess this is called a point estimate a point estimate is a single value used to estimate a Target usually a population parameter due to Natural random variability between golf shots we wouldn't expect the point estimate of 124.73 yards to exactly correspond to the Target so a point estimate by itself isn't very useful we expect our Point estimate to be close to the population parameter but how close that's a question answered by an interval estimate an interval estimate is a range of values likely to include a Target or population parameter when an interval estimate includes a stated level of confidence a probability such as 80 percent then the interval estimate is called a confidence interval and the probability is the confidence level we observe that the golfer's shot landed at 124.73 yards and we have prior knowledge that his shots are 80 percent likely to land within 5.28 yards of the target the range of values within 5.28 yards of 124.73 yards is 124.73 minus 5.28 yards to 124.73 plus 5.28 yards so we can say we're 80 percent confident that the range 119.45 to 130.01 yards includes the target in this thought experiment the Unseen Target represents Mio the parameter we're trying to estimate the golfer shot represents the sample from which we determine X bar our Point estimate for Mu and knowing that 80 percent of the shots will be within 5.28 yards of the target represents the knowledge we have about the sampling distribution the formula for a confidence interval has this general form Point estimate plus or minus the margin of error the point estimate is the sample statistic and when we're constructing a confidence interval for the mean the statistic is the sample mean Red X bar the margin of error is the product of two factors the critical value times the standard error of the statistic when the statistic is the mean this is the standard error of the mean let me give rough definitions of these two concepts they'll both need refining later so for now please remember these are General simplified definitions the critical value is the z-score corresponding to a probability we determine using the stated confidence level on our normal table Z scores were color-coded blue as part of our memory aid so I'll make the critical value blue because for now it's a z-score when a z-score represents a critical value it often has a superscripted asterisk so it isn't easily mistaken for an ordinary z-score the asterisk reminds us that it's a critical value used to determine a margin of error and the standard error for now let's call it the standard deviation of the sampling distribution pink Sigma sub X bar don't let the word error in standard error alarm you it doesn't mean we made a mistake standard error is a lot like standard deviation it's just a natural random variation from the mean due to the nature of random variables statisticians use the word error to mean variability it doesn't mean a mistake I said in video 1 that we'd use the standard deviation as a yardstick and here we can see the standard deviation of the sampling distribution pink Sigma sub X bar is the yardstick and the blue critical value is the number of yardsticks so the confidence interval for the mean is Red X bar plus or minus a blue number of pink standard errors this is very important it's the general form for all confidence intervals Point estimate plus or minus critical value Times Standard error so the confidence interval is a range of values centered on the point estimate X bar the lowest value of the interval is X bar minus critical Z times Sigma sub X bar the highest value is X bar plus critical Z times Sigma sub X bar that's why we write a confidence interval as X bar plus or minus critical Z times Sigma sub X bar let me break this down and show you exactly what this is saying here's a sampling distribution remember from video one that the sampling distribution is the distribution of every possible sample mean I've shaded the middle 80 percent that are within 5.28 yards of the mean using our golf example when we draw our sample its mean X bar is a red Point somewhere in this distribution put differently our sample X bar is a random variable having this pink distribution we don't know where it is in the distribution but it has an 80 likelihood of being in the pink area because that's where 80 percent of the sample means are since our sample will be in the pink area eighty percent of the time that means that eighty percent of the time it will be within 5.28 yards of the true population mean mu so if we tick our sample mean X bar and add and subtract the margin of error from it 5.28 yards in this example that will bracket an interval that's 80 likely to include the true population mean mu we don't know mu but it's 80 likely to be in this interval Point estimate minus the margin of error and point estimate plus the margin of error and that's how confidence intervals work there are confidence intervals for many statistics confidence intervals for means for proportions that we'll do later for the difference between means the difference between proportions for the variance or standard deviation for the slope of our regression line and others they all sound like very different things but they're all confidence intervals with this format Point estimate plus or minus critical value Times Standard error the red Point estimate is always the statistic from your sample so all you need to learn is how to find the blue critical value and how to find the pink standard error let's go back to our battery scenario from video one where we're interested in the mean lifetime of 9 volt batteries made at a particular Factory let's construct the confidence interval we already know the point estimate X bar is 382.9 minutes from video one that's our sample mean the red sample statistic and the pink standard error is Sigma sub X bar the standard deviation of the sampling distribution which is the population standard deviation Sigma divided by the square root of the sample size n all these numbers are from video one we get Sigma sub X bar equals 6.1 minutes the blue critical value depends on the desired confidence level in this example we'll use a confidence level of 95 percent now in video one we learned how to use a standard normal table to convert a yellow probability into a blue critical value by finding the probability in the body of the table and noting the associated blue critical value in the margins but be careful because 95 percent is not yellow probability we need to find in the table here's how to find the probability we want the one we'll use in the normal table first make a rough sketch of the PDF of a sampling distribution it'll be bell shaped but it's okay to be sloppy with practice you can do this in your head and you won't even need to make a sketch second put the confidence level 95 percent in the middle of the PDF just make two lines out here shade and label the middle section with the confidence level to denote its 95 percent of the total area or whatever the confidence level is the critical value we want is the z-score associated with this point because if we go up this many standard deviations for the mean and down this many we'll have covered 95 percent of the samples in the sampling distribution remember that the probability associated with the z-score is the cumulative probability up to that z-score and in our example it's not the confidence level 0.95 it's 0.95 plus this tail since the area under the curve equals one the area and the Tails must be one minus the confidence level here it's 1 minus 0.95 which is .05 in inferential statistics this number has a special name it's called alpha or the alpha level we'll talk about Alpha more in video 3 where we'll call it the significance level but since it's right here I wanted to point it out Alpha equals 1 minus confidence level so Alpha and confidence level are complements their sum always equals one since the two tails add up to Alpha and the normal curve is symmetrical each tail represents an area or probability of alpha over two you'll see Alpha over 2 a lot in your textbook and this is why so the yellow cumulative probability up to the blue critical z-score you want to find is confidence level plus Alpha over 2. these two areas since the total area under the curve is one this is the same probability as 1 minus Alpha over two for a 95 percent confidence level the cumulative probability turns out to be 97.5 percent or 0.975 please don't think the z-score is 0.975 the area under the curve represents a probability and we use the normal table to convert back and forth between yellow probabilities and blue z-scores so now we find the blue z-score corresponding to 0.975 I know this is too small to read but it's just like what we did in video One find the probability in the middle then read out to get the z-score here it's 1.96 the critical value for our confidence interval we now have everything we need to construct our confidence interval for the mean battery life Red X bar plus or minus blue critical value times pink standard error 382.9 minutes plus or minus 1.96 times 6.1 minutes so we have 382.9 minutes plus or minus 12.0 minutes 12.0 minutes remember is the margin of error which is critical value times the standard error we State our confidence interval like this we are 95 percent confident that the range 370.9 minutes to 394.9 minutes includes the mean battery life of the batteries produced in this Factory always State the confidence interval as a full sentence in the context of the problem or scenario don't just say 382.9 plus or minus 12. and your sentence include the confidence level do the math to create an actual interval with units and context also the confidence interval sentence should express our confidence in the interval the range of numbers not in the population mean so even though it sounds right we should not say we're 95 percent confident that the population mean lies within this interval rather we'd say or 95 percent confident that the interval contains the population mean I argued with my professor that the two sentences said the same thing but I hope you'll see sooner than I did that it's just more scholarly to make the interval the object of our confidence rather than the population mean in fact the most correct interpretation is to go up one level of abstraction and say that our confidence is in the procedure we used to generate the confidence interval the confidence interval we construct by drawing a sample and doing the math either will or will not contain the population mean but if we follow our sampling procedure over and over to produce 95 percent confidence intervals then we'd expect the intervals to include the means 95 percent of the time that's really what we mean when we express confidence in the interval we constructed I'll demonstrate this shortly with another app from BFW but first I want to look at constructing confidence intervals with different confidence levels when we change the confidence level only the blue critical value will change our sample mean Red X bar doesn't change and neither does the standard error the standard deviation of the sampling distribution the critical value depends on the confidence level and only the critical value changes as the confidence level changes the most common confidence level percentages are 90 95 98 and 99 percent I'll add our memory aid diagram above we put the confidence level percent in the middle of a bell-shaped PDF next we determine the cumulative probability this is the yellow value we'll look up in a normal table to find the blue critical value it's the confidence level in the middle plus one tail which is Alpha over two or equivalently one minus Alpha over 2. up in the header I'll put the memory aid the cumulative probability is shaded yellow when our confidence level is 95 percent this turned out to be 97.5 percent I didn't mention it before but you can start at the confidence level and go halfway to a hundred percent to get to the cumulative probability so starting at 95 percent halfway to 100 is 97.5 percent the cumulative probability for the critical value I want to emphasize that you shouldn't need to memorize these formulas if you understand what's going on to convert a yellow cumulative probability into a critical value we use the normal table here's the memory aid the table tells us the Z value we want the critical value for the confidence interval 1.96 from video 1. here's the confidence interval and the formula red plus or minus blue number of Pinks which is X bar plus or minus critical value Times Standard error when we plugged in the numbers a few minutes ago we got this interval 370.9 to 394.9 minutes now let's quickly do the other confidence levels for a confidence level of 90 percent we put ninety percent in the middle and then add one tail 95 we look up 95 percent or 0.95 in the body of the normal table we did this in video one but I'll do it again here for this one let's look for 0.95 it looks like we're exactly midway between 0.9495 and 0.9505 so read to the left to get 1.6 and read up to get midway between 0.04 and 0.05 so 0.045 this means the critical value Z is 1.645 plug in all three numbers and we get 372.9 to 392.9 minutes we lowered the confidence level from 95 to 90 percent and the confidence interval got narrower this makes sense with the narrower confidence interval or less confident that it includes the true population parameter mu for a confidence level of 98 we have one percent in each tail so the probability corresponding to the critical value is 0.99 the Z value for 0.99 is 2.33 and our interval is 368.7 to 397.1 minutes the range got wider since our confidence level was higher for 99 confidence level the cumulative probability is 99.5 percent when we look up 0.995 in the normal table we get a z value of 2.575 this makes our interval 367.2 to 398.6 minutes as we expect the highest confidence level results in the widest confidence interval you might think we could go a little further and provide a 100 confidence level but let's see what happens when we try with the confidence level of 100 the cumulative probability is also one hundred percent Alpha is zero so the confidence level plus Alpha over two is one hundred percent or one point zero zero zero zero when we try to look up one in the Z table we never find it as Z gets higher and higher the cumulative probability gets closer and closer to one but never reaches it so Z is actually Infinity this makes our confidence interval negative Infinity to positive Infinity not very useful or insightful so a one hundred percent confidence interval would tell us nothing at all about the population we knew the population statistic was between negative infinity and positive Infinity before we drew our sample the most common confidence intervals used are 90 95 98 and 99 but never one hundred percent let me show you a practical demonstration of the confidence interval concept the BFW website has another good app Linked In the description on the right side the black PDF represents the population which for this demonstration is normal with mean mu denoted by the green vertical line these sliders on the left side let us adjust the confidence level and sample size the red dotted line PDF is the sampling distribution whose standard deviation Sigma sub X bar depends on the sample size n larger samples result in narrower sampling distributions here's the sampling distribution when the sample size is 10. and when the sample size is increased to 75 it becomes much narrower we covered this in the last video when I demonstrated the central limit theorem since the central limit theorem tells us that the mean of a sampling distribution mu sub X bar equals the population mean mu the green line also represents mu sub X bar with a confidence level set to 95 percent and the sample size set back to 10 I'll click the green sample button and the app draws a sample of size 10 from the normal population it plots the 10 random variable values here some above the mean some below if it ever looks like fewer than n dots then some are just very near each other the app calculated the mean of the sample that's the black dot for the first example I'm going to paint it red since that's our memory aid color for the sample mean X bar the 10 dots represent our sample and the Red Dot represents the red sample mean X bar and the line segments extending to the right and left of X bar denote the margin of error plus and minus remember the margin of error is for now blue critical Z times pink Sigma sub X bar the app knows the critical value since we told it the confidence level 95 percent and it knows Sigma sub X bar since it knows Sigma and n let me emphasize the interval boundaries with an orange and purple bar so the statement of our confidence level becomes we are 95 percent confident that the range orange to purple includes the population parameter mu and as we'd expect with 95 percent confidence the range does indeed contain mu so if we drew samples over and over and for each sample constructed a 95 confidence interval for the mean we'd expect that the intervals would contain mu 95 percent of the time and not contain mu five percent of the time I'll click the sample 25 button and the app will construct 25 confidence intervals based on 25 new independent samples not all of them fit on the screen and here we can see a confidence interval that does not include the population mean mu the app highlights them by making them red it doesn't mean there was a mistake it just means that sometimes by random chance our sample mean X bar will be further away from the true mean than the margin of error we control how often this happens when we choose the confidence level the critical z-score we look up and use will result in intervals that include the mean X percent at the time where X percent is the confidence level here the app tells us how many confidence intervals we've generated how many hit which is how many include the population mean mu and the hit percent when the sample 25 button is clicked repeatedly the app keeps track of the totals for us here's the result after a thousand samples at a 95 confidence level 947 out of a thousand intervals include Mew a very good simulation the app will let us change the confidence level without redrawing all the samples so watch what happens when I reduce the confidence level to 80 percent the confidence intervals all got narrower and as a result more intervals miss mu now just 80 percent include Mio instead of 95 percent actually 796 out of a thousand the intervals got narrower because the margin of error got smaller since the margin of error equals Blue Times pink when we reduce blue we reduce the margin of error and we reduce the blue critical value by reducing the confidence level like we did here from 95 to 80 percent now I'll drag the confidence level up to 99 percent the confidence intervals got wider because the blue critical value increased and since the intervals are wider they're more likely to include mu for our 1000 samples 990 intervals include mu now before I continue let me recap what I'm demonstrating with this app first the confidence level we choose corresponds exactly to How likely a confidence interval is to include the target Mio in this latest example the confidence level of 99 means that in the long run 99 of confidence intervals will include Mio second the width of the confidence interval the margin of error depends on two factors the stated confidence level since higher or lower confidence levels result in higher or lower values for the blue critical value in the width depends on the sample size higher sample sizes will result in lower values of pink Sigma sub X bar the standard deviation of the sampling distribution so with a confidence level still set at 99 percent I'll increase the sample size to 150 but first note the width of the red sampling distribution this is a review from Video One and as we just said as the sample size increases the sampling distribution gets narrower since the standard deviation of the sampling distribution Sigma sub X bar equals the population standard deviation Sigma divided by the square root of the sample size so here's the sampling distribution for n equals 150 much narrower the app wiped out our 25 samples since the sample size changed so we draw 25 new samples of size 150 and notice that the confidence intervals got narrower but in the long run we still expect 99 to include mu the link to this app is in the description I think you can build your understanding by experimenting with and changing the settings on your own okay let's do a fresh problem this time batteries from a competitor we randomly buy 50 of our competitors batteries and test their lives the sample mean is 368.8 minutes and due to espionage within the battery industry we know that the standard deviation of their mean lives is 55.2 minutes construct a 95 confidence interval for the mean battery life mu pause if you like to do this one on your own it's easy X bar plus or minus critical Z times Sigma sub X bar all confidence intervals are based on the formula that look like this one we're given X bar here critical Z always depends on the confidence level and we can determine Sigma sub X bar from the population standard deviation Sigma and sample size n X bar is 368.8 minutes Sigma sub X bar is Sigma divided by the square root of the sample size 55.2 minutes divided by the square root of 50 equals 7.81 minutes and you might remember that the critical Z value for a 95 confidence level is 1.96 but if not 95 is in the middle plus 2.5 percent in a tail equals 97.5 percent look up 0.975 in a normal table and we get 1.96 I'm skipping the arithmetic to focus on inferential statistics Concepts but we get 353.5 to 384.1 minutes so we are 95 percent confident that the range 353.5 minutes to 384.1 minutes includes the mean battery life of our competitors batteries now let's solve the same problem for a 98 confidence interval only one of our three component numbers will change which one it's the critical Z value it depends on the confidence level the sample mean X bar hasn't changed and the standard deviation of the sampling distribution hasn't changed with a confidence level of 98 we look up 0.99 in the normal table with practice you won't need to draw a sketch look up 0.99 in the normal table and we get a critical Z value of 2.33 we are 98 confident that the range 350.6 to 387.0 minutes includes the mean battery life of our competitors batteries okay another quick variation staying with a confidence level of 98 let's assume the sample size was 100 rather than 50. would you expect the confidence interval to get narrower or wider as the sample size gets larger the standard deviation of the sampling distribution gets narrower we demonstrated this with the app since pink Sigma sub X bar gets smaller the margin of error gets smaller so the confidence interval will get narrower X bar is still 368.8 minutes critical Z is still 2.33 since the confidence level is still 98 percent Sigma sub X bar becomes 55.2 minutes divided by the square root of 100 which is 5.52 minutes so with a sample size of 100 we are 98 confident that the range 355.9 to 381.7 minutes includes the mean battery life of our competitors batteries here's a problem to check our understanding suppose a statistician takes a random sample of 20 planks from a lumber yard measures their length and states that she's 95 percent confident that the average plank length at the lumber yard is between 1.74 meters and 2.10 meters what's the population standard deviation Sigma the statistician used in her analysis this is a contrived problem to shine some light on our understanding of the confidence interval formula we'd probably never back into Sigma like this well all we know is the sample size n equals 20 the confidence level 95 percent and the confidence interval here's the confidence interval formula we know that Sigma sub X bar the standard deviation of a sampling distribution equals the population standard deviation Sigma divided by the square root of the sample size n since we know n once we find Sigma sub X bar we can find Sigma as asked so that's where we're heading we don't know any of these values directly but since the confidence interval is centered on X bar we know X bar must be right between 1.74 and 2.10 meters their average which is 1.92 meters the margin of error is the distance from X bar to either interval endpoint we'll just focus on the right half the margin of error is critical Z times Sigma sub X bar on the diagram it's the distance from X bar to the endpoints of the confidence interval 2.10 meters minus 1.92 meters equals 0.18 meters which is equal to critical Z times Sigma sub X bar as we've seen several times the confidence level 95 percent is associated with the critical value of 1.96 so 1.96 times Sigma sub X bar equals the margin of error 0.18 meters dividing both sides by 1.96 and we have Sigma sub X bar equals .0918 meters since Sigma sub X bar equals Sigma divided by the square root of 20 Sigma must be equal to Sigma sub X Bar times square root of 20. so Sigma equals 0.410 meters which is what we were asked to find so let's check our work by seeing if we can duplicate hers her sample size of 20 planks had a mean length of 1.92 meters she used a value of 0.410 meters as the population standard deviation Sigma her confidence level was 95 percent she created a 95 confidence interval as 1.92 meters plus or minus 1.96 times 0.410 over the square root of 20. this results in the same confidence interval she constructed confidence interval problems can be fast and painless with practice okay we're not quite done because I said earlier that some definitions I provided would need to be refined I said for now let's consider the pink standard error to be the standard deviation of the sampling distribution Sigma sub X bar well Sigma sub X bar is the population standard deviation Sigma divided by the square root of the sample size we showed this with the demo in video One the problem is we almost never truly know what Sigma is for our battery example I told you Sigma was 43.2 minutes but that was just so we could plow through the explanation and get to the confidence interval equation same thing with the competitor's batteries and with the planks the fact is well since the standard deviations calculation is based on subtracting the population mean mu from every random variable in the population we need to know mu in order to determine the standard deviation Sigma so it seems kind of silly to assume we don't know mu but we do know Sigma because knowing Sigma depends on knowing mu so we've hit a snag in order to construct a confidence interval we need to know the standard deviation of the sampling distribution Sigma sub X bar which we could get if we knew Sigma Sigma tells us how spread out the population's random variables are are they bunched up close together are they spread out wide we don't know Sigma so how can we tell well we took a sample and the variation in the sample somehow reflects the variation in the population in fact in video 1 when calculating s the sample standard deviation we divided by n minus 1 instead of n to make s a better estimator of Sigma even so it's not perfect but it's the best we can do so we use the standard deviation of the sample lowercase s divided by the square root of the sample size as a substitute for the standard deviation of the sampling distribution Sigma sub X bar this is an important implication we'll get to shortly but first some vocabulary when we estimate the standard deviation of the sampling distribution using the standard deviation of the sample the estimate is called the standard error of the statistic and since the statistic we're talking about is the mean this estimate is the standard error of the mean it's our best estimate of the standard deviation of the sampling distribution Sigma sub X bar based on the standard deviation of the sample s instead of Sigma the symbol for standard error of the mean is lowercase S Sub X bar you might also see Capital SE sub X bar s e stands for standard error or sem standard error of the mean I'll use lowercase S Sub X bar which can be transliterated as the standard deviation of all possible sample means the formula is s divided by the square root of n as you can see we simply use S instead of Sigma and it's pink because it plays the same role as Sigma sub X bar in the confidence interval formula in the unusual case where we know Sigma we can calculate and use Sigma sub X bar the standard deviation of the sampling distribution in the more common case where we don't know Sigma we calculate and use S Sub X bar the standard error of the mean sometimes these two concepts are collectively called the standard error of the mean that's why in the general confidence interval formula the term is called standard error even though it might mean Sigma sub X bar if you know Sigma for our memory aid they both refer to the pink Factor Now using S instead of Sigma to calculate the standard error has an important implication there is some added uncertainty because the standard deviation of a sample can be different than the standard deviation of the population from which it was drawn even when we divide by n minus 1 instead of n due to the added uncertainty we cannot use the normal table to find critical values we'll use another bell-shaped curve I'll tell you about shortly to use a z value from a normal table as the critical value two things must both be true first the sampling distribution must be approximately normal this constraint isn't so bad as we showed in the video 1 demo when the sample size is greater than or equal to 30 the sampling distribution is pretty close to normal or when the population itself is normally distributed then the sampling distribution will be normal regardless of the sample size so number one is often true but second we must know the population standard deviation Sigma this is the one that almost always trips us up I know I've said this a hundred times but in real life we hardly ever know Sigma but often in tester homework problems you'll be told Sigma to test your ability to do the math using critical Z values so in either of these two conditions is not met we use a different PDF to find the critical value not the normal PDF like we have been doing the curve is called a t curve or t distribution with a lowercase t it's flatter than a normal curve with less probability density in the middle but since it's a PDF it must bound an area of one so more probability density is pushed out into the tails let me show you very simply why we use the t-distribution here's a normal curve to find the critical value corresponding to a particular confidence level we put the confidence level in the middle add the left tail to get the yellow probability we look up in the normal table to get our critical Z value with the t-distribution we do the same thing but there's more probability out in the Tails so when we go through the same procedure the critical T value we get is always larger than the critical Z value for the same confidence level this is to account for the extra uncertainty in using the standard error of the mean as an estimator for the standard deviation of the sampling distribution since the blue critical value is higher the resulting confidence interval will be wider when we know Sigma and so we know Sigma sub X bar and we know the sampling distribution is normal we can use a critical Z value from a normal table and sigma sub X bar to construct our confidence interval otherwise we must use a critical T value and the standard error of the mean to construct the confidence interval which will be wider you may hear the t-distribution called students T and no it's not named after you the statistician that developed it wrote his papers using the pseudonym student one story says his employers didn't want him publishing papers for the competition to read so he hid his identity he used the letter T in his papers to represent variables from this distribution so when others referred to it rather than just calling it t which might be unclear they called it students T and the name has stuck when we have a large sample then the standard error of the mean S Sub X bar is a pretty good estimator of Sigma sub X bar when the sample is smaller not as good with larger samples there's less uncertainty this means we don't need as big an adjustment with the critical T value we use the larger the sample size the closer critical T can be to critical Z because there's not as much uncertainty for t to account for so how do we do that well the fact is the t-distribution is a family of bell-shaped curves each curve is denoted by its DF or degrees of freedom for our purposes DF is equal to the sample size n minus 1. here's the curve for degrees of freedom equals one here's degrees of freedom equals two here's degrees of freedom equals five the higher the degrees of freedom meaning the greater the sample size the closer the T curve gets to a normal Z curve I want to show you a t table of values by comparing it to the normal Z table we've been using which was covered in video one for inferential statistics we have a confidence level plus Alpha over 2 which represents the yellow cumulative probability that we look up in the body of the normal table to find the corresponding blue critical value but the two tables are organized very differently in the Z table the probabilities are in the body of the table and we read out to the margins to find the critical value since the T distribution is a family of Curves there's data for many curves on one chart each row in a t table represents a different degree of freedom and only the most common probabilities used for inferential statistics are included and they're listed across the top then the corresponding critical T value is in the body of the chart each critical value depends on the degrees of freedom and the cumulative probability so the normal Z table has probabilities in the body and critical Z values in the margins and the T table has critical values in the body and probabilities in the top margin let's build our confidence with a problem from a population whose standard deviation we don't know we draw a sample of 13 widgets and measure a continuous random variable such as their Mass what's the critical value we should use to generate a 95 percent confidence interval for the mean okay first we're not being asked to construct a confidence interval not yet we're just being asked what blue critical value we'd use we don't know the population standard deviation Sigma so we can't know the standard deviation of the sampling distribution Sigma sub X bar because Sigma sub X bar equals Sigma divided by the square root of the sample size since we don't know Sigma sub X bar we must estimate it with the standard error of the mean S Sub X bar and when we use S Sub X bar to estimate Sigma sub X bar we'll use T instead of Z to account for the extra uncertainty in using S Sub X bar as a substitute for Sigma sub X bar now this was a detailed explanation of the reasoning to Aid your understanding eventually the thought process simply becomes do you know Sigma then use Z and sigma sub X bar if you don't know Sigma use T and S Sub X bar so let's solve this problem Z and T follow the same steps draw a bell shape put the confidence level in the middle add the left Alpha over two tail and we get 97.5 percent or 0.975 we'll use the T table and find this probability in the top margin we'll find our critical T value in this column to figure out which row to use we need the degrees of freedom which is sample size n minus 1. 13 minus 1 is 12 So reading across the 12 row we get a critical T value of 2.179 note that if we knew the population standard deviation we would use the Z table to determine the critical value and would have found 1.96 as I said earlier critical T scores are higher than corresponding z-scores at the same confidence level as you can see from this column critical T values increase as the sample size decreases again if we knew Sigma sub X bar then the critical Z value would always be 1.96 for this confidence level regardless of the sample size but when we estimate Sigma sub X bar with S Sub X bar the higher values for critical t account for the uncertainty and there's more uncertainty to account for with smaller sample sizes so a sample size is increase critical T will get gradually smaller closer and closer to the critical Z value for the same confidence level let's do another lumber yard plank length problem we measure 17 randomly selected planks at a lumber yard and find their average length is 1.78 meters the variance of the 17 plank lengths is 0.0577 meters squared construct a 90 confidence interval for the average length of all the planks at the lumber yard let's write out our confidence interval formula and see where we stand well X bar equals 1.78 meters so we have one of our three values the method by which we find the other two depends on if we can determine Sigma sub X bar we're told the sample variance but nothing about the variability of the population so we'll need to use the standard error of the mean S Sub X bar as an estimator for Sigma sub X bar and as a result use T critical values instead of Z let's find the critical T value the confidence level we were told to use is ninety percent so the cumulative probability adds one tail of five percent so the probability we'll look up is 95 percent T sub 0.95 the degrees of freedom is the sample size -1 so 16. we get 1.746 now for S Sub X bar it's the standard error of the mean which is s the standard deviation of the sample divided by the square root of the sample size we're told the variance of the sample not the standard deviation don't make the mistake of using variance as standard deviation standard deviation equals the square root of variance so square root of 0.0577 meters squared is 0.240 meters not squared dividing that by the square root of the sample size gives us the standard error of the mean 0.0582 meters we now have everything we need to construct the confidence interval skipping the arithmetic we are ninety percent confident that the range 1.678 to 1.882 meters includes the average length of plancks at the lumber yard we've covered confidence intervals for continuous random variables now we'll go over the confidence intervals for proportions another common population parameter by proportion we mean the proportion or fraction of a population having a particular characteristic here are some examples the proportion of Voters who intend to vote for our candidate the proportion of two liter bottles under filled at a bottling Factory the proportion of fast food orders that include a beverage the proportion of basketball shots made during a game in each case the characteristic is a binary variable that has only two possible states which we call success or failure depending on what we're interested in counting and the proportion is the number of successes in the population divided by the size of the population so proportions are determined by counting not by measuring for our examples a population member having these characteristics is counted a success a population member that doesn't is a failure note that even characteristics that are negative such as an underfilled 2-liter bottle are still called successes with proportions the words success and failure don't mean good and bad they mean what we're counting or not let me start with a chart and we'll begin defining terms the population proportion is denoted by lowercase p and is the number of successes in the population capital x divided by the population size capital n you can think of p as the population average if successes were to count as 1 and failures as zero the proportion of successes in the population so p is also the probability that any randomly chosen member of the population will be a success now for the variance of a population proportion the symbol is Sigma squared the same is for continuous random variables but the expression turns out to be the very simple P times Q where p is the proportion of successes and Q the proportion of failures since every random variable is either a success or failure Q equals 1 minus p let me show you how we get PQ for the variance remember from video 1 that the variance is the average squared distance between each random variable value and the population it's the same for variance of the proportion except there are only two random variable values success in Failure to which we'll assign the values 1 and 0 and we subtract the population proportion p in place of mu for Simplicity let's say our population has 10 members five successes and five failures the proportion P equals x over n the number of successes divided by the population size five successes out of ten equals 0.5 which is the population proportion if there were nine successes and one failure P would be 9 out of 10 or 0.9 here and for one success and nine failures P would be one over ten which is 0.1 now that we can find the proportion P let's find the variance back to the scenario with five successes and five failures P equals 0.5 the variance is the average squared distance between each point and P let's find the sum of all ten squared distances then divide by the population size n to find the average this will be the population variance we'll do the five successes then the five failures each success has the value 1 and P equals 0.5 so this distance is 1 minus 0.5 which is 0.5 we want the squared distances so 0.5 squared is 0.25 and there are five successes so five times 0.25 equals 1.25 for each failure to which we attribute the value 0 the distance is zero minus P which is zero minus 0.5 or negative 0.5 negative 0.5 squared is positive 0.25 and again there are five failures so 5 times 0.25 is 1.25 add them together and the sum of these squared distances is 2.5 to find the average squared distance we divide by the population size n to get 0.25 now let's say p equals 0.6 we have six successes each is point four away from P 6 times 0.4 squared is 0.96 the total squared distance for the six successes we also have four failures 0.6 away from p 4 times 0.6 squared is 1.44 the total squared distance for the Fort failures so the proportion variance Sigma squared is 0.24 one more let's say p equals 0.2 for successes 2 times 0.8 squared is 1.28 for failures 8 times 0.2 squared is 0.32 so the proportion variance Sigma squared is 0.16 now let's review these results when P was 0.5 the variance Sigma squared was 0.25 when P was 0.6 the variance was 0.24 and when P was 0.2 the variance was 0.16 as it turns out for proportions Sigma squared will always equal p times Q the math is the same as for continuous random variables it just turns out to be equal to a very simple expression for the variance of proportions and so the standard deviation of the population proportion Sigma is the square root of P times Q now for the sample statistics the proportion of the sample is denoted by P hat a lowercase p with a hat on top I don't know why X bar has a bar and P hat has a hat maybe some mathematician can tell us in the comments I'm just an engineer and I don't know P hat equals lowercase x divided by the sample size n lowercase x is the number of successes in the sample uppercase X remember is the number of successes in the population the sample variance is labeled s squared just like for continuous random variables its P hat times Q hat where Q hat is the proportion of failures in the sample P hat plus Q hat equals one so Q hat equals one minus P hat the sample standard deviation lowercase s is the square root of P hat times Q hat here's a very important point about the standard deviation of the proportion of the sample it's an unbiased estimator of the population standard deviation Sigma this is different than the standard deviation of the mean of a sample which is biased P hat times Q hat is an unbiased estimator of P times Q this will come up in a moment in order to construct confidence intervals for proportions we need to know the characteristics of the sampling distribution of P hat to determine the pink standard error the sampling distribution of the proportion is comprised of all the possible sample proportions of a particular size the mean of the sampling distribution has the symbol mu sub P which can be transliterated as the mean of all the proportions it's equal to the population proportion P this is just like the mean of the sampling distribution of means mu sub X bar was equal to the population mean mu from video 1. of course we never truly know P which is why we're constructing a confidence interval for it the standard deviation of the sampling distribution has this symbol Sigma sub P just like for means it's the population standard deviation Sigma divided by the square root of the sample size Sigma is the square root of P times Q so pink Sigma sub P equals the square root of PQ over n and just like for continuous random variables we don't know Sigma so again we'll use the sample standard deviation S as an estimator for Sigma so the standard error of the mean becomes square root of P hat times Q hat divided by n remember I said that s was an unbiased estimator of Sigma this means that when we use square root of P hat times Q hat divided by n as an estimator of Sigma sub P we don't have to account for any extra uncertainty so we can use Z instead of T to find the critical value there is a double condition to check for but they're often true I'll go over the condition after we do our first problem but the Practical point is that when constructing confidence intervals for proportions we use Z tables let's do a problem a new student at a large High School notices a lot of left-handed classmates she randomly selects 100 classmates and asks if they are right or left-handed 13 are left-handed construct a 90 confidence interval for the true proportion of left-handed students at the high school here's the confidence interval formula P hat the sample mean as our Point estimate 13 divided by 100 since a left-handed student is counted as a success so 0.13 for the critical value we can use a z-score from a normal table the probability we look up is the given confidence level plus Alpha over 2 which is ninety percent in the middle plus one tail of five percent so the z-score corresponds to 95 percent which is 1.645 and the standard error is the square root of P hat times Q hat over n P hat is point 13 so Q hat must be 0.87 the sample size n equals 100 the square root of 0.13 times .87 divided by 100 is .0336 and we have everything we need to construct the confidence interval where ninety percent confident that the interval 0.0747 to 0.1853 includes the true proportion of left-handed students at the high school easy we'll do another problem after two important notes first a little more on while we don't have to use T for proportions when discussing confidence intervals for means I said the critical value is a z-score only if both of these were true we must know that the sampling distribution is normal and we must know its standard deviation the central limit theorem assures us that the sampling distribution will be very close to normal if the sample size is large enough over 30 but we also need to know its standard deviation Sigma sub X bar then a sigma sub X bar we need to know Sigma since Sigma sub X bar is Sigma divided by the square root of n and we just don't know Sigma we have to use the biased estimator s the sample standard deviation as a substitute which is better than nothing but not good enough to use the narrower normal distribution so we must use the t-distribution to find critical scores for means for proportions the same two criteria apply but the story is a little different let me start with a second condition we must know Sigma sub P the standard deviation of the sampling distribution again it depends on knowing Sigma the standard deviation of the population which we never truly know but the sample standard deviation s is an unbiased estimator of Sigma in fact it's a great estimator and when we use it to calculate the standard error like we did in the left-handedness example there is no additional uncertainty introduced and the criteria is met we have a great estimator of Sigma sub p for the first criteria we need to know that the sampling distribution is normal this is often the case with proportions and we can check it with the double condition I mentioned earlier I'll do a demonstration of these conditions next but assuming they're met the sampling distribution will be very nearly normal and we can determine critical values from the normal Z table and that's why we don't have to use T distributions for proportions here's another app from the BFW webpage Linked In the description the yellow bars show the binomial distribution which is closely related to the concept of proportions let me show you how with these sliders we set the sample size and population proportion which is the same as the probability of randomly choosing a success from the population we'll simulate tossing a coin 40 times and consider heads of success so we set P equal to 0.5 assuming we have a fair coin and N to 40 to simulate 40 coin tosses the yellow bars show the likelihood of different numbers of successes in the experiment as you might expect 20 is right in the middle from 40 tosses we'd expect the number near 20 heads in this region we'd almost never expect to see fewer than 10 or more than 30. that's what the binomial distribution shows us the likelihood of different numbers of successes for particular values of n and p if we were to divide the numbers on the horizontal axis by n which here is 40 then the distribution would be the sampling distribution of the proportion because P hat equals number of successes divided by n so we can recap the numbers from our earlier chart here are all the different values for the sample proportion P hat from 0 to 1. the mean of all the possible samples is Mu sub P hat which equals the population proportion P 0.5 Sigma sub P hat is the standard error the standard deviation of the sampling distribution which is the square root of PQ over n for p equals 0.5 and n equals 40 this turns out to be .079 which is about this length based on the scale of the horizontal axis now I want to show you the double condition to check if we can use the normal distribution to find the critical value the conditions are easy to remember and P hat greater than or equal to 10 and n q hat greater than or equal to 10. since P hat equals number of successes divided by n when we multiply both sides by n we get n p hat equals number of successes and likewise n q hat equals number of failures so the double condition is simply that the sample has at least 10 successes and at least 10 failures here's where that rule comes from as you can see the red normal curve matches the data extraordinarily well and on the average we have 20 successes and 20 failures both greater than or equal to 10. as we reduce P the mountain shape moves to the left at P equals 0.25 there are 10 successes and 30 failures both greater than or equal to 10 and the red normal curve still closely approximate the sampling distribution when the mound gets near the left Edge say p equals .05 the yellow bars become right skewed and the red normal curve no longer fits so well and even gets cut off on the left Edge the normal curve no longer fits the sampling distribution stating the NP hat the number of successes is greater than or equal to 10 pushes us out here ensuring that the sampling distribution is very nearly normal and in Q hat greater than equal to 10 at least 10 failures does the same thing on the right side when both conditions are met we're in the safe Zone and can use Z for our critical value two notes first it's not easy to construct a confidence interval when these conditions are not met if you use the normal approximation you'll get bad results in high school and first year college inferential statistics the conditions will almost always be met but you will be expected to do the checks and state explicitly that np-hat is greater than or equal to 10 and NQ hat is greater than or equal to 10 so you can use the normal approximation of the binomial distribution to find the critical value second Point some instructors and textbooks use a cutoff value of 5 instead of 10 and I've even seen 15. my advice is to agree with your instructor but it may be enlightening to try out this applet yourself and see what you think for different values of n and p let's do another problem a political candidates research team pulls 300 randomly selected voters for a Statewide election 161 voters support the candidate and 139 do not construct a 95 percent confidence interval for the true proportion of Voters who support the candidate first let's check the assumption that we can use the normal curve and P hat and NQ hat are both greater than equal to 10 that is 161 and 139 are both greater than or equal to 10. so we can use the normal curve and table to find the critical value okay we just need to find three numbers P hat equals the number of successes divided by the sample size so P hat equals 161 divided by 300 which is 0.53667 we'll need Q hat too it's 1 minus P hat or 0.46333 their critical Z value for a 95 confidence level is the z-score associated with the probability of 0.975 which is 1.96 and the standard error is the square root of P hat times Q hat divided by n plugging in the appropriate numbers yields a standard error of .02879 well all the hard work is done we just need to compute the range and state the confidence interval we are 95 percent confident that the interval 48.02 percent to 59.31 percent includes the true proportion of Voters who support the candidate since the range includes proportions below 50 percent the candidate cannot be confident that he has a lead even though P hat was 53.557 percent the candidate isn't satisfied and says he wants an estimate with a plus or minus three percent margin of error like he hears on the news what would you tell the candidate to reduce the confidence interval we can either reduce the confidence level which will result in a lower critical value and hence a smaller margin of error or we can increase the sample size the candidate doesn't want to reduce the confidence level so what sample size is needed for a margin of error plus or minus 0.03 we want the margin of error to be less than or equal to three percent or 0.03 so critical value times the square root of P hat times Q hat Over N must be less than or equal to 0.03 we can't change the critical value it's 1.96 based on the confidence level what about P hat and Q hat can we use P hat and Q hat from our first sample well that's a possibility when you don't have any idea what the true proportion is it's customary to set P hat and Q hat both to 0.5 this is the conservative approach that maximizes the standard error so we don't provide a confidence interval narrower than what's appropriate so our equation becomes 1.96 times square root of 0.5 times 0.5 divided by the square root of n is less than or equal to 0.03 I'm Distributing the radical to the numerator and denominator let's isolate n by multiplying both sides by square root of N and then divide both sides by .03 to get n instead of square root of n let's Square both sides and simplify n is greater than or equal to 1067.11 since n must be a whole number we'll need to use 1068. this is actually a real life application posters will often have sample sizes near 1100 to provide relatively small margins of error so for the sake of completeness and to get a little more practice let's repeat the problem with a sample size of 1068. when we conduct this pole we find 550 support the candidate and 518 do not so P hat equals 0.51498 Q hat equals 0.48502 there's no change to the critical Z value since it depends on the confidence level which is still 95 percent and after a little math and square roots the standard error is .01529 here's our confidence interval formula the right term is the margin of error and let's note that it is less than or equal to 0.03 it should be a surprise since we calculated what n should be so that we would have this exact result and our statement becomes we are 95 percent confident that the interval 48.50 to 54.49 percent includes the true proportion of Voters who support the candidate and political coverage you'll often hear P hat plus or minus the margin of error so something like 51.5 percent with a three percent margin of error all confidence intervals have this format Point estimate plus or minus critical value Times Standard error here's a summary chart of the proper values for means and proportions when encountering a confidence interval technique for a new type of statistic just focus on how to determine these values you'll find confidence intervals are quite easy in the next video we'll cover hypothesis tests where we'll learn how to test claims about a population based on a sample