# freedman_bin_width¶

astropy.stats.freedman_bin_width(data, return_bins=False)[source]

Return the optimal histogram bin width using the Freedman-Diaconis rule

The Freedman-Diaconis rule is a normal reference rule like Scott’s rule, but uses rank-based statistics for results which are more robust to deviations from a normal distribution.

Parameters: data : array-like, ndim=1 observed (one-dimensional) data return_bins : bool (optional) if True, then return the bin edges width : float optimal bin width using the Freedman-Diaconis rule bins : ndarray bin edges: returned if return_bins is True

$\Delta_b = \frac{2(q_{75} - q_{25})}{n^{1/3}}$
where $$q_{N}$$ is the $$N$$ percent quartile of the data, and $$n$$ is the number of data points [1].