pyhctsa.robust.bf_ks_density

pyhctsa.robust.bf_ks_density(y, xi=None, h=None)

Gaussian kernel density estimate with an explicit bandwidth (hctsa BF_KSDensity).

Evaluates f(x) = mean_i N(x; y_i, h^2) exactly (no binning, no truncation of the kernel). The default bandwidth is Silverman’s rule with a robust scale, h = s*(4/(3n))^(1/5), s = median(|y - median(y)|)/0.6745 (s = std(y) if the median absolute deviation is zero; if that too is zero, h, xi and f are NaN).

Parameters:
y : array-like

The data (NaNs are ignored).

xi : array-like, optional

Evaluation points (default: 100 equally spaced points from min(y) - 3h to max(y) + 3h).

h : float, optional

Kernel bandwidth (standard deviation of the Gaussian kernel).

Returns:

  • f (numpy.ndarray) – The density estimate at xi.

  • xi (numpy.ndarray) – The evaluation points.

  • h (float) – The bandwidth used.

Return type:

Tuple[ndarray, ndarray, float]