Spearman distance distribution under the uniform ranking model
Spearman distance distribution under the uniform ranking model
Provide (either the exact or the approximate) frequency distribution of the Spearman distance under the uniform (null) ranking model.
spear_dist_distr(n_items, log =TRUE)
Arguments
n_items: Number of items.
log: Logical: whether the frequencies must be reported on the log scale. Defaults to TRUE.
Returns
A list of two named objects:
distances: All the possible Spearman distance values (i.e., the support of the distribution).
logcard: (Log)-frequencies corresponding to each value in distances.
Details
When n≤20, the exact distribution provided by OEIS Foundation Inc. (2023) is returned by relying on a call to the get_cardinalities routine of the BayesMallows package. When n>20, the approximate distribution introduced by Crispino et al. (2023) is returned. If n>170, the approximation is also restricted over a fixed grid of values for the Spearman distance to limit computational burden.
Examples
## Example 1. Exact Spearman distance distribution for n=20 items.distr <- spear_dist_distr(n_items =20, log =FALSE)plot(distr$distances,distr$logcard,type="l",ylab="Frequency",xlab="d",main='Distribution of the Spearman distance\nunder the null model')## Example 2. Approximate Spearman distance distribution for n=50 items with log-frequencies.distr <- spear_dist_distr(n_items =50)plot(distr$distances,distr$logcard,type="l",ylab="Log-frequency",xlab="d", main='Log-distribution of the Spearman distance\nunder the null model')
References
OEIS Foundation Inc. (2023). The On-Line Encyclopedia of Integer Sequences, Published electronically at https://oeis.org.
Crispino M, Mollica C, Astuti V and Tardella L (2023). Efficient and accurate inference for mixtures of Mallows models with Spearman distance. Statistics and Computing, 33 (98), DOI: 10.1007/s11222-023-10266-8.
Sørensen Ø, Crispino M, Liu Q and Vitelli V (2020). BayesMallows: An R Package for the Bayesian Mallows Model. The R Journal, 12 (1), pages 324--342, DOI: 10.32614/RJ-2020-026.