nessai.utils.stats
==================

.. py:module:: nessai.utils.stats

.. autoapi-nested-parse::

   Utilities related to statistics.

   ..
       !! processed by numpydoc !!


Functions
---------

.. autoapisummary::

   nessai.utils.stats.effective_sample_size
   nessai.utils.stats.rolling_mean
   nessai.utils.stats.weighted_quantile


Module Contents
---------------

.. py:function:: effective_sample_size(log_w)

   
   Compute Kish's effective sample size.


   :Parameters:

       **log_w** : array_like
           Log-weights.



   :Returns:

       float
           The effective sample size.











   ..
       !! processed by numpydoc !!

.. py:function:: rolling_mean(x, N=10)

   
   Compute the rolling mean with a given window size.

   Based on this answer from StackOverflow:         https://stackoverflow.com/a/47490020

   :Parameters:

       **x** : :obj:`numpy.ndarray`
           Array of samples

       **N** : int
           Size of the window over which the rolling mean is computed.



   :Returns:

       :obj:`numpy.ndarray`
           Array containing the moving average.











   ..
       !! processed by numpydoc !!

.. py:function:: weighted_quantile(values, quantiles, log_weights=None, values_sorted=False)

   
   Compute quantiles for an array of values.

   Uses the Harrell-Davis quantile estimator.

   :Parameters:

       **values** : array_like
           Array of values

       **quantiles** : float or array_like
           Quantiles to compute

       **log_weights** : array_like, optional
           Array of log-weights

       **values_sorted** : bool
           If the values are pre-sorted or not



   :Returns:

       np.ndarray
           Array of values for each quantile.




   :Raises:

       ValueError
           If the effective sample size is not finite.







   ..
       !! processed by numpydoc !!

