Fits a per-gene negative binomial regression over an arbitrary design matrix
using SpaNorm's IRLS engine (iteratively reweighted least squares with
per-gene dispersion estimated by edgeR::estimateDisp). This exposes the
fitting machinery independently of SpaNorm's spatial model: the fitted model
is log(mu) = W %*% t(alpha) with no built-in intercept, so encode one
as a column of W when a per-gene baseline is required. It corresponds to
the internal fit with is.spanorm = FALSE (no shared library-size column,
ridge applied to every column of W).
Arguments
- Y
a genes x cells matrix of counts (dense, sparse, or DelayedArray).
- W
a cells x covariates numeric design matrix.
- idx
a logical vector (length
ncol(Y)) selecting the cells used to fit the model (default: all cells).- lambda.a
a numeric ridge penalty on the columns of
W: a single value or a per-column vector (default 0, i.e. unregularised).- winsor
a numeric, the number of MADs at which per-gene coefficients are winsorised during fitting (default 4). Must be a single positive number;
Infdisables winsorisation entirely.- maxit.psi
a numeric, the maximum number of dispersion iterations.
- maxit.nb
a numeric, the maximum number of NB mean IRLS iterations.
- tol
a numeric, the convergence tolerance.
- ...
additional fitting parameters forwarded to the internal fitter, e.g.
maxn.psi(dispersion-estimation subsample size) orstep.factor(IRLS step-halving factor).- backend
a character, the compute backend ('auto', 'cpu', or 'gpu').
- verbose
a logical, whether to print progress messages (default TRUE).