An automated inspection raises an alert on some items, and every alerted item gets a manual review. How often will it alert, how likely is an alerted item to be faulty, how many alerts will ten items produce, and how many minutes of review does an item cost on average? None of these questions has an answer until a model is written down. This lesson specifies one complete model, derives each answer exactly from it, and then asks which answers change when an input or an assumption changes. All rates and times on this page are constructed for illustration.
Key terms
Model specification
Definition A model specification lists everything a probability investigation assumes before it calculates. It names the experiment and its possible outcomes, the events and random variables, the support of each random variable, the numerical inputs, and the assumptions that connect them, such as which events are independent and how repeated items relate to one another. It is complete for a question when every probability and expectation that the question needs is determined by what it lists. Quantities computed from the specification, such as an overall alert rate, are outputs, so they are not free to be chosen separately.
In plain words Write the model down first and calculate second. Every answer that follows is a statement about this model, so it is only as trustworthy as the listed inputs and assumptions, and an assumption left unstated is still an assumption.
Example The inspection model of this page has four parts.
- One item either has a fault or not, and its inspection either raises an alert or not. The events are , the item has a fault, and , the inspection raises an alert, and the sample space consists of the four combinations of or with or .
- The inputs are , and . Both conditional rates are defined because .
- The review time of one item, in minutes, is for a faulty alerted item and for a nonfaulty alerted item. An item without an alert gets no review, so on and the support of is .
- Questions about several items assume that the items are independent copies of the one-item model.
Within one item, fault and alert are dependent on purpose, since an alert is four times as likely for a faulty item as for a nonfaulty one. Independence across items is a separate assumption, and the binomial count of alerts below needs it.
Joint model from conditional rates
Definition Let and be events with , and suppose the inputs are , and . The multiplication rule gives the four joint probabilities, for example and , where . These four numbers are nonnegative and add to , so they determine the probability of every event built from and . The law of total probability over the partition , gives
and when , Bayes’ theorem gives , which is the joint probability divided by .
In plain words The conditional rates describe the faulty group and the nonfaulty group one at a time. Weighting each rate by the probability of its group gives the joint table, and every other probability of the model, including the reverse conditional probability of a fault given an alert, is read from that table.
Example For the inspection model the joint table is below.
| Total | |||
|---|---|---|---|
| Total |
The alert column gives , and
about . An alert raises the fault probability from to about , but a fault is still far from certain. The nonfaulty alert cell is more than twice the faulty alert cell , so of the alert probability, about 69 percent, comes from nonfaulty items. That does not contradict the alert rate of 80 percent among faulty items, which conditions on a different group. The lesson Bayes’ Theorem and Base Rates treats this reversal in detail.
Binomial count of alerts
Definition Let items be independent copies of the one-item model, let be the indicator that item raises an alert, and let . The number of alerts then satisfies , with
for , and and . The mean needs only that each item has alert probability , by linearity of expectation. The binomial probabilities, the variance formula and the product use the independence of the items and can fail without it.
In plain words Each item is one trial whose alert probability, after averaging over faulty and nonfaulty items, is , and independent items make the count binomial. The expected count is a probability-weighted average over possible batches, so it need not be a whole number, while every actual batch has a whole-number count.
Example For ten items, , with and , so . The probability of at least one alert is
No batch shows alerts. The most likely count is , with probability about , followed by , with probability about .
Conditional expected work
Definition Let be the review time of one item, as in the specification. For an event with , the conditional expectation of given is
where the sum runs over the possible values , and . If , the law of total expectation gives
In plain words The same review time can be averaged over two different groups. The conditional mean is minutes per alerted item, and the unconditional mean is minutes per inspected item, with or without an alert. Keep the group with the number, because here the two answers differ by the factor .
Example Among alerted items the fault fraction is and the nonfault fraction is , so
minutes per alerted item. Items without an alert get no review, so and
minutes per item. The joint table gives the same result directly, since . For ten items that each follow the one-item model, linearity gives minutes of review on average, whether or not the items are independent. This is expected work. It is not elapsed clock time or a staffing need, which would depend on parallel reviewers, queues and variable review times that the model leaves out.
Assumption sensitivity
Definition Assumption sensitivity is the way a model’s outputs respond when one input or one assumption is changed and the rest of the specification is held fixed. A sensitivity check recalculates every output under the change and records which conclusions move, by how much, and which stay the same.
In plain words The algebra of a model can be exactly right while its inputs are uncertain. Changing one input at a time shows which answers rest heavily on that input, and changing one assumption shows which answers needed it.
Example Suppose faults are twice as common, with , while both alert rates stay the same. The alert cells become and , so and . The review time per alerted item becomes minutes, and per item it becomes minutes. The inspection itself did not change, yet the meaning of an alert did, because the base rate did.
A change of assumption can matter as much as a change of input. Keep , but suppose instead, as an extreme case of dependence, that ten items always share one alert outcome, so . Each item still has alert probability , so by linearity. But now the count is either or , the probability of at least one alert is instead of about , and the variance is instead of .
Prediction versus simulated output
Definition A prediction is a number derived exactly from the model, such as or the standard error of a planned estimate. A simulated output is the recorded result of one run of a program that generates outcomes from the model. It is one realization of a random quantity whose distribution the model predicts. If an event has model probability , the fraction of independent simulated trials in which it occurs has mean and standard error
An empirical observation, such as a count from a real inspection line, is a third kind of evidence. Agreement between a simulation and the prediction supports the program, not the claim that the inputs describe a real system.
In plain words Exact arithmetic already answers this model’s questions, so here a simulation serves as a check that a program builds the model correctly. A simulated output usually lands within a few standard errors of the prediction, and a much larger gap points to an error in the program or in the calculation. No number of simulated items replaces evidence about real fault and alert rates.
Example A faithful program draws each item’s fault status first and then its alert with probability or according to that status. A program that gives every item alert probability regardless of its fault status matches but makes fault and alert independent, so its fraction of faults among alerts estimates instead of . For this page the faithful protocol was run once for 10,000 items in Python 3.12 with the generator random.Random(20261013). An item was faulty when its first random() draw was below , and it raised an alert when its second draw was below or according to its fault status. The run recorded 2570 alerts, 832 of them on faulty items, and 15,198 review minutes.
| Quantity | Prediction | Simulated output | Standard error |
|---|---|---|---|
| Alert fraction | |||
| Faults among alerts | about | ||
| Review minutes per item |
The first standard error is . For review minutes, , so , and the standard error is . The standard error for faults among alerts is computed given the 2570 alerts, among which each item is faulty independently with probability , so it is . All three outputs lie within two standard errors of their predictions. The conditional fraction rests on only 2570 alerted items, so its standard error is about twice that of the alert fraction. The lesson Simulation Error and Number of Trials develops these standard errors.
Check yourself
- In the original model, find the probability that an item without an alert is faulty. Why is the answer neither nor ?
Show the answer
The no-alert column of the joint table holds for faulty items and for nonfaulty ones, so and
about . The number is , the chance that a faulty item raises no alert, which conditions in the other direction. The number is the joint probability , which has not yet been divided by . A missing alert lowers the fault probability from to about , but not to zero.
- Ten independent items are inspected under the original model. Find the expected number of faulty items that raise an alert and the probability that none of the ten needs a review. Which of the two answers stays valid if the items are dependent but each still follows the one-item model?
Show the answer
Each item is a faulty alerted item with probability , so the expected number of such items is . No review is needed exactly when there are no alerts, and with independent items
The expected value comes from linearity of expectation, which needs only the probability for each item, so it stays valid under dependence. The value multiplies ten probabilities, which uses independence. In the extreme case where all ten items share one alert outcome, the probability that no review is needed is instead.
- Keep and , but improve the inspection so that . Find , , the expected review time per alerted item and per item, and the expected review work for ten items. Why does the review time per alert rise while the expected work falls?
Show the answer
The faulty alert cell stays and the nonfaulty alert cell becomes , so and
about . Per alerted item,
minutes, up from about . Per item, minutes, down from , so ten items need minutes of review on average instead of . There is no contradiction. The change halves the probability of a false alert, from to , and false alerts were the short reviews. Alerts become less frequent overall, and a larger share of them are faults with long reviews. The two averages use different groups, alerted items and all items.