Scott histogram bin estimator. The binwidth is proportional to the standard deviation of the data and inversely proportional to the cube root of data size (asymptotically optimal). Parameters ---------- x : array_like Input data that is to be histogrammed, trim
(x, range)
| 98 | |
| 99 | |
| 100 | def _hist_bin_scott(x, range): |
| 101 | """ |
| 102 | Scott histogram bin estimator. |
| 103 | |
| 104 | The binwidth is proportional to the standard deviation of the data |
| 105 | and inversely proportional to the cube root of data size |
| 106 | (asymptotically optimal). |
| 107 | |
| 108 | Parameters |
| 109 | ---------- |
| 110 | x : array_like |
| 111 | Input data that is to be histogrammed, trimmed to range. May not |
| 112 | be empty. |
| 113 | |
| 114 | Returns |
| 115 | ------- |
| 116 | h : An estimate of the optimal bin width for the given data. |
| 117 | """ |
| 118 | del range # unused |
| 119 | return (24.0 * np.pi**0.5 / x.size)**(1.0 / 3.0) * np.std(x) |
| 120 | |
| 121 | |
| 122 | def _hist_bin_stone(x, range): |