🧮 Brain Teaser

Why the Wavelet Threshold Is σ2log⁡N\sigma\sqrt{2\log N}

In wavelet smoothing (ESL §5.9), we observe a signal on NN equally spaced points:

y=f+ε,ε∼N(0,σ2IN).\mathbf y = \mathbf f + \boldsymbol\varepsilon,\qquad \boldsymbol\varepsilon\sim N(0,\sigma^2 I_N).

We apply an orthonormal wavelet transform y∗=W⊤y\mathbf y^* = W^\top \mathbf y. We then soft-threshold each coefficient at level λ\lambda, which sets every coefficient with ∣yj∗∣≤λ|y^*_j|\le\lambda to zero, and transform back.

A popular default is the universal threshold

λ=σ2log⁡N.\lambda = \sigma\sqrt{2\log N}.

Explain where this number comes from. Consider the pure-noise case f≡0\mathbf f\equiv 0.

(a) Show that the wavelet coefficients y1∗,…,yN∗y^*_1,\dots,y^*_N are i.i.d. N(0,σ2)N(0,\sigma^2).

(b) Show that

P(max⁡j≤N∣yj∗∣>σ2log⁡N)  ⟶  0(N→∞).P\Big(\max_{j\le N}|y^*_j| > \sigma\sqrt{2\log N}\Big)\;\longrightarrow\;0 \qquad (N\to\infty).

So with high probability the universal threshold kills every pure-noise coefficient.

(c) Show the threshold is sharp: for every fixed c<1c<1,

P(max⁡j≤N∣yj∗∣>c σ2log⁡N)  ⟶  1.P\Big(\max_{j\le N}|y^*_j| > c\,\sigma\sqrt{2\log N}\Big)\;\longrightarrow\;1 .

Conclude that max⁡j∣yj∗∣/σ2log⁡N→1\max_j|y^*_j|\big/\sigma\sqrt{2\log N}\to 1 in probability.

Field: Statistics / ML (nonparametric smoothing, extreme values)

Hint: You only need the elementary Gaussian tail bound 1−Φ(t)≤φ(t)t\displaystyle 1-\Phi(t)\le \frac{\varphi(t)}{t} and a matching lower bound of the same order.

waveletssoft-thresholdingGaussian maximaunion boundextreme valuesorthonormal transform

Answer: Why the Wavelet Threshold Is σ√(2 log N)

Key Idea / Intuition

An orthonormal transform rotates white Gaussian noise into white Gaussian noise. So in the wavelet domain, pure noise is just NN independent N(0,σ2)N(0,\sigma^2) draws.

The question then becomes how large the biggest of NN Gaussians is. The Gaussian tail decays like e−t2/2e^{-t^2/2}. The level tt at which you expect about one exceedance among NN tries solves Ne−t2/2≈1N e^{-t^2/2}\approx 1, which gives t≈2log⁡Nt\approx\sqrt{2\log N}.

The universal threshold is therefore exactly the height of the tallest noise spike:

  • Set the threshold slightly higher, and all noise vanishes (by a union bound).
  • Set it slightly lower, by any constant factor, and some noise spikes survive (by independence).

Formal Proof / Solution

(a) Noise stays white.

With f=0\mathbf f=0, we have y∗=W⊤ε\mathbf y^*=W^\top\boldsymbol\varepsilon. A linear image of a Gaussian vector is Gaussian, with covariance

Cov⁡(W⊤ε)=W⊤(σ2I)W=σ2W⊤W=σ2I.\operatorname{Cov}(W^\top\boldsymbol\varepsilon)=W^\top(\sigma^2 I)W=\sigma^2 W^\top W=\sigma^2 I.

Uncorrelated jointly Gaussian variables are independent. Hence yj∗∼iidN(0,σ2)y^*_j \overset{iid}{\sim} N(0,\sigma^2).

From now on, write yj∗=σZjy^*_j=\sigma Z_j with ZjZ_j i.i.d. standard normal, and let tN=2log⁡Nt_N=\sqrt{2\log N}.

Tail bounds. Let φ\varphi be the standard normal density and Φ\Phi its CDF. For t>0t>0 we need an upper and a lower bound on 1−Φ(t)1-\Phi(t).

Upper bound. On x≥tx\ge t we have x/t≥1x/t\ge 1, so

1−Φ(t)=∫t∞φ(x) dx≤∫t∞xtφ(x) dx=φ(t)t.1-\Phi(t)=\int_t^\infty\varphi(x)\,dx\le\int_t^\infty \frac{x}{t}\varphi(x)\,dx=\frac{\varphi(t)}{t}.

