pyrfu.pyrf.optimize_nbins_2d module#

pyrfu.pyrf.optimize_nbins_2d.optimize_nbins_2d(x, y, n_min: list | None = None, n_max: list | None = None)[source]#

Estimates the number of bins for 2d histogram that minimizes the risk function in [1] , obtained by direct decomposition of the MISE following the method described in [2] .

Parameters:
  • x (xarray.DataArray) – Input time series of the first variable.

  • y (xarray.DataArray) – Input time series of the second variable.

  • n_min (array_like, Optional) – Minimum number of bins for each time series. Default is [1, 1]

  • n_max (array_like, Optional) – Maximum number of bins for each time series. Default is [100, 100]

Returns:

  • opt_n_x (int) – Number of bins of the first variable that minimizes the cost function.

  • opt_n_y (int) – Number of bins of the second variable that minimizes the cost function.

References

[1]

Rudemo, M. (1982) Empirical Choice of Histograms and Kernel Density Estimators. Scandinavian Journal of Statistics, 9, 65-78.

[2]

Shimazaki H. and Shinomoto S., A method for selecting the bin size of a time histogram Neural Computation (2007) Vol. 19(6), 1503-1527