Skip to contents

Provides a helper function for generating indicator matrices

Usage

bradleyterry_from_vectors(winners, losers)

Arguments

winners

vector of strings containing the winner for each observation

losers

vector of strings containing the loser for each observation

Value

sparse Bradley-Terry indicator matrix of type Matrix::dgCMatrix

Examples

winners <- c("k", "k", "l", "m", "m")
losers <- c("l", "m", "m", "k", "l")
Wwl <- bradleyterry_from_vectors(winners, losers)