pylimma.wsva

pylimma.wsva(y, design, n_sv=1, weight_by_sd=False, plot=False, *, array_weights=None, weights=None, block=None, correlation=None, **kwargs)[source]

Weighted surrogate variable analysis.

Port of R limma’s wsva (Yifang Hu and Gordon Smyth, 2015-2017). Returns an n_arrays x n_sv matrix of surrogate variables.

When weight_by_sd=True, the algorithm is iterative and each iteration weights rows by their residual SD. When plot=True, a screeplot of the singular-value spectrum is produced via matplotlib (lazy import).

array_weights, weights, block, and correlation are threaded through to .lmEffects as R’s wsva does via ... (wsva.R:1, lmEffects.R:1). weights aliased as array-weights (length n_arrays) is promoted to array_weights to match R’s lmEffects.R:52-56.

Return type:

ndarray

Parameters: