osdyn.stats.distribution

Module Contents

Functions

best_fit_distribution(data, bins=200, ax=None, dist_type='bell')

Model data by finding best fit distribution to data.

make_pdf(dist, params, size=10000)

Generate distributions's Probability Distribution Function

Attributes

path

osdyn.stats.distribution.best_fit_distribution(data, bins=200, ax=None, dist_type='bell')[source]

Model data by finding best fit distribution to data.

Adaptated from https://stackoverflow.com/questions/6620471/fitting-empirical-distribution-to-theoretical-ones-with-scipy-python

Parameters
  • data (xarray.DataArray, numpy.ndarray) – Values from which an histogramm is plotted.

  • bins (integer, list or numpy.ndarray, optional) – [Number of] intervals along x-axis. The default is 200.

  • ax (axes of plot of the histogram, optional) – To add the fitted distribution on the histogram. The default is None.

  • dist_type (str or list, optional) – Name of the predefined DISTRIBUTION lists or list of the scipy.statsdistribution. The default is “bell”.

Returns

  • list – names of the distribution.

  • list – parameters of the distributions.

  • list – standard error (increasing order) of the distributions compared to the histogram.

osdyn.stats.distribution.make_pdf(dist, params, size=10000)[source]

Generate distributions’s Probability Distribution Function

Parameters
  • dist (scipy.stats.method) – Distribution name.

  • params (tuple) – (a, b, loc, scale). Shape parameters of the distribution, loc and scale parameters to shift and/or scale the distribution.

  • size (int, optional) – Length of the curve. The default is 10000.

Returns

pdf – Distribution curve along its abscissa.

Return type

pandas.Series

osdyn.stats.distribution.path[source]