pyhctsa.robust.bf_gauss_mix2

pyhctsa.robust.bf_gauss_mix2(xc, p, delta)

Mixture of two Gaussians fitted to a binned distribution by EM (hctsa BF_GaussMix2).

Fits w1 N(mu1, s1^2) + w2 N(mu2, s2^2) to a histogram/density p on the equally spaced grid xc, by EM on the grid points weighted by the mass p (maximum likelihood for the binned data). Each component’s variance includes delta^2/12, the variance within a bin. The start is deterministic: means at the lower and upper quartiles, weights 1/2, standard deviations that of the distribution. Runs until the log-likelihood changes by less than 1e-10 (at most 1000 iterations).

Parameters:
xc : array-like

Grid points (e.g. bin centers).

p : array-like

Density or counts at each point (non-negative; rescaled to sum to 1).

delta : float

Grid spacing.

Returns:

w, mu, sigma – Length-2 arrays, components ordered by increasing mean.

Return type:

numpy.ndarray