Learn R Programming

PLMIX (version 2.1.1)

rPLMIX: Random sample from a mixture of Plackett-Luce models

Description

Draw a random sample of complete orderings/rankings from a \(G\)-component mixture of Plackett-Luce models.

Usage

rPLMIX(n = 1, K, G, p = t(matrix(1/K, nrow = K, ncol = G)),
  ref_order = t(matrix(1:K, nrow = K, ncol = G)), weights = rep(1/G,
  G), format_output = "ordering")

Arguments

n

Number of observations to be sampled. Default is 1.

K

Number of possible items.

G

Number of mixture components.

p

Numeric \(G\)\(\times\)\(K\) matrix of component-specific support parameters. Default is equal support parameters (uniform mixture components).

ref_order

Numeric \(G\)\(\times\)\(K\) matrix of component-specific reference orders. Default is forward orders (identity permutations) in each row, corresponding to Plackett-Luce mixture components (see 'Details').

weights

Numeric vector of \(G\) mixture weights. Default is equal weights.

format_output

Character string indicating the format of the returned simulated dataset ("ordering" or "ranking"). Default is "ordering".

Value

If \(G=1\), a numeric \(N\)\(\times\)\(K\) matrix of simulated complete sequences. If \(G>1\), a list of two named objects:

comp

Numeric vector of \(N\) mixture component memberships.

sim_data

Numeric \(N\)\(\times\)\(K\) matrix of simulated complete sequences.

Details

Positive values are required for p and weights arguments (normalization is not necessary).

The ref_order argument accommodates for the more general mixture of Extended Plackett-Luce models (EPL), involving the additional reference order parameters (Mollica and Tardella 2014). A permutation of the first \(K\) integers can be specified in each row of the ref_order argument to generate a sample from a \(G\)-component mixture of EPL. Since the Plackett-Luce model is a special instance of the EPL with the reference order equal to the identity permutation \((1,\dots,K)\), the default value of the ref_order argument is forward orders.

Examples

Run this code
# NOT RUN {
K <- 6
G <- 3
support_par <- matrix(1:(G*K), nrow=G, ncol=K)
weights_par <- c(0.50, 0.25, 0.25)

set.seed(47201)
simulated_data <- rPLMIX(n=5, K=K, G=G, p=support_par, weights=weights_par)
simulated_data$comp
simulated_data$sim_data

# }

Run the code above in your browser using DataLab