Skip to contents

Pearson correlations \(r_{ab}=\mathrm{cor}(\hat p_a,\hat p_b)\) across Monte Carlo replicates (and cell types). This is behavioural similarity: two solvers can correlate near 1 while remaining systematically biased. Hierarchical order uses Ward D2 on \(d_{ab} = 1 - r_{ab}\).

Usage

algorithm_similarity(benchmark, facet_rows = NULL, facet_cols = NULL)

Arguments

benchmark

List from run_simulation_benchmark().

facet_rows, facet_cols

Optional scenario columns. When supplied, correlations are computed inside each facet cell.

Value

A tibble with algorithm_x, algorithm_y, correlation, and any facet columns.

Examples

set.seed(1)
genes <- paste0("g", 1:2)
cts <- paste0("ct", 1:2)
mu <- matrix(c(20, 22, 22, 20), nrow = 2, dimnames = list(genes, cts))
Sigma <- array(
  c(1, 0, 0, 1, 1, 0, 0, 1),
  dim = c(2, 2, 2),
  dimnames = list(genes, genes, cts)
)
out <- run_simulation_benchmark(
  tibble::tibble(
    true_theta = list(list(p = c(0.5, 0.5), mu = mu, sigma = Sigma))
  ),
  deconvolution_functions = list(
    "nnls" = list(FUN = deconvolute_ratios_nnls),
    "rlm" = list(FUN = deconvolute_ratios_rlm)
  ),
  n = 4,
  cores = 1
)
algorithm_similarity(out)
#> # A tibble: 4 × 3
#>   algorithm_x algorithm_y correlation
#>   <chr>       <chr>             <dbl>
#> 1 nnls        nnls                  1
#> 2 rlm         nnls                  1
#> 3 nnls        rlm                   1
#> 4 rlm         rlm                   1