Skip to contents

This function creates the difference operator matrix for differencing ranked vector elements such that the resulting vector is negative.

Usage

M(ranking)

Arguments

ranking

A numeric vector of the ranking in decreasing order.

Value

A matrix of dimension length(rank)-1 x length(rank).

Examples

x <- c(-1, 5, 10, 2)
ranking <- order(x, decreasing = TRUE)
M(ranking) %*% x
#>      [,1]
#> [1,]   -5
#> [2,]   -3
#> [3,]   -3