Convert data to reciprocally symmetrical pairwise matrix
pairwise_ratios.Rd
This function produces a "pairwise ratio matrix" that can be used in tests about asymmetric flows among nodes in a data set (e.g. the "asymmetry" and "diversity" hypotheses; Kling and Ackerly (2021)). The input data set can be an asymmetric matrix with entries representing directed edge weights (e.g. directional flows of wind or genes connecting each pair of populations or "nodes"), or it can be a vector of node attributes (e.g. properties of a site or population, such as genetic diversity).
Value
A square matrix the same size as x
, with ones in the diagonal and reciprocal values in the upper and lower triangles.
If x
is a matrix, the output represents the ratios of above-diagonal to below-diagonal values in x
.
If x
is a vector, the output represents the ratios of every pairwise combination of x
values; e.g. a matrix in which the value of cell [2,4] equals x[2] / x[4].