Main content
Statistics and probability
Course: Statistics and probability > Unit 11
Lesson 1: Introduction to confidence intervalsConfidence interval simulation
Confidence interval simulation.
Want to join the conversation?
- Is the simulation software available to students? If so, can you share a link? Thanks -(13 votes)
- does anyone have a link to the simulation? The one I found doesn't work at all(3 votes)
- There was an "Oh noes!" error in the simulation, so I made a spin-off and resolved the problem. Here's my spin-off:
https://www.khanacademy.org/computer-programming/confidence-interval-simulation/6551818275962880(5 votes)
- Can we calculate the confidence level, even when the distribution of the proportions is not normal ( there are fewer than 10 expected successes) ?(4 votes)
- I'm reading a scientific article with results formatted as follows
mean = 7·7 (SD = 5·4), placebo 9·0 (6·0); effect size -1·2, (95% CI -2·3, -0·1), p = 0·037)
How do I interpret this?(3 votes) - this was very helpful(2 votes)
- why is standard error of sample proportion and confidence interval useful?(2 votes)
- The standard error (otherwise called as confidence interval) of sample proportion is used to estimate population proportion. If you find the 99% confidence interval (0.45 to 0.66 for example) from a sample proportion, it says that the population proportion is between that interval (0.45 to 0.66).(1 vote)
- Is there a notes version of this topic some where? I cant follow along well enough to take notes on this, and if there isnt one, could you please make one?(2 votes)
- This is not correct. The size of the horizontal bars should change depending on the phat. Is that not how we derived SE in the previous video (erroneously I feel).
Why are the horizionatal confidence bars same size -- looks like it was based on the std.dev of population which we claimed in the previous video we do not know.(1 vote)- The intervals are not the same length. Take a screenshot of the video when the intervals are displayed and measure a few of them and you'll see they vary. Not by much, but look at it this way: 0.6 * 0.4 = 0.24, while 0.5 * 0.5 = 0.25. That's not much of a difference, especially after you plug into the standard error formula.(2 votes)
- I know that you can use 80% as a confidence level but why would you because it does not have the, uh, ability to, um, get most of the confidence interval? Sorry if that's confusing.
Also wouldn't it just be better to use a 100% confidence level?(1 vote)- The only way to get 100% confidence is to survey the entire population. The error depends on the sample size. When n becomes larger and larger, the error is close to 0.(1 vote)
- Suppose we wanted a different confidence interval, like 80% or 99%. What would we change in our formula? The methodology we've seen so far seems locked in at 95%.(1 vote)
- 95% confidence interval means that you go 2 SE's (standard errors) below and 2 SE's above your sample mean. In another way - you are constructing an interval between z-scores of -2 and 2 (remember the empirical rule, or 68-95-99.7 rule). If you want to construct an interval for any other percentage you should find z-values, difference of which will give you desired percentage. Simplified formula is [sample mean - z-score * SE; sample mean + z-score * SE].(1 vote)
Video transcript
- [Instructor] The goal of this video is to use this scratch pad on Khan Academy that was written by Khan
Academy user Charlotte Allen, in order to get a better intuitive sense of confidence intervals. So here we're dealing
with a gumball machine where a certain proportion of the gumballs are going to be green. And so let's say we can set that on it. Let's make that 60% of
the gumballs are green. But let's say someone else comes along and they don't actually know the proportion of gumballs that are green, but they can take samples. And so let's say they take
samples of 50 at a time, and so they draw a sample. The sample proportion right over here, actually just happened to be 0.6, but then they could draw another sample. This time the sample proportion is 0.52 or 52% of those 50 gumballs happened to be green. Now you could say, all right, well, these are all different estimates. But for any given estimate, what, how confident are we that the, a certain range around that estimate actually contains the true
population proportion? And so if we look at
this tab right over here, that's what confidence
intervals are good for. And in a previous video, we talked about how you calculate
the confidence interval. What we wanna do is say, well, there's a 95% chance, and we get that from
this confidence level, and 95% is the confidence
level people typically use. And so there's a 95% chance that whatever our sample proportion is that it's within two standard deviations of the true proportion. Or that the true proportion
is going to be contained in an interval that are
two standard deviations on either side of our sample proportion. Well if you don't know
the true proportion, the way that you estimate
the standard deviation is with a standard error, which we've done in previous videos. And so this is two standard
errors to the right and two standard errors to the left of our sample proportion. And our confidence interval
is this entire interval, going from this left
point to this right point. And as we draw more samples, you can see it's not obvious, but our intervals change depending on what our actual sample proportion is. Because we use our sample proportion to calculate our confidence interval because we're assuming
whoever's doing the sampling does not actually know the
true population proportion. Now what's interesting here, about this simulation, is that we can see what
percentage of the time does our confidence interval, does it actually contain
the true parameter? So let me just draw out
25 samples at a time. And so you can see here that right now, 93% of our, for 93% of our samples, did our confidence
interval actually contain our population parameter. And we can keep sampling over here and we can see the more
samples that we take, it really is approaching that close to 95% of the time, our confidence interval does indeed contain the true parameter. And so once again, we did all that math in the previous video, but here you can see
that confidence intervals calculated the way that
we calculated them, actually do a pretty good job of what they claim to do. That if we calculate a confidence interval based on a confidence level of 95%, that it is indeed the case that roughly 95% of the time, the true parameter, the
population proportion will be contained in that interval. And I could just draw more
and more and more samples and we can actually see that happening. Every now and then, for sure, you get a sample where even when you calculate
your confidence interval, the true parameter, the
true population proportion is not contained. But that is the exception,
that happens very infrequently. 95% of the time, your
true population parameter is contained in that interval. Now another interesting thing to see is, if we increase our sample size, our confidence interval
is going to get narrower. So if we increase our sample size, we'll just make it 200. Now let's draw some samples. Notice, now our confidence
intervals are narrower, but still because our confidence level, which was used to
calculate these intervals, is still 95%, when we draw a bunch of samples, we are still going to get roughly 95% of the time our confidence intervals contain our true population proportion. But roughly 5% of the time, they don't.