Lower bound (for t≥1t\ge1). Integrate only over [t, t+1/t][t,\,t+1/t], where φ\varphi is at least its value at the right endpoint. Since (t+1t)2/2=t2/2+1+12t2\big(t+\tfrac1t\big)^2/2=t^2/2+1+\tfrac{1}{2t^2},

1−Φ(t)≥1t φ ⁣(t+1t)=φ(t)t e−1−12t2≥e−3/2 φ(t)t.1-\Phi(t)\ge \frac1t\,\varphi\!\Big(t+\frac1t\Big)=\frac{\varphi(t)}{t}\,e^{-1-\frac{1}{2t^2}}\ge e^{-3/2}\,\frac{\varphi(t)}{t}.

So 1−Φ(t)≍φ(t)/t1-\Phi(t)\asymp \varphi(t)/t.

(b) The threshold kills all noise.

Apply the union bound, then the upper tail bound with φ(tN)=12πe−log⁡N=12π N\varphi(t_N)=\frac{1}{\sqrt{2\pi}}e^{-\log N}=\frac{1}{\sqrt{2\pi}\,N}:

P(max⁡j∣Zj∣>tN)≤2N(1−Φ(tN))≤2N⋅12π N tN=1πlog⁡N⟶0.P\Big(\max_j|Z_j|>t_N\Big)\le 2N\big(1-\Phi(t_N)\big)\le 2N\cdot\frac{1}{\sqrt{2\pi}\,N\,t_N}=\frac{1}{\sqrt{\pi\log N}}\longrightarrow 0.

(c) Any smaller threshold fails.

Fix c<1c<1 and let sN=c tNs_N=c\,t_N. For large NN we have sN≥1s_N\ge1. Set pN=1−Φ(sN)p_N=1-\Phi(s_N). Since φ(sN)=12πN−c2\varphi(s_N)=\frac{1}{\sqrt{2\pi}}N^{-c^2}, the lower tail bound gives

NpN  ≥  e−3/22π⋅N1−c2c2log⁡N  ⟶  ∞,N p_N\;\ge\; \frac{e^{-3/2}}{\sqrt{2\pi}}\cdot\frac{N^{1-c^2}}{c\sqrt{2\log N}}\;\longrightarrow\;\infty,

because the power N1−c2N^{1-c^2} beats log⁡N\sqrt{\log N}.

Now use independence:

P(max⁡j∣Zj∣≤sN)≤P(Zj≤sN ∀j)=(1−pN)N≤e−NpN⟶0.P\Big(\max_j|Z_j|\le s_N\Big)\le P(Z_j\le s_N\ \forall j)=(1-p_N)^N\le e^{-Np_N}\longrightarrow 0.

Conclusion. Combining (b) and (c), for every c<1c<1,

P(c tN<max⁡j∣Zj∣≤tN)→1,P\big(c\,t_N<\max_j|Z_j|\le t_N\big)\to1,

so max⁡j∣yj∗∣/σ2log⁡N→1\max_j|y^*_j|\big/\sigma\sqrt{2\log N}\to1 in probability.


Why This Is Beautiful

  • One number, two arguments. The "≤\le" direction is a pure union bound and needs no independence at all. The "≥\ge" direction is exactly where independence matters. This is the standard extreme-value pattern for maxima.
  • Orthogonality as a rotation. Part (a) is the reason orthonormal wavelets are so convenient: noise looks the same in every orthonormal basis, while a structured signal concentrates in a few large coefficients. Thresholding then separates the few big signal coefficients from the many small noise ones.
  • The bound is slow. The failure probability in (b) decays only like 1/log⁡N1/\sqrt{\log N}. The universal threshold is conservative: it errs toward killing noise, which is why the resulting reconstructions look visually smooth.
  • Bigger picture. Donoho and Johnstone (1994) showed that soft thresholding at σ2log⁡N\sigma\sqrt{2\log N} attains risk within a factor of about 2log⁡N2\log N of an oracle that knows which coefficients are signal. The same 2log⁡p\sqrt{2\log p} scaling reappears as the natural penalty level for the LASSO in high dimensions.

Difficulty: 2.5 / 5

Reference: Hastie, Tibshirani, Friedman, The Elements of Statistical Learning (2nd ed.), §5.9.1–5.9.2, eq. (5.69), with the universal threshold λ=σ2log⁡N\lambda=\sigma\sqrt{2\log N}. Original source: Donoho & Johnstone, "Ideal spatial adaptation by wavelet shrinkage," Biometrika (1994).

Source: The Elements of Statistical Learning (2nd ed.), Hastie, Tibshirani, Friedman — Section 5.9, eq. (5.69); Donoho & Johnstone (1994)

Type: ML/StatsSource: The Elements of Statistical Learning (2nd ed.), Hastie, Tibshirani, Friedman — Section 5.9, eq. (5.69); Donoho & Johnstone (1994)Edit on GitHub ↗