arviz_stats.base.array_stats.kde

Contents

arviz_stats.base.array_stats.kde#

array_stats.kde(ary, axis=-1, circular=False, grid_len=512, **kwargs)#

Compute KDE on array-like inputs.

Parameters:
aryarray_like
axisint, sequence of int or None, default -1
circularbool, default False
grid_lenint, default 512
**kwargs

Additional keyword arguments passed to the underlying KDE implementation. Depending on whether circular is True or False, supported arguments include:

  • bwint, float, or str, optional

    The bandwidth or the method to estimate it. Options include “scott”, “silverman”, “isj”, “experimental”, or “taylor” (if circular). Defaults to “experimental” (or “taylor” if circular).

  • bw_fctfloat, optional

    A multiplier for bw to tune smoothness manually. Defaults to 1.

  • adaptivebool, optional

    If True, uses an adaptive bandwidth. Not compatible with circular KDE. Defaults to False.

  • extendbool, optional

    If True, extends the observed range for linear KDE. Defaults to False.

  • extend_fctfloat, optional

    Number of standard deviations to widen bounds if extend is True. Defaults to 0.5.

  • bound_correctionbool, optional

    Whether to perform boundary correction on linear bounds. Defaults to True.

  • custom_limslist or tuple, optional

    Custom bounds for the range of ary. Defaults to None.

  • cumulativebool, optional

    If True, returns the CDF instead of the PDF. Defaults to False.

Returns:
grid, pdf, bwarray_like

grid and pdf will have the same shape: the same as ary minus the dimensions in axis plus an extra dimension of length grid_len. Same for bw except it will not have the extra dimension.