Function vector_bin_size_freedman (o2scl)¶
-
template<class vec_t>
double o2scl::vector_bin_size_freedman(size_t n, vec_t &v)¶ Optimal bin size using the Freedman-Diaconis rule for the first
n
elements
-
template<class vec_t>
double o2scl::vector_bin_size_freedman(vec_t &v)¶ Optimal bin size using the Freedman-Diaconis rule.
This function computes the optimal bin size \( \Delta_b \) of a histogram using the expression
\[ \Delta_b = \frac{2\left(q_{0.75}-q_{0.25}\right)}{n^{1/3}} \]where \( q_{i} \) is the \( i \) quantile of the data (note this is quantile not quartile). This function sorts the vector in order to obtain the result.From [Freedman81].
Note
If
n
is less than or equal to 1, this function returns 0.0 without calling the error handler.