Skip to contents

Match factors between two fits by the similarity of their feature effects and report which pairs correspond. Needs the optional psych and clue packages. Tucker congruence on named shared features, with native rectangular assignment and dummy unmatched nodes. Without a threshold all matches are candidates. Correspondence does not establish measurement invariance or activity units. Alignment is Tucker congruence only. For resampling uncertainty use factor_stability().

Usage

factor_replicability(
  reference,
  target,
  feature_map = NULL,
  min_congruence = NULL,
  min_shared_features = 2L,
  allow_sign_flip = NULL
)

Arguments

reference, target

Two native fits with recorded sample side, or two views.

feature_map

Optional character vector mapping reference feature names (names) to target feature names (values), one to one, when the names differ.

min_congruence

Optional Tucker congruence in (0, 1) a pair must exceed to count as matched; equality is unmatched. NULL (default) returns all candidate pairs.

min_shared_features

Minimum shared features needed to compute similarity (default 2); a computational floor, not scientific sufficiency.

allow_sign_flip

TRUE lets a factor match with reversed sign; needs signed support declared on both sides. FALSE forbids flips. NULL (default) allows them exactly when both sides declare signed support.

Value

A replicability_result with $matches (reference factor, target factor, similarity), $similarity_matrix (all pairs) and coverage metadata.

Details

Origin: NEW_ORCHESTRATION / call_only. Credits psych::factor.congruence; clue::solve_LSAP (probe pending); use factor_provenance("factor_replicability") for audited sources and runtime versions. Input units and basis are retained; display/conditional results do not establish biological replication.

See also

factor_stability() for resampling

Author

Mikhael Manurung; William Revelle (psych); Kurt Hornik and Walter Böhm (clue). Full source and dependency credits: https://github.com/mdmanurung/flashier-utils/blob/main/CREDITS.md.

Examples

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)
factor_replicability(view, view, min_congruence = 0.8)$matches
#>   reference_factor target_factor congruence similarity best_similarity sign
#> 1               F1            F1          1          1               1    1
#> 2               F2            F2          1          1               1    1
#>   matched candidate shared_features eligible   status
#> 1    TRUE      TRUE              16     TRUE accepted
#> 2    TRUE      TRUE              16     TRUE accepted