morphogen.analysis.power_laws¶
Power-law tails of samples: maximum likelihood with the lower bound of the tail chosen by the Kolmogorov-Smirnov distance (Clauset, Shalizi & Newman 2009).
A sample follows p(x) ~ x^-a above x_min. For continuous values the estimate is
a = 1 + n / sum ln(x_i / x_min), of standard error (a - 1) / sqrt(n); for
integers (degrees, counts), p(x) = x^-a / zeta(a, x_min) (Hurwitz’s zeta), the
likelihood maximized numerically, of standard error 1 / sqrt(n (zeta''/zeta -
(zeta'/zeta)^2)). Unless given, x_min is the value of the sample that minimizes the
largest distance between the empirical distribution of the tail and the fitted law, among
those that leave at least min_tail values in the tail.
- class morphogen.analysis.power_laws.PowerLawTail(exponent: float, x_min: float, n_tail: int, error: float, ks: float, discrete: bool)[source]¶
Bases:
objectThe tail
p(x) ~ x^-exponentof a sample abovex_min: itsn_tailvalues, the standard error of the exponent and the Kolmogorov-Smirnov distance of the fit.
- morphogen.analysis.power_laws.CANDIDATES = 400¶
Largest number of lower bounds of the tail tried (quantiles of the sample beyond it)
- morphogen.analysis.power_laws.power_law_tail(values, *, x_min: float | None = None, discrete: bool = False, min_tail: int = 10) PowerLawTail[source]¶
The power-law tail of a sample (see the module): its exponent by maximum likelihood above
x_min, given or chosen by the Kolmogorov-Smirnov distance among the values that leave at leastmin_tailof them in the tail (at mostCANDIDATESof them, quantiles of the sample).discrete: integer values (at least 1), the lawx^-a / zeta(a, x_min).