## Example 1. Simulate rankings from a 2-component mixture of Mallows models
## with Spearman distance.
set.seed(123)
d_sim <- rMSmix(sample_size = 75, n_items = 8, n_clust = 2)
rankings <- d_sim$samples
# Fit the basic Mallows model with Spearman distance.
set.seed(123)
fit1 <- fitMSmix(rankings = rankings, n_clust = 1, n_start = 10)
# Compute the asymptotic confidence intervals for the MLEs of the precision.
ci95_fit1 <- confintMSmix(object = fit1)
print(ci95_fit1)
# Fit the true model.
set.seed(123)
fit2 <- fitMSmix(rankings = rankings, n_clust = 2, n_start = 10)
# Compute the asymptotic confidence intervals for the MLEs of the weights and precisions.
ci95_fit2 <- confintMSmix(object = fit2)
print(ci95_fit2)
Run the code above in your browser using DataLab