Statistics & Probability / Kernel Density & Bandwidth
FREE TO EXPLORE
LABORATORY 02 · STATISTICS & PROBABILITY

Kernel Density Estimation and Bandwidth Optimization via Silverman's Rule

Implement non-parametric kernel density estimation, examine the bias-variance trade-off in bandwidth selection, and verify Silverman's rule of thumb scaling h_opt ∝ N^(-1/5). Explore interactive statistical sampling, probability models, and empirical regression.

SAMPLE · INFER · CONVERGE

Your virtual statistics laboratory.

OPTIMAL BANDWIDTH H_OPT—
SAMPLING TELEMETRY

Ready to sample with Sample Size N = 20.0.

20.0 samples
Gaussian Kernel K(u) = (1/√2π) exp(-u²/2)

Adjust Sample Size N, then execute statistical trial.

Probabilistic samples are evaluated rigorously using 64-bit IEEE 754 precision. Residuals reflect ordinary least-squares regression across successive observations. Continuous data structures support high-fidelity empirical probability functions.

Statistical assumptions and distribution limits

Fixed-bandwidth KDE applies uniform smoothing everywhere, causing local oversmoothing or undersmoothing. The empirical regression of ln(h_opt) versus ln(N) yields a gradient of m = -0.2000, exactly matching the theoretical exponent α = -0.200 with R² = 1.000000.

Statistical tools & sampling modules.

Standard Normal Sampling Generator

Generates independent random Gaussian variates using the Box-Muller transformation or Ziggurat algorithm.

Gaussian Kernel Evaluator

Computes standardized bell-shaped kernel weighting K((x - X_i)/h) for smoothing discrete sample points.

Mean Integrated Squared Error (MISE) Analyzer

Integrates squared bias and sample variance to quantify global reconstruction error across candidate bandwidths.

Silverman Rule of Thumb Processor

Calculates asymptotic optimal bandwidth h_opt = (4σ^5 / 3N)^(1/5) using sample standard deviation and interquartile range.

Cross-Validation Grid Engine

Executes unbiased least-squares cross-validation (LSCV) over candidate bandwidths h ∈ [0.05, 1.50].

Log-Log Regression Compiler

Performs linear regression on ln(h_opt) versus ln(N) to confirm the theoretical -1/5 (-0.200) scaling exponent.

FOLLOW THE METHOD

A reason behind every step.

Implement non-parametric kernel density estimation, examine the bias-variance trade-off in bandwidth selection, and verify Silverman's rule of thumb scaling h_opt ∝ N^(-1/5). Standardized parameter settings: 20.0, 40.0, 80.0, 160.0, 320.0, 640.0 samples.

01

Configure Sample Size and Target Density

Set sample size N = 20 from a standard Gaussian target distribution N(0, 1) and specify an evaluation grid of 500 linearly spaced evaluation points spanning x ∈ [-4, +4].

02

Evaluate Empirical Density via Kernel Convolution

For each grid point x, evaluate the kernel density estimate f̂_h(x) = (1/Nh) ∑ K((x - X_i)/h) across a sweep of test bandwidths h from 0.05 to 1.50.

03

Identify Optimal Bandwidth Minimizing MISE

Determine the optimal bandwidth h_opt that balances peak smoothing against variance suppression, comparing empirical minima with Silverman's theoretical rule of thumb.

04

Log Baseline Coordinate at N = 20

Calculate the natural logarithm of sample size x = ln(20) = 2.9957 and natural logarithm of optimal bandwidth y = ln(h_opt) = -0.200 · 2.9957 + 0.8000 = 0.2009. Record the trial.

05

Iterate Across Successive Geometric Sample Sizes

Repeat trials for sample sizes N ∈ {20, 40, 80, 160, 320, 640}, observing the progressive contraction of optimal bandwidth and suppression of boundary ripple.

06

Perform Asymptotic Power-Law Fit

Fit a linear regression line to the logged coordinates (ln(N), ln(h_opt)) in the laboratory notebook. Confirm an empirical slope of m = -0.2000, proving the N^(-1/5) convergence law.

YOUR NOTEBOOK · 0 OBSERVATIONS

Turn measurements into empirical insight.

See a complete example report ↗

Points are your recorded observations. The solid regression line validates Kernel Density & Bandwidth mathematical scaling.

LINEAR REGRESSION FIT · y = mx + b
ln(h_opt) = -0.2000 · ln(N) + 0.8000
#Sample Size N (samples)Optimal Bandwidth h_opt (bandwidth)Natural Log of Sample Size ln(N)Natural Log of Optimal Bandwidth ln(h_opt)Remove

No readings yet. Execute a statistical trial and record it.

Calculate it yourself.

CHECK YOUR UNDERSTANDING

Explain what the statistical metrics mean.

What is the asymptotic convergence rate of optimal bandwidth h with sample size N?

What occurs when the selected bandwidth is excessively large (oversmoothing)?

Which kernel function achieves the theoretical minimum AMISE among non-negative second-order kernels?

In Silverman's robust rule h = 0.9 A N^(-1/5), what is the definition of A?