1. Home
  2. Explore
  3. Statistics
  4. Confidence Intervals and Hypothesis Testing

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Confidence Intervals and Hypothesis Testing

Speaker 1Speaker 2

Confidence Intervals and Hypothesis Testing

7:55
0:00-7:55
  1. Anna

    Today we're using simulation to understand confidence intervals, and then we'll introduce hypothesis testing. We'll begin with the simpler situation where the population standard deviation, sigma, is known, and our goal is to estimate the population mean, mu.

  2. Corey

    The general form is a 100 times 1 minus alpha percent confidence interval. The most common choice is 95 percent, but 90, 98.7, or 99 percent are also possible. For a 95 percent confidence interval, 1 minus alpha equals 0.95, so alpha equals 0.05.

  3. Anna

    And the terminology matters. The entire percentage, such as 95 percent, is the confidence level. Alpha is called the level of significance, a term that becomes especially important when we discuss hypothesis testing.

  4. Corey

    We're estimating mu with the sample mean, x bar. In its random-sample form, capital X bar is a statistic and therefore a random variable with a distribution, often called its sampling distribution. It is an unbiased point estimator because the expected value of X bar equals mu: the mean of the sample means is the population mean.

  5. Anna

    A point estimate gives us one value, but an interval estimate gives us a range of plausible values. The confidence interval is centered at the observed sample mean and extends in both directions by a margin of error.

  6. Corey

    When sigma is known, the margin of error is z sub alpha over 2 times sigma divided by the square root of n. The quantity sigma over the square root of n is the standard deviation of X bar, because the variance of X bar is sigma squared over n. It's also often called the standard error, although that term is used inconsistently in statistics.

  7. Anna

    The z subscript tells us about the area to the right under the standard normal curve. Specifically, z sub alpha over 2 leaves an area of alpha over 2 to its right. With alpha equal to 0.05, that right-tail area is 0.025, so z sub 0.025 is approximately 1.96.

  8. Corey

    Equivalently, the area to the left of 1.96 is 0.975. That's why a calculator's inverse normal function would use a cumulative area of 0.975 to find the critical value for a 95 percent interval.

  9. Anna

    Let's make this concrete with a simulation. Suppose we sample from a uniform distribution on the interval from 0 to 10. Its true mean is 5, halfway between the endpoints.

  10. Corey

    For a uniform distribution from a to b, the variance is b minus a, squared, divided by 12. Here that is 10 squared over 12, or 100 over 12, which is 25 over 3, approximately 8.3. The population standard deviation is therefore the square root of 25 over 3, approximately 2.887.

  11. Anna

    Because this is a simulation, we're pretending that we know the true mean, 5, and the true standard deviation, 2.887. We can use a spreadsheet's random-number generator to take repeated random samples of size 10.

  12. Corey

    Each sample produces a different observed sample mean. For example, one sample might have a mean of 5.76. That is one observed value of the point estimator X bar, and repeating the process gives us many different point estimates.

  13. Anna

    Now turn each point estimate into a 95 percent confidence interval. For every sample, calculate x bar minus 1.96 times 2.887 divided by the square root of 10 for the left endpoint, and x bar plus that same quantity for the right endpoint.

  14. Corey

    In one example, the interval was approximately 3.67 to 7.25. It was centered at 5.46, and its margin of error was about 1.79 on either side. Since sigma is treated as known, the margin of error stays the same from sample to sample; x bar changes, so the location of the interval changes.

  15. Anna

    If we generate 100 samples and 100 intervals, about 95 of those intervals should contain the true mean, 5, and about 5 should fail to contain it. In one simulation, roughly 94 contained 5 and 6 did not. That small difference is expected because simulation results vary randomly.

  16. Corey

    This explains the meaning of the confidence level. Before sampling, if we're about to construct a 95 percent interval, the chance that the resulting interval will contain mu is 0.95. But after the sample has been collected and the interval calculated, the randomness is gone, so we generally don't say there is a 95 percent probability that mu is inside that particular fixed interval.

  17. Anna

    Instead, we say we are 95 percent confident in the interval. Looking at the repeated-sampling process, about 95 percent of intervals made by the same method, from the same population and sample size, will contain mu. We cannot know which individual intervals contain mu unless the population mean is already known, as it is in this simulation.

  18. Corey

    And one technical note about the spreadsheet: its numbers simulate randomness, but technically they are often called pseudorandom because they are generated by a nonrandom process. In practice, the generator is generally good enough for this kind of simulation.

  19. Anna

    Now consider the more realistic case where sigma is unknown. Then we replace sigma with the sample standard deviation, S, and replace the z critical value with a t critical value. The interval becomes X bar plus or minus t sub alpha over 2 times S divided by the square root of n.

  20. Corey

    This changes two things. X bar is random because it depends on the sample, and S is also random because different samples have different sample standard deviations. Therefore, unlike the known-sigma case, the margin of error can change from sample to sample.

  21. Anna

    For this confidence interval, the t distribution uses n minus 1 degrees of freedom, so with a sample size of 10 we use 9 degrees of freedom. Degrees of freedom are not always n minus 1 in every statistical problem, but they are n minus 1 in this setting.

  22. Corey

    The t distribution is bell-shaped and centered at zero, like the standard normal, but it is not the same distribution. It is more spread out, has a standard deviation larger than one, and has heavier tails. As the degrees of freedom increase, the t distribution gets closer and closer to the normal distribution.

  23. Anna

    For a 95 percent interval with 9 degrees of freedom, alpha over 2 is 0.025, and the t critical value is approximately 2.262. This is larger than the normal critical value 1.96, reflecting the extra uncertainty created by estimating sigma with S.

  24. Corey

    In the spreadsheet, we would now use the observed sample mean, the observed sample standard deviation, and the formula x bar plus or minus 2.262 times S divided by the square root of 10. The resulting margin of error can be larger or smaller than the known-sigma margin for a particular sample because S itself varies.

  25. Anna

    For example, even though 2.262 is larger than 1.96, a particular sample could have an S substantially smaller than 2.887. In that case, its t-based margin of error might not be larger than the known-sigma margin. Usually the t-based interval reflects the added uncertainty, but the actual result depends on the sample's S.

  26. Corey

    If we repeat this process 100 times using the t formula and the sample standard deviation each time, we again expect approximately 95 percent of the intervals to contain the true mean of 5, with about 5 percent failing to contain it. That repeated-sampling behavior is the central idea behind confidence intervals.

  27. Anna

    So the big picture is this: a confidence interval estimates a population mean by combining a point estimate, a critical value, and a measure of sampling variability. Known sigma leads to a z interval; unknown sigma leads to a t interval with n minus 1 degrees of freedom.

  28. Corey

    And alpha connects confidence intervals to the next topic, hypothesis testing. For now, remember that alpha is the level of significance, while 1 minus alpha is the confidence level, and repeated simulation shows why a 95 percent method captures the true mean approximately 95 percent of the time.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent