pylimma.normexp_fit

pylimma.normexp_fit(x, method='saddle', n_pts=None, trace=False)[source]

Estimate parameters of the normal + exponential convolution model.

Faithful port of R limma’s normexp.fit (limma/R/background-normexp.R). The compiled C routines (fit_saddle_nelder_mead, normexp_m2loglik, normexp_gm2loglik, normexp_hm2loglik) are ported to pure NumPy/SciPy in the _normexp_* helpers.

Parameters:
  • x (ndarray) – One array’s worth of foreground intensities.

  • method ({"saddle", "mle", "rma", "rma75", "mcgee", "nlminb", "nlminblog"}) – "saddle" (default): Nelder-Mead on the saddle-point approximation to the log-likelihood. "mle": refine with a trust-region Newton search using the exact log-likelihood. "rma": closed-form estimator via affy::bg.parameters (ported from the affy Bioconductor package). "rma75": closed-form variant of rma from McGee & Chen (2006). "mcgee" aliases "rma75"; "nlminb" and "nlminblog" alias "mle" - matches R’s backward-compatibility mapping.

  • n_pts (int, optional) – Downsample x to n_pts quantile points before fitting.

  • trace (bool) – Ignored (matches R’s stub behaviour).

Returns:

par : ndarray of length 3 = (mu, log(sigma), log(alpha)) m2loglik : float, only present for the saddle / mle paths convergence : int, only present for the saddle / mle paths

Return type:

dict with keys