Skip to main content
100%

Kernel Density Estimation

✓ Published0🌍 Public
Mmbostock
Last edited Jun 28, 2019
Created on Dec 20, 2012

This example visualizes the distribution of wait times between eruptions of the Old Faithful geyser, comparing a histogram of 272 observations from R’s `faithful` dataset with a smooth kernel density estimate. The density curve, computed using an Epanechnikov kernel with a bandwidth of 7, reveals the bimodal nature of the data, with peaks around 55 and 80 minutes. The visualization uses d3.histogram for binning, d3.line with curveBasis for the density path, and d3.axisBottom and d3.axisLeft for the axes, rendering in SVG.

AI-generated description

Kernel density estimation is a method of estimating the probability distribution of a random variable based on a random sample. In contrast to a histogram, kernel density estimation produces a smooth estimate. The smoothness can be tuned via the kernel’s bandwidth parameter. With the correct choice of bandwidth, important features of the distribution can be seen, while an incorrect choice results in undersmoothing or oversmoothing and obscured features.

This example shows a histogram and a kernel density estimation for times between eruptions of Old Faithful Geyser in Yellowstone National Park, taken from R’s faithful dataset. The data follow a bimodal distribution; short eruptions are followed by a wait time averaging about 55 minutes, and long eruptions by a wait time averaging about 80 minutes. In recent years, wait times have been increasing, possibly due to the effects of earthquakes on the geyser’s geohydrology.

This example is based on a Protovis version by John Firebaugh. See also a two-dimensional density estimation of this dataset using d3-contour.

gpl-3.0 Licensed

Similar vizzes