aylmer (version 1.0-7)

as.pairwise: Convert a results matrix to a board

Description

Given a square matrix giving the results of pairwise comparisons, return a board object whose rows show the results of the comparisons.

Usage

as.pairwise(x)

Arguments

x
A square matrix

Details

With x an $n$-by-$n$ square matrix, the rows and columns each correspond to one of $n$ competitors. The $(i,j)$-th entry the number of times competitor $i$ beats competitor $j$ (the leading diagonal holds NAs because a competitor can't play himself).

Function as.pairwise() turns this into a $n(n-1)/2$-by-$n$ matrix whose rows each correspond to a pairwise comparison. Any row has exactly two non-NA entries, in columns $i$ and $j$, that correspond to elements $(i,j)$ and $(j,i)$ of x. Thus the entry in column $i$ is the number of times competitor $i$ beats competitor $j$; and the entry in column $j$ is the number of times competitor $j$ beats competitor $i$.

See Also

aylmer.test

Examples

Run this code
a <- matrix(rpois(25,4),5,5)
rownames(a) <- letters[1:5]
colnames(a) <- letters[1:5]
as.pairwise(a)

Run the code above in your browser using DataCamp Workspace