Skip to main content

Module wsva

Module wsva 

Source
Expand description

Weighted surrogate variable analysis. Port of limma’s wsva (wsva.R).

wsva estimates surrogate variables that capture unwanted variation orthogonal to a known design. It projects the expression matrix onto the residual space of design, takes the leading left singular vectors of the resulting effect matrix, and turns them back into per-array surrogate variables (SVᵀy), each rescaled to unit mean-square.

Two weighting modes are supported, matching R:

  • default — one SVD of the residual-effect matrix yields n_sv surrogate variables at once;
  • weight_by_sd = true — surrogate variables are extracted one at a time, each time row-weighting the effects by their residual standard deviation and appending the new surrogate variable to the working design so the next one is estimated orthogonal to it.

Surrogate variables, like any singular vectors, are defined only up to sign; the returned columns match R’s wsva up to a per-column sign flip. Each output column has unit mean-square (its squared entries sum to narrays).

Functions§

wsva
Compute surrogate variables for y (genes x arrays) given design (arrays x coefficients).