flash_factors_fix: Fix flash factors

View source: R/flash_factors_fix.R

flash_factors_fixR Documentation

Fix flash factors

Description

Fixes loadings \ell_{\cdot k} or factors f_{\cdot k} for one or more factor/loadings pairs, so that their values are not updated during subsequent backfits. For a given pair, either the loadings or factor can be fixed, but not both, and either all entries or a subset can be fixed. To unfix, use function flash_factors_unfix. See flash_factors_init for an example of usage.

Usage

flash_factors_fix(
  flash,
  kset,
  which_dim = c("factors", "loadings"),
  fixed_idx = NULL,
  use_fixed_in_ebnm = NULL
)

Arguments

flash

A flash or flash_fit object.

kset

A vector of integers indexing the factor/loadings pairs whose loadings or factors are to be fixed.

which_dim

Whether to fix factors or loadings.

fixed_idx

If fixed_idx = NULL, then all loadings or factor values will be fixed. If only a subset are to be fixed, then fixed_idx should be an appropriately-sized vector or matrix of values that can be coerced to logical. For example, if a subset of loadings for two factor/loadings pairs are to be fixed, then fixed_idx should be a length-n vector or an n by 2 matrix (where n is the number of rows in the data matrix).

use_fixed_in_ebnm

By default, fixed elements are ignored when solving the EBNM subproblem in order to estimate the prior \hat{g}. This behavior can be changed by setting use_fixed_in_ebnm = TRUE. This is a global setting which applies to all factor/loadings pairs; behavior cannot vary from one factor/loadings pair to another.

Value

The flash object from argument flash, with factors or loadings fixed as specified.


flashier documentation built on Oct. 17, 2023, 5:07 p.m.