Skip to contents

Fix or unfix a named native factor side

Usage

fix_factors(
  fit,
  factors,
  side,
  ids = NULL,
  use_fixed_in_ebnm = NULL,
  action = "fix",
  sample_side = NULL
)

Arguments

fit

Native fit with recorded sample side.

factors

Required factor IDs.

side

activity or effects.

ids

Optional sample/feature IDs for partial fixing; NULL fixes every entry of the side.

use_fixed_in_ebnm

Native handling of fixed values in prior estimation.

action

fix or unfix; native unfix operates on the selected pair.

sample_side

Explicit rows or columns for a bare native fit.

Value

New native fit retaining named factor identity.

Details

Origin: WRAPPER / call_only. Credits flash_factors_fix; flash_factors_unfix; use factor_provenance("fix_factors") for audited sources and runtime versions. Input units and basis are retained; display/conditional results do not establish biological replication.

Author

Jason Willwerscheid; Peter Carbonetto; Wei Wang; Matthew Stephens. Full source and dependency credits: https://github.com/mdmanurung/flashier-utils/blob/main/CREDITS.md.

Examples

if (FALSE) {
set.seed(3)
X <- tcrossprod(matrix(rnorm(48), 24, 2), matrix(rnorm(32), 16, 2)) +
  matrix(rnorm(384, sd = 0.2), 24, 16)
dimnames(X) <- list(paste0("s", 1:24), paste0("g", 1:16))
fit <- fit_ebmf(X, "rows",
  max_factors = 2, seed = 4, verbose = 0,
  ebnm_fn = list(ebnm::ebnm_normal, ebnm::ebnm_point_laplace),
  nullcheck = FALSE, backfit = TRUE, feature_scale = "simulated_centered_intensity"
)
view <- standardize_factors(fit)
fixed <- fix_factors(fit, "F1", "effects")
factor_effects(fixed, factors = "F1", features = "g1")
}