muranks {crank}R Documentation

Complete a matrix of rankings

Description

Fills an incomplete matrix of rankings with means of unallocated ranks

Usage

 muranks(x,allranks=NULL,rankx=FALSE)

Arguments

x A vector or matrix of rankings that may contain ties and NAs. Objects ranked are assumed to be columns and ranking methods rows.
allranks An optional list of all ranks that might have been allocated. Defaults to the unique values in x.
rankx Whether to apply the rank function (see Details).

Details

muranks assumes that the values in x are rankings with values in the set allranks or if that is NULL, between 1 and the number of columns or values in x. If any values in x are outside this range, or if the missing ranks are not sequential, the function will drop that row with a warning.

For each row, the function finds the mean of those ranks in allranks that were not allocated and substitutes that value for any missing values in the row.

If rankx is TRUE, each row is passed to rank. This will convert competition ranks or any set of numbers to the usual mean rankings. This will also override the rejection of rows in which the missing ranks are not sequential, and may produce counterintuitive imputed ranks.

Value

A matrix similar to x in which any NAs are replaced by the mean of unallocated ranks for each row.

Author(s)

Jim Lemon

See Also

meanranks,rank

Examples

 # simulate ranking from the top with variable completion
 x<-matrix(NA,nrow=10,ncol=10)
 for(i in 1:10) {
  nx<-sample(2:10,1)
  xx<-sample(1:10,nx)
  x[i,xx]<-1:nx
 }
 x
 muranks(x)

[Package crank version 0.9 Index]