collapse_prediction {socceR}R Documentation

Create a matrix to collapse tournament predictions to ranks

Description

Creates a matrix to collapse the rows of a tournamewnt prediction matrix

Usage

collapse_prediction(ranks = c(1, 2, 3, 4, 8, 16, 32))

Arguments

ranks

An integer vector of R ordered elements giving the cut offs of the ranks to create

Details

Returns a vector of numeric values. Elements in the input factor that cannot be converted to numeric will produce NA.

Value

Returns a numeric matrix with R rows and T columns that can be multiplied on a square prediction matrix to obtain the collapsed predictions

Author(s)

Claus Ekstrom ekstrom@sund.ku.dk

Examples


m2 <- matrix(c(.5, .5, 0, 0, .5, .5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), 4)
# Collapse into ranks 1, 2, and 3+4
collapse <- collapse_prediction(c(1, 2, 4))

collapsed_prediction <- collapse %*% m2
collapsed_prediction


[Package socceR version 0.1.1 Index]