Choosing an Estimator by Matching Assumptions
A density estimator is not selected by its name alone. Its behavior depends on where the density can be nonzero, how smoothly it varies, and how the estimator represents that variation. A histogram uses local constant pieces, a kernel estimator smooths observations over a bandwidth, and an orthonormal series estimator retains a finite collection of basis functions. Comparing them means matching each method to the assumptions it can use, then balancing approximation error against sampling variability.
Throughout, let \(X_1,\ldots,X_n\) be independent observations from a density \(f\). We compare estimators using integrated squared error (ISE), \(\int (\hat f(x)-f(x))^2\,dx\), and its expectation, the integrated squared-error risk. The examples use densities supported on \([0,1]\). For kernels, boundary correction or an appropriate boundary-adapted construction is assumed: an uncorrected kernel can have substantial boundary bias on this support.
The decomposition explains the main tuning decisions. A small histogram bin width or kernel bandwidth gives a flexible estimate but increases variance. A large bin width or bandwidth reduces variance but can smooth away features of the density. Series estimators face the analogous choice of how many basis terms to retain.
What the Three Methods Assume
For a histogram on \([0,1]\), divide the support into \(m\) equal bins of width \(h=1/m\). In bin \(B_j\), the estimate is the observed proportion in that bin divided by its width. If \(f\) is Hölder smooth of order \(s\), with \(0<s\leq1\), its variation within each bin is at most a constant times \(h^s\). This gives squared approximation error of order \(h^{2s}\); the integrated variance is of order \(1/(nh)\). A histogram is simple and respects known support, but its piecewise constant structure does not exploit smoothness beyond this first-order approximation without further modifications.
A kernel estimator averages rescaled kernel functions centered at the observations. Its bandwidth is \(h\). With a kernel and boundary treatment suited to a density of smoothness \(s\), the usual integrated risk has a squared-bias term of order \(h^{2s}\) and a variance term of order \(1/(nh)\). The smoothness range depends on the kernel’s order and the regularity assumptions; for example, a symmetric second-order kernel can exploit two derivatives. Higher-order kernels may produce negative estimates, so nonnegativity is not automatic.
A series estimator expands the density in an orthonormal basis and retains \(K\) terms. Its variance is typically of order \(K/n\), while its squared projection bias depends on how well the first \(K\) basis functions approximate the density. For a suitable basis and a smoothness class of order \(s\), a common approximation error is \(K^{-2s}\). The basis should reflect the support: a basis on \([0,1]\) is natural for a known compact support, whereas unbounded supports require a construction appropriate to that setting.
Two Risk Calculations
The following derivations make the balance concrete. They also show why the support and smoothness conditions belong alongside the final rate.
Proof. Let \(R(h)=C_1h^{2s}+C_2/(nh)\). Its derivative is $$ R'(h)=2sC_1h^{2s-1}-\frac{C_2}{nh^2}. $$ Setting this equal to zero and multiplying by \(h^2>0\) gives \(2sC_1h^{2s+1}=C_2/n\), hence the displayed \(h_*\). The derivative is negative when \(h^{2s+1}<C_2/(2sC_1n)\) and positive when \(h^{2s+1}>C_2/(2sC_1n)\), so this is the global minimum. At \(h_*\), the derivative equation implies \(C_2/(nh_*)=2sC_1h_*^{2s}\). Thus \(R(h_*)=(1+2s)C_1h_*^{2s}\), which is a constant times \(n^{-2s/(2s+1)}\). \(\square\)
The series version follows the same logic, but the variance increases with the number of terms rather than decreasing with a bandwidth.
Derivation. For real \(K>0\), differentiate \(Q(K)=AK^{-2s}+BK/n\): $$ Q'(K)=-2sA K^{-2s-1}+\frac{B}{n}. $$ The derivative vanishes precisely when \(K^{2s+1}=2sAn/B\). It is negative below this value and positive above it, so the critical point minimizes \(Q\). At that point, \(BK_*/n=2sA K_*^{-2s}\), and therefore \(Q(K_*)=(1+2s)A K_*^{-2s}\), of order \(n^{-2s/(2s+1)}\). In practice \(K\) must be an integer; evaluating nearby integers is safer than assuming rounding is irrelevant when constants matter. \(\square\)
Worked Comparisons
Worked Example: A Histogram for a Lipschitz Density
Suppose \(n=10{,}000\), the support is \([0,1]\), and \(f\) is Lipschitz, corresponding to \(s=1\). Use the simple risk proxy \(R(m)=m^{-2}+m/n\): its first term represents squared histogram approximation error with \(h=1/m\), and its second represents variance. Find the preferred integer number of bins under this proxy.
Treat \(m\) as continuous. Differentiation gives \(R'(m)=-2m^{-3}+1/n\). Setting this to zero yields \(m^3=2n=20{,}000\), so \(m\approx27.14\). Check the neighboring integers:
For \(m=27\), \(R(27)=1/729+27/10{,}000\approx0.00137174+0.00270000=0.00407174\). For \(m=28\), \(R(28)=1/784+28/10{,}000\approx0.00127551+0.00280000=0.00407551\). The proxy is slightly smaller at 27 bins, giving width \(h=1/27\approx0.0370\).
This is a calculation under a stated proxy, not a universal optimal bin count. The true risk constants depend on the density and the precise construction. The order from the balance is \(n^{-2/3}\), since \(s=1\).
Worked Example: Kernel Bandwidth and Series Truncation for a Smooth Density
Now suppose the density on \([0,1]\) has two derivatives and the boundary treatment is adequate. Compare the proxy risks \(h^4+1/(nh)\) for a suitable second-order kernel and \(K^{-4}+K/n\) for a suitable series basis, with \(n=10{,}000\). These are illustrative proxies with unit constants, not claims that the two estimators have identical risk constants.
For the kernel proxy, differentiation gives \(4h^3-1/(nh^2)=0\). Multiplication by \(h^2\) gives \(h^5=1/(4n)=1/40{,}000\), so \(h=(1/40{,}000)^{1/5}\approx0.1201\). The two risk terms are approximately \(0.1201^4\approx0.0002081\) and \(1/(10{,}000\cdot0.1201)\approx0.0008326\). Their sum is approximately \(0.0010407\).
For the series proxy, differentiation gives \(-4K^{-5}+1/n=0\), hence \(K^5=4n=40{,}000\), or \(K\approx8.33\). Check \(K=8\) and \(K=9\): \(Q(8)=1/4096+8/10{,}000\approx0.00024414+0.00080000=0.00104414\); \(Q(9)=1/6561+9/10{,}000\approx0.00015242+0.00090000=0.00105242\). The proxy therefore favors \(K=8\), with risk about \(0.0010441\).
Both choices reflect the same rate \(n^{-4/5}\). Their close proxy values do not establish that one estimator is better in practice: constants, boundary correction, the basis, and the density’s detailed shape can change the comparison.
Worked Example: A Rougher Density Changes the Tuning Scale
Suppose \(f\) is only Hölder smooth of order \(s=1/2\) on \([0,1]\), and \(n=4096\). Under the unit-constant histogram proxy \(h^{2s}+1/(nh)=h+1/(nh)\), the continuous optimum solves \(1-1/(nh^2)=0\). Thus \(h=n^{-1/2}=1/64\), so the matching equal-bin histogram has \(m=64\). Its proxy risk is \(1/64+64/4096=1/32=0.03125\).
For a series proxy \(K^{-1}+K/n\), differentiation gives \(-K^{-2}+1/n=0\). Hence \(K=\sqrt{n}=64\), with proxy risk \(1/64+64/4096=0.03125\). Both choices yield the rate \(n^{-1/2}\), which follows from \(2s/(2s+1)=1/2\).
The calculation illustrates that weaker smoothness calls for coarser resolution than the two-derivative example. It does not show that the histogram and series estimates are interchangeable: the series rate presumes a basis approximation property of order \(K^{-1}\) in squared error, and the histogram calculation presumes the stated Hölder condition. If the chosen basis or the density violates its required approximation assumption, the nominal comparison no longer applies.
How Support and Smoothness Guide the Choice
A practical comparison begins by checking the domain before tuning. If the support is known to be compact, a histogram can align its bins to that support, and a series basis can be chosen for the interval. A kernel estimate on a bounded interval needs boundary treatment or another construction that handles the endpoints. Ignoring this issue can make an interior bias calculation look convincing while the integrated risk is dominated by boundary error.
Next, identify the smoothness claim and what it supports. A first-order histogram approximation is natural for rough or Lipschitz densities. A kernel with suitable order can exploit higher smoothness, while a series estimator can do so when the basis has the corresponding approximation property. In all three cases, the tuning rule balances the bias allowed by that smoothness against variance. For anisotropic or dimension-dependent settings, the corresponding approximation and variance terms must reflect those features; the one-dimensional rates above should not be transplanted unchanged.
Finally, distinguish a rate comparison from a finite-sample risk comparison. The rate records how error scales with \(n\), but omits constants and can conceal substantial differences at a given sample size. The examples used unit-constant proxies to make tuning transparent. Realistic decisions may require validation, prior structural knowledge, or more detailed risk calculations.
Common Pitfall
- Wrong reasoning: “All three methods have rate \(n^{-2s/(2s+1)}\), so I can choose any one and use the same tuning rule.”
- Correction: A shared rate follows only when each method’s assumptions hold: the support and boundary treatment must be appropriate, the kernel must exploit the claimed smoothness, and the series basis must approximate the density at the claimed rate. Also, the tuning quantities differ: \(h\) for histograms and kernels, \(K\) for series. The constants and finite-sample risks need not agree.
Check Your Understanding
For each question, state any support or smoothness assumptions needed for your answer.
- For a risk proxy \(h^{2s}+1/(nh)\), what bandwidth order balances the two terms?
- Why does an uncorrected kernel estimate require special care when the density is supported on \([0,1]\)?
- For a series risk proxy \(K^{-2s}+K/n\), what order of \(K\) gives the usual one-dimensional rate?
- With \(s=1\) and \(n=1000\), calculate the continuous optimal bin count under the proxy \(m^{-2}+m/n\), then identify which neighboring integer gives the smaller proxy.
- Give one reason two estimators with the same asymptotic rate can have different finite-sample risks.