Fit a frozen RUV factor model from training data
Source:R/singlesample-batch-correction.R
fit_frozen_ruv.RdEstimates latent factors of unwanted variation from empirical negative-control features on training data, then freezes the factor loadings for deployment. This is the frozen-mode extension of RUVSeq (Risso et al., Nat Biotechnol 2014): for a new sample \(x\), the unwanted variation component is estimated via the frozen pseudo-inverse of training latent factors, then subtracted.
If fewer than 5 named control features are found in colnames(X_train),
falls back to the top-30% lowest-variance features as proxy controls, with a
warning.
Usage
fit_frozen_ruv(
X_train,
control_features = NULL,
k = 2:6,
select = c("BIC", "fixed", "explicit")
)Arguments
- X_train
Numeric matrix (samples \(\times\) features). Training cohort.
- control_features
Character vector of feature names expected to be non-cancer-relevant (empirical negative controls). Default = a curated set of stably-expressed serum/plasma miRNAs.
- k
Integer or integer vector (range). Number of unwanted factors to estimate. Default
2:6— BIC selects within this range.- select
Method for selecting
k."BIC"(default),"fixed"(uses the smallest value ink), or"explicit"(ifselectis a single numeric).
Value
Object of class frozen_ruv_fit with components:
feat_mean, full_loadings, latent_train_inv,
k_selected, bics, n_train, p_full,
n_controls.