There are two known generating components in this simulation. The displayed peak count is a smoothing-dependent visual diagnostic, not a component-count estimate or a significance test.
Try this
- Change only the bin origin. Track the orange observation rug: every object stays in place, even when apparent peaks move.
- Compare the undersmoothed and oversmoothed presets. A narrow bandwidth exposes sample noise; a broad bandwidth can merge real populations.
- Return to a middle ground and increase n. New objects extend the same cached sample; the generating population is unchanged.
Truth versus an estimate
The known population is a mixture: 60% Normal(−0.8, 0.352) and 40% Normal(0.9, 0.352), representing two illustrative stellar-colour populations. The teal curve is this true density, not a fit. The sample can show more or fewer apparent bumps than there are components.
Histogram area is probability
A bin of width w containing c of n observations has height c/(nw). Its area is c/n. Edges are aligned at (integer + origin) × w and extended to include every observed value, so the complete histogram has area 1. Shifting origin by one whole width returns the same partition. The shared histogram uses left-closed bins, with the final right edge included; R's default hist uses right-closed bins. Exact edge observations can therefore change bins between implementations, but no mass is lost.
A KDE is a normalized sum of kernels
For bandwidth h, the estimate is p̂(x) = (1/n) Σ φ((x−xi)/h)/h. Each Gaussian kernel integrates to one on the real line. Small h produces roughness; large h can hide true structure. There is no universal bin count or bandwidth.
The browser evaluates the Gaussian sum directly on an 801-point display grid, instead of R density()'s binned FFT approximation. It computes the probability outside the finite view by summing Gaussian lower and upper tails, not grid integration or subtraction from a rounded value of one. The histogram is fully in view, but Gaussian kernel tails extend to infinity. Neither the KDE nor the true population is renormalised to the window. Exceptionally tiny tail probabilities can underflow to zero in floating-point arithmetic.
What the peak count does not say
The counter finds local maxima on the displayed grid and ignores heights at or below 2% of its maximum. It depends on bandwidth, sample noise, grid resolution and the finite viewport. It has no uncertainty estimate and is not a formal test for astrophysical subpopulations. Its value may differ slightly from R's 512-point approximate KDE.
The browser caches 1,000 observations for each seed. All three smoothing controls reuse those exact values; changing n selects a prefix. Reset restores the default seeded sample. The shared browser RNG is not R's RNG, so an identical seed number does not give identical individual observations.