list2concordance: Convert list to concordance matrix

list2concordanceR Documentation

Convert list to concordance matrix

Description

Convert list to concordance matrix

Usage

list2concordance(x, naValue = NA, makeSigned = TRUE, verbose = FALSE, ...)

Arguments

x

list of named numerical vectors, where the sign (positive or negative sign) indicates directionality, and is used to calculate concordance, which is a measure of the agreement of the overall set of directions shared between each pair of vectors.

naValue

value passed to jamba::rmNA() used to replace any NaN values in the output matrix. The NaN values result when a pair of vectors has no shared non-zero named entry.

makeSigned

logical indicating whether to force the vectors in the input list x to contain only values c(-1,0,1), by calling base::sign().

verbose

logical indicating whether to print verbose output.

...

additional arguments are passed to list2imSigned().

Details

This function calculates pairwise concordance using Kruskal concordance coefficient (ref) using the following equation:

  • (number_agree - number_disagree) / (total_shared)

The equation is applied to each pair of named vectors in the input list x, and reflects the degree of agreement in direction (+ or -) between shared named elements, with +1 being perfect concordance (agreement), and -1 being perfect discordance (disagreement.) Values of zero indicate equal agreement and disagreement, and therefore reflect no concordance nor discordance. Values of NA occur when no named entries are shared.

This function calls list2imSigned() to produce a signed incidence matrix, which is then used with base::crossprod() to calculate the full matrix of values.

See Also

Other jam list functions: colors_from_list(), im2list_dep(), im2list(), imSigned2list_dep(), imSigned2list(), list2imSigned(), list2im()

Examples

set.seed(123);
l123 <- lapply(jamba::nameVector(1:3), function(i){
   jamba::nameVector(
      sample(c(-1,-1,0,1), replace=TRUE, size=15),
      letters[1:15]
   )
});
list2concordance(l123);

# observe the signed incidence matrix
list2imSigned(l123);


jmw86069/jamenrich documentation built on Feb. 3, 2024, 12:40 p.m.