:mod:`km3pipe.stats` ==================== .. py:module:: km3pipe.stats .. autoapi-nested-parse:: Statistics. .. !! processed by numpydoc !! Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: km3pipe.stats.loguniform km3pipe.stats.rv_kde km3pipe.stats.hist2d Functions ~~~~~~~~~ .. autoapisummary:: km3pipe.stats.mad km3pipe.stats.mad_std km3pipe.stats.drop_zero_variance km3pipe.stats.param_names km3pipe.stats.perc km3pipe.stats.resample_1d km3pipe.stats.bootstrap_params km3pipe.stats.param_describe km3pipe.stats.bootstrap_fit km3pipe.stats.bincenters .. data:: log .. py:class:: loguniform(low=0.1, high=1, base=10, *args, **kwargs) Bases::class:`scipy.stats.rv_continuous` Loguniform Distributon .. !! processed by numpydoc !! .. py:class:: rv_kde(data, bw=None, bw_method=None, bw_statsmodels=False, **kde_args) Bases::class:`scipy.stats.rv_continuous` Create a `scipy.stats.rv_continuous` instance from a (gaussian) KDE. Uses the KDE implementation from sklearn. Automatic bandwidth, either from the statsmodels or scipy implementation. .. !! processed by numpydoc !! .. method:: pdf(self, x) .. method:: rvs(self, *args, **kwargs) Draw Random Variates. :Parameters: **size: int, optional (default=1)** .. **random_state_: optional (default=None)** .. .. !! processed by numpydoc !! .. function:: mad(v) MAD -- Median absolute deviation. More robust than standard deviation. .. !! processed by numpydoc !! .. function:: mad_std(v) Robust estimate of standard deviation using the MAD. Lifted from astropy.stats. .. !! processed by numpydoc !! .. function:: drop_zero_variance(df) Remove columns from dataframe with zero variance. .. !! processed by numpydoc !! .. function:: param_names(scipy_dist) Get names of fit parameters from a ``scipy.rv_*`` distribution. .. !! processed by numpydoc !! .. function:: perc(arr, p=95, **kwargs) Create symmetric percentiles, with ``p`` coverage. .. !! processed by numpydoc !! .. function:: resample_1d(arr, n_out=None, random_state=None) Resample an array, with replacement. :Parameters: **arr: np.ndarray** The array is resampled along the first axis. **n_out: int, optional** Number of samples to return. If not specified, return ``len(arr)`` samples. .. !! processed by numpydoc !! .. function:: bootstrap_params(rv_cont, data, n_iter=5, **kwargs) Bootstrap the fit params of a distribution. :Parameters: **rv_cont: scipy.stats.rv_continuous instance** The distribution which to fit. **data: array-like, 1d** The data on which to fit. **n_iter: int [default=10]** Number of bootstrap iterations. .. !! processed by numpydoc !! .. function:: param_describe(params, quant=95, axis=0) Get mean + quantile range from bootstrapped params. .. !! processed by numpydoc !! .. function:: bootstrap_fit(rv_cont, data, n_iter=10, quant=95, print_params=True, **kwargs) Bootstrap a distribution fit + get confidence intervals for the params. :Parameters: **rv_cont: scipy.stats.rv_continuous instance** The distribution which to fit. **data: array-like, 1d** The data on which to fit. **n_iter: int [default=10]** Number of bootstrap iterations. **quant: int [default=95]** percentile of the confidence limits (default is 95, i.e. 2.5%-97.5%) **print_params: bool [default=True]** Print a fit summary. .. !! processed by numpydoc !! .. py:class:: hist2d(H2D, *args, **kwargs) Bases::class:`scipy.stats.rv_continuous` Simple implementation of a 2d histogram. .. !! processed by numpydoc !! .. attribute:: H_pad .. attribute:: integral .. attribute:: area .. function:: bincenters(bins) Bincenters, assuming they are all equally spaced. .. !! processed by numpydoc !!