Running examples in ‘MSmix-Ex.R’ failed
The error most likely occurred in:

> ### Name: bicMSmix
> ### Title: BIC and AIC for mixtures of Mallows models with Spearman
> ###   distance
> ### Aliases: bicMSmix aicMSmix
> 
> ### ** Examples
> 
> 
> ## Example 1. Simulate rankings from a 2-component mixture of Mallow models with Spearman distance.
> set.seed(12345)
> rank_sim <- rMSmix(sample_size = 50, n_items = 12, n_clust = 2)
Metropolis-Hastings Sampling
> str(rank_sim)
List of 5
 $ samples       : num [1:50, 1:12] 4 1 8 4 2 2 1 11 6 1 ...
 $ rho           : int [1:2, 1:12] 3 1 10 4 8 8 11 3 2 12 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : NULL
  .. ..$ : NULL
 $ theta         : num [1:2] 0.058 0.0349
 $ weights       : num [1:2] 0.738 0.262
 $ classification: int [1:50] 2 2 1 1 2 2 2 2 1 2 ...
> rankings <- rank_sim$samples
> # Fit the true model.
> set.seed(12345)
> fit <- fitMSmix(rankings = rankings, n_clust = 2, n_start = 10)
The dataset includes only full rankings. Estimation method ------> EM ALGORITHM.
[1] "INITIALIZATION 1"
[1] "Starting value # 1  => best log-likelihood so far = -842.78240022943"
[1] "INITIALIZATION 2"
[1] "Starting value # 2  => best log-likelihood so far = -842.78240022943"
[1] "INITIALIZATION 3"
[1] "Starting value # 3  => best log-likelihood so far = -842.78240022943"
[1] "INITIALIZATION 4"
[1] "Starting value # 4  => best log-likelihood so far = -842.78240022943"
[1] "INITIALIZATION 5"
[1] "Starting value # 5  => best log-likelihood so far = -842.78240022943"
[1] "INITIALIZATION 6"
[1] "Starting value # 6  => best log-likelihood so far = -842.78240022943"
[1] "INITIALIZATION 7"
[1] "Starting value # 7  => best log-likelihood so far = -842.78240022943"
[1] "INITIALIZATION 8"
[1] "Starting value # 8  => best log-likelihood so far = -842.78240022943"
[1] "INITIALIZATION 9"
[1] "Starting value # 9  => best log-likelihood so far = -842.78240022943"
[1] "INITIALIZATION 10"
[1] "Starting value # 10  => best log-likelihood so far = -842.78240022943"

Call:
fitMSmix(rankings = rankings, n_clust = 2, n_start = 10)

N. of items: 12 
N. of clusters: 2 

N. of starting points: 10 
Convergence achieved: TRUE 
N. of iterations: 3 
BIC: 1705.125 (based on full or augmented rankings)

Use functions summary() and plot() to summarize and visualize the object of class 'emMSmix'.
> # Comparing the BIC at the true parameter values and at the MLE.
> bicMSmix(rho = rank_sim$rho, theta = rank_sim$theta, weights = rank_sim$weights,
+        rankings = rank_sim$samples)
[1] 1710.72
> bicMSmix(rho = fit$mod$rho, theta = fit$mod$theta, weights = fit$mod$weights,
+        rankings = rank_sim$samples)
[1] 1705.125
> aicMSmix(rho = rank_sim$rho, theta = rank_sim$theta, weights = rank_sim$weights,
+        rankings = rank_sim$samples)
[1] 1701.16
> aicMSmix(rho = fit$mod$rho, theta = fit$mod$theta, weights = fit$mod$weights,
+        rankings = rank_sim$samples)
[1] 1695.565
> 
> 
> ## Example 2. Simulate rankings from a basic Mallow model with Spearman distance.
> set.seed(54321)
> rank_sim <- rMSmix(sample_size = 50, n_items = 8, n_clust = 1)
Metropolis-Hastings Sampling
> str(rank_sim)
List of 5
 $ samples       : num [1:50, 1:8] 2 5 4 1 4 2 5 2 6 1 ...
 $ rho           : int [1, 1:8] 4 2 8 7 3 5 6 1
 $ theta         : num 0.0316
 $ weights       : num 1
 $ classification: int [1:50] 1 1 1 1 1 1 1 1 1 1 ...
> # Let us censor the observations to be top-5 rankings.
> rank_sim$samples[rank_sim$samples > 5] <- NA
> rankings <- rank_sim$samples
> # Fit the true model with the two EM algorithms.
> set.seed(54321)
> fit_em <- fitMSmix(rankings = rankings, n_clust = 1, n_start = 10)
The dataset includes partial rankings. Estimation method ------> EM ALGORITHM ON AUGMENTED RANKINGS proposed by Crispino et al. (2023).
[1] "INITIALIZATION 1"
Error in if ((log_lik[l] - log_lik[l - 1])/abs(log_lik[l - 1]) < eps |  : 
  missing value where TRUE/FALSE needed
Calls: fitMSmix -> em_db_mix
Execution halted