Transcription
Welcome back. So this is a really cool example I want to walk you through, uh, that relates to quality control and manufacturing. So often times, if you have a factory that is putting out parts or objects, you want to test the quality of the objects being produced. But many times, to actually test the quality, it involves some kind of destructive inspection; you actually have to like test that part to failure, or you have to cut it open and see if it was made right, things like that. So this is, you know, true all across industry. If you think about, um, you know, making composite parts at an aircraft factory, you want to make sure that the quality of those parts is high, and often times, um, you might actually have to test those parts to failure.
Now there is this whole idea of non-destructive inspection, so using things like acoustics to, you know, look inside of a material. But often times, you still do need to destroy um a part to actually test its quality. And so if you have a factory that has produced n total items—so we say total items in a lot, or let's say in a warehouse that you're going to ship or use—and K of those are defective, so n total items produced, K of them are defective, and you want to sample a subset and test them, so we're going to sample R out of the total n items, and out of this sample, M of them happen to be defective. So this is a really, uh, straightforward probability question to ask ourselves: What is the probability that out of M, that out of a sample of R, so what's the probability that um our sample has M defective items, that our samples have M defective items? What is this probability? And so we're going to compute this right now.
Just like before, what we're going to do is we're essentially going to count, uh, you know, how many possible samples of R can I get out of my lot? And then out of those total R samples—total possible samples—how many of the instances of possible random samples would have M defective items, given that there are K defective in the total produced lot? Good. So we're just going to start computing things. Um, so the first thing, uh, I want to do is just say, okay, so we're going to break this into groups. So we're going to say out of our R samples, R is going to equal M defective plus R minus M uh non-defective or healthy, good parts; so M defective and R minus M good. And the total items in the lot n, similarly, n is going to equal K defective plus n minus K; n minus K good parts. Good. So these are going to be the basic, uh, kind of groups that we're going to be sampling from, and we're going to think about how many random samples I can I can, I can come up with.
Now remember we have this idea of, um, if I have random samples where order doesn't matter, without replacement, uh, we're going to use the N choose R, the the combinatorial, uh, kind of N choose R; that's going to be how we count these different random samples. And what we're going to do is basically count up, uh, this probability. I'll do this in pink; I'm going to try to be a little consistent here. So my pink probability P, and P is, um, M defective—M defective in our samples—this is going to equal the total number of ways I can have, uh, I can I can have these samples—these R samples where I have M defectives—divided by the the total number of samples R I could draw from n, period. So, so let's just—I'm just going to write this out; it's going to be, um, uh a little bit more obvious. So I'm going to take—remember we're counting the the number of ways that this event could happen—so the event that in our samples M of them are defective—divided by the total number of R samples I could draw from n, period.
And so I'm going to compute three different, uh, numbers, and we're going to use those to build this probability. So those three numbers: the first one is the total number of ways that I can get, um, like R samples from n total lots is n choose, uh, n choose R. This is the total number of R samples out of N, and again with the assumption that order doesn't matter—it doesn't matter what order I sample these out of the lot—but it is without replacement. If I take one of these samples out, I don't replace it, and just get my my lot gets smaller. So this is, uh, order doesn't matter, does not matter, and we're doing this without replacement. And you'll remember that when order doesn't matter and without replacement, we do n choose R; um, this is n factorial divided by n minus R factorial times R factorial. Okay, that's a simple formula for this, and this this is going to go in the denominator here. So we know that the the probability is the number of ways the event can happen divided by the total number of things that could happen, period. So my denominator is going to have this n choose R.
Now the number of ways that I could get M defective samples out of out of R, there's a couple of things I want to compute here. So first off, I'm going to compute—remember in my samples I have M defective and R minus M good—so M defective are clearly coming from this this group of K defective. So I'm going to draw a little picture here. I have, uh, n total objects in my lot, and I have, let's say, K defective, uh, items, and I'm doing this sample of, um, you know, of R elements here. And so the defective elements of R, these guys here, have to be sampled from K, and the non-defective elements of R have to be sampled from this n minus K non-defective elements of N. And so each of those can be computed is as an order doesn't matter, without replacement, prob, uh, uh combinatorial number of events. So the way that I can get defective elements is K choose M. There are K choose M ways that I can get this group of defective elements from this K total number of defective—this is total, uh, ways of sampling, uh, M defective from K. And similarly, to the number of non-defective elements sampled, uh, here is n minus K choose R minus M. So out of this large group—hopefully large group—of non-defective elements, the n minus K non-defective elements in my total lot, I'm choosing R minus M non-defective elements. And so this is similarly total ways of sampling, uh, R minus M non-defective from n minus K. Okay, so this is, um, a pretty simple idea. We count how many total things can happen—how many total samples of R can I get from n—and then that's the denominator. And the numerator is how many ways can I get this event of M defective samples in out of R? And the total number of M defective samples out of R samples is going to be the product of, you know, I'm sampling R, and there are this many ways of getting this defective population, and there are this many ways of getting the non-defective population. Those are independent, so all of these combinations times all of these combinations is the total number of ways that I can get this event to happen. So this is, uh, K choose M times n minus K choose R minus M. And this is the formula for how likely it is, given that I have a a total lot size of N and K defective items in that big lot; if I sample R samples, this is the probability that I would get M defective elements. Okay, and I want you to slow down and make sure that you catch all of these steps, but the big idea is it's the total number of ways that the event can happen, assuming that these are really random samples and everything is kind of equally likely, then this is the total number of ways that I can have this event of sampling M defective elements out of R samples. It's the product of how how many ways I can get the defective elements and how many ways I can get the non-defective elements out of this larger sample, divided by the total number of things that can happen, which is n choose R. Okay.
Um, and this is a pretty useful formula here. More generally, I'm just going to write down, uh, kind of the general version of this formula: Is if I have, um, let's say I have a number of elements, I have big N equals good elements and bad elements, so big G is good, big B is bad, so, uh, let's say good and bad, and then I sample little n, uh, equals little G plus, uh, little B, the probability of sampling little B bad elements with little n samples out of this distribution is going to be probability equals big G choose little G times big, uh, bad times little bad divided by big N times little, uh, sorry, big N choose little n. So it's big G choose little G times big B choose little B divided by big N choose little n. This is the general, uh, probability way of calculating probabilities if I have a big group of good and bad elements and I'm sampling—how likely is it that I sampled exactly this many good and bad elements with this little n sample? And this turns out to be an important distribution called the multinomial distribution, uh, multinomial distribution, and it's kind of a higher, uh, order, um, analog of the binomial distribution that we've seen a lot in poker hands, and we'll see it all over the place. Super important distribution, um, that you need to be aware of.
Parting thought: Really important—this is how you would compute the likelihood of this event happening—getting M defectives out of a sample of R—but I'm assuming that I know K and M and R and N; I know all of this information to compute this probability, which that's not really the point of quality control in the first place. If I'm doing quality control at a factory, it's because I might want to estimate the number of defective items without destroying all, uh, of my total lot to test them all. So there is this inverse problem that we most likely would like to to ask, which is: Given that I have this small sample of R and I found M defective elements, what is the most likely number of defective elements in the entire lot? So K is often an unknown. What if I don't know K, and it's an unknown quantity? How do I estimate K, or the distribution of K, given this smaller sample? Maybe you would ask a question: How large does R have to be to have 99% confidence in my estimate of K, or to make some other statistical statements? So that's an inverse problem, and for that we use statistics; we actually use data, and we might use Bayes, uh, formula or Bayes' theorem. So that's going to come up later, um, how do we solve this inverse problem of estimating things we don't know from smaller samples? That's a core core tenant of statistics. Okay, thank you.