Formula used
Density height: Density = Bin weighted frequency ÷ (Total weighted frequency × Bin width)
Relative frequency: Bin frequency ÷ Total frequency
Bar area: Density × Bin width. A complete density histogram has total bar area approximately equal to 1.
How to use this calculator
- Paste numeric observations into Dataset 1, then add comparison datasets when needed.
- Optionally upload a CSV file, add weights, filter values, or manage outliers.
- Select an automatic rule, custom count, custom width, or manual boundaries.
- Choose density, frequency, percentage, relative, or cumulative chart modes.
- Add KDE, normal, rug, mean, median, quartile, mode, or standard-deviation overlays.
- Create the histogram, inspect warnings, verify totals, and export the chart or tables.
Worked example
Eighteen sample measurements are grouped into equal-width intervals. Each density height divides weighted frequency by total weight and bin width. This makes bar area comparable across bins of differing widths.
| Example values | Suggested method | Useful overlay | Expected check |
|---|---|---|---|
| 4.2 through 9.2 | Freedman–Diaconis | KDE and mean line | Total density area ≈ 1 |
Understanding density histograms
A density histogram represents a distribution using bar area rather than raw height. Wider bins therefore need lower heights when they contain equal probability. This approach supports fair comparisons between unequal interval widths.
Bin selection changes how strongly patterns appear in the chart. Too few bins may hide clusters, gaps, or asymmetry. Too many bins can exaggerate random sample variation substantially.
Sturges works well for moderate, roughly regular sample distributions. Scott uses standard deviation, while Freedman–Diaconis uses the interquartile range. Doane adjusts Sturges when noticeable sample skewness is present.
A kernel density estimate offers a smooth distribution view. Bandwidth controls whether that curve looks detailed or broadly smoothed. Always compare smoothing choices against the underlying histogram and sample.
The normal overlay is a reference, not a normality test. Strong departures may indicate skewness, multiple groups, or unusual tails. Formal conclusions require context and suitable statistical diagnostics too.
Weighted observations are useful when each value represents several cases. The calculator uses weights for density, totals, and weighted percentiles. Negative weights are rejected because probability mass cannot be negative.
Outlier removal should never become an automatic reporting habit. Extreme values may contain errors, but they can also be meaningful. Keep original data available and explain every cleaning decision clearly.
Comparison charts work best when datasets share identical bin boundaries. Shared bins make bar heights and shapes directly comparable visually. Separate bins may reveal detail but weaken direct visual comparison.
Frequently asked questions
What makes a histogram a density histogram?
Its bar heights are scaled so each bar area represents probability, and all bar areas total approximately one.
Which automatic bin method should I choose?
Freedman–Diaconis is robust for many datasets, while Sturges is simple and Doane can help with skewed samples.
Can bins have unequal widths?
Yes. Manual boundaries support unequal widths, and density scaling keeps their bar areas meaningful.
Why is the density bar height greater than one?
Density is not probability by itself. A narrow interval can have height above one while its area remains below one.
Should I remove outliers?
Only with a defensible reason. Review errors, context, and sensitivity before excluding extreme observations.
What does KDE bandwidth control?
Small bandwidths reveal more local detail, while large bandwidths create smoother and broader curves.
Can I compare weighted and unweighted datasets?
Yes, but label them clearly because weights change density and summary statistics.
Why does total area differ slightly from one?
Rounding, excluded values, zero weights, or a restricted plotting range can cause small differences.
Is a histogram enough to prove normality?
No. It is an exploratory view and should be combined with diagnostic plots, tests, and subject knowledge.