A11 · Lesson 42 · Detection
Choosing the threshold that makes the fewest mistakes
An optical receiver sees either no light (a 0) or a pulse of 1 V (a 1), plus noise. Where should it set the threshold between them? Halfway seems obvious, and it's right if 0s and 1s are equally common. If 1s are rare, the best threshold moves up. A radar faces the same choice with no way to know how often targets appear, so it fixes how many false alarms it can live with and catches as many targets as that allows. Both are applications of Bayes' rule (lesson 5) to a continuous measurement, and both give error rates you can compute with the Q function.
- The two curves are the received voltage's density for a sent 0 and a sent 1, each weighted by how often that symbol is sent. Noise has standard deviation σ.
- Drag the threshold . The shaded areas are the two kinds of mistake; the readout adds them into the error rate.
- Make 1s rare. Where do the weighted curves cross now? Put the threshold there and compare the error rate with the halfway threshold.
Predict
A receiver gets 0 V or 1 V plus noise of σ = 0.2 V. Only 10% of the bits are 1s. Where should the threshold go?
A little above, at about 0.59 V. Since 0s are nine times as common, a reading near the middle is more likely to be a 0 with extra noise than a 1 with less. Moving the threshold up trades a few more missed 1s for many fewer 0s misread as 1s, and the error rate falls from 0.62% to 0.34%.
Name it
Decisions and their errors
A receiver measures and decides between hypotheses (a 0 was sent, no target) and (a 1, a target). Its two kinds of mistake:
- false alarm: deciding when is true, probability ;
- miss: deciding when is true, probability ; the detection probability is .
These are the type I and type II errors of lesson 38. With priors and , the overall error rate is .
The minimum-error rule
To make as small as possible, decide whichever hypothesis has the larger posterior. By Bayes' rule that means comparing with , the weighted curves in the sim. Equivalently, decide when the likelihood ratio exceeds the prior odds against it:
With equal priors this is maximum likelihood: pick the hypothesis that best explains .
On-off signaling in Gaussian noise
For 0 or plus Gaussian noise σ, the rule becomes a threshold on :
With equal priors, and . Antipodal signaling, , puts the levels apart and gives , the result of lesson 41.
Neyman–Pearson: fixed false alarms
A radar can't know how often targets appear, and false alarms have a cost of their own. So it fixes and maximizes . For a target of amplitude in Gaussian noise, set the threshold at where ; then
Plotting against as the threshold moves gives the receiver operating characteristic (ROC), the standard picture of a detector's quality.
Worked example
A receiver gets 0 or 1 V with noise σ = 0.2 V, and 10% of the bits are 1s. Find the best threshold and compare its error rate with a threshold at 0.5 V.
Show the solution
- Best threshold.
- Error rate there.
- At 0.5 V. Both tails are , so .
- Compare. The better threshold cuts errors by 44%.
Answer the best threshold is 0.588 V, with an error rate of 0.00345 against 0.00621 at 0.5 V.
Worked example
A radar wants per look and . What signal-to-noise amplitude ratio does it need?
Show the solution
- Threshold from the false-alarm rate.
- Detection. For , means
- Solve for the ratio. or 15.6 dB.
- The cost. Low false alarm rates are expensive: the threshold has to sit almost five noise widths up.
Answer it needs , or 15.6 dB.
Worked example
Bits of 0 and 1 V are equally likely, with noise σ = 0.2 V. What threshold minimizes errors, and what error rate results?
Show the solution
- Threshold. With equal priors and equal noise, the best threshold is halfway, 0.5 V.
- Distance in standard deviations. Each symbol is 0.5 V from it:
- Error rate.
- A better signal. On–off signaling wastes power compared with ±0.5 V, which gives the same distance between levels with half the average power.
Answer the threshold is 0.5 V, and the error rate is 0.0062.
Check
On-off signaling uses 0 and 1 V, with Gaussian noise σ = 0.2 V and equal priors. What is the error rate with the best threshold?
Check
On-off signaling with levels 0 and 1 V, noise σ = 0.2 V, and a fraction 0.2 of 1s. Where is the minimum-error threshold?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
Check
1s make up a fraction 0.25 of the bits. A minimum-error receiver decides 1 when the likelihood ratio exceeds what?
Check
Antipodal signaling uses ±0.5 V with noise σ = 0.2 V and equal priors. What is the error rate?
Check
A detector sets its threshold at 3.09σ. A target arrives with amplitude 4σ. What is the detection probability?
Check
A detector's threshold is 3σ above the noise's mean. What is its false alarm rate?
Check
On–off bits of 0 and 1 V, equally likely, with noise 0.2 V.
(a)
Where is the best threshold?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
(b)
What is the error rate?
Check
Levels 0 and with noise , where the 1 has prior probability .
Step 1
Where is the minimum-error threshold?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Check
Levels 0 and 1 V, noise σ = 0.2 V, and a 1 sent with probability 0.1. Search thresholds from 0.3 to 0.9 V in steps of 0.0001 for the lowest error rate , and set T_best; set T_formula to .
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Explain why
Why should the threshold move toward the less common symbol's level?
A reading near the middle could be either symbol pushed there by noise. The question is which is more likely, and that depends on how often each is sent as well as on the noise. If 0s are much more common, there are many more 0s being pushed up toward the middle than 1s being pushed down. So a middling reading is more probably a 0, and the boundary where the two explanations are equally likely, the best threshold, sits closer to the 1 level.
Practice
Keep practicing
10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.