Learn R Programming

MSmix (version 2.0.0)

data_completion: Completion of partial rankings with reference full rankings

Description

Deterministic completion of partial rankings with the relative positions of the unranked items in the reference full rankings. Partial rankings with arbitrary patterns of censoring are supported.

Usage

data_completion(rankings, ref_rho)

Value

Integer \(N\)\(\times\)\(n\) matrix with the completed rankings in each row.

Arguments

rankings

Integer \(N\)\(\times\)\(n\) matrix or data frame with the partial rankings to be completed in each row. Missing positions must be coded as NA.

ref_rho

Integer \(N\)\(\times\)\(n\) matrix or data frame whose rows represent the reference full rankings to be used to complete the partial rankings.

Details

The arguments rankings and ref_rho must be objects with the same class (matrix or data frame) and same dimensions.

The completion of a full ranking returns the complete ranking itself.

References

Crispino M, Mollica C and Modugno L (2025+). MSmix: An R Package for clustering partial rankings via mixtures of Mallows Models with Spearman distance. (submitted)

Examples

Run this code

## Example 1. Completion of a single partial ranking.
data_completion(rankings = c(3, NA, NA, 1, NA), ref_rho = c(4, 5, 1, 3, 2))

## Example 2. Completion of partial rankings with arbitrary censoring patterns.
rankings <- rbind(c(3, NA, NA, 7, 2, NA, NA), c(NA, 6, NA, 5, NA, NA, 1),7:1)
data_completion(rankings = rankings, ref_rho = rbind(c(4, 5, 6, 1, 3, 7, 2),
                7:1, 1:7))

Run the code above in your browser using DataLab