Skip to contents

precise_stability() asks whether a fused structure is sensitive to the particular relatedness matrices you chose. It consumes a typed matrix collection, repeatedly fuses selected whole-matrix subsets, and returns the resulting replicate consensuses as another typed tibble.

Usage

precise_stability(
  data,
  scheme = "loo",
  fusion = "mean",
  params = list(),
  replicates = 100,
  type = NULL,
  seed = NULL,
  verbose = TRUE
)

Arguments

data

A typed tibble from precise_dist, precise_transform, precise_graph, or precise_fusion, or a named list of matrices with type= declared.

scheme

"loo" (default) or "bootstrap".

fusion

One fusion-registry method to use for every replicate. Defaults to "mean".

params

Flat list of parameters for the single fusion method, e.g. list(trim = 0.1) when fusion = "trimmed_mean".

replicates

Whole number of bootstrap replicates. Ignored by scheme = "loo".

type

Only for bare-list input: "distance" or "similarity". Must be omitted for typed tibble input.

seed

Optional whole-number seed for stochastic schemes.

verbose

TRUE or FALSE.

Value

A typed tibble with one row per fused replicate and one full-set reference row. The first columns mirror the PreciseDist object idiom: distance, metric, matrix, type, time_taken_seconds. Additional provenance columns record role, scheme, fusion, replicate, inputs, parameters, and meta.

Details

This is metric-set sensitivity, not observation-level inference: no rows, columns, cells, or raw input values are resampled or perturbed. Every result is conditional on the candidate matrix set supplied to the function.

The default scheme = "loo" is deterministic leave-one-metric-out: fuse the full set once, then fuse the set with each matrix omitted once. scheme = "bootstrap" samples whole matrices with replacement before fusing each replicate. Use precise_correlations on the returned tibble to compare each replicate consensus with the role = "reference" row.

Examples

x <- replicate(6, rnorm(30))
rownames(x) <- paste0("r", seq_len(nrow(x)))

d <- precise_dist(x, dists = c("euclidean", "manhattan", "cosine"),
                  verbose = FALSE)
d <- precise_transform(d, to = "distance")

s <- precise_stability(d, scheme = "loo", verbose = FALSE)
s$distance
#> [1] "reference"          "loo_drop_euclidean" "loo_drop_manhattan"
#> [4] "loo_drop_cosine"