Package: anticlust 0.8.18

anticlust: Subset Partitioning via Anticlustering

The method of anticlustering partitions a pool of elements into groups (i.e., anticlusters) with the goal of maximizing between-group similarity or within-group heterogeneity. The anticlustering approach thereby reverses the logic of cluster analysis that strives for high within-group homogeneity and clear separation between groups. Computationally, anticlustering is accomplished by maximizing instead of minimizing a clustering objective function, such as the intra-cluster variance (used in k-means clustering) or the sum of pairwise distances within clusters. The main function anticlustering() gives access to optimal and heuristic anticlustering methods described in Papenberg and Klau (2021; <doi:10.1037/met0000301>), Brusco et al. (2020; <doi:10.1111/bmsp.12186>), Papenberg (2024; <doi:10.1111/bmsp.12315>), Papenberg, Wang, et al. (2025; <doi:10.1016/j.crmeth.2025.101137>), Papenberg, Breuer, et al. (2025; <doi:10.1017/psy.2025.10052>), Yang et al. (2022; <doi:10.1016/j.ejor.2022.02.003>), and Wu et al. (2025; <doi:10.1016/j.cor.2025.107030>). The optimal algorithms require that an integer linear programming solver is installed. This package will install 'lpSolve' (<https://cran.r-project.org/package=lpSolve>) as a default solver, but it is also possible to use the package 'Rglpk' (<https://cran.r-project.org/package=Rglpk>), which requires the GNU linear programming kit (<https://www.gnu.org/software/glpk/glpk.html>), the package 'Rsymphony' (<https://cran.r-project.org/package=Rsymphony>), which requires the SYMPHONY ILP solver (<https://github.com/coin-or/SYMPHONY>), or the commercial solver Gurobi, which provides its own R package that is not available via CRAN (<https://www.gurobi.com/downloads/>). 'Rglpk', 'Rsymphony', 'gurobi' and their system dependencies have to be manually installed by the user because they are only suggested dependencies. Full access to the bicriterion anticlustering method proposed by Brusco et al. (2020) is given via the function bicriterion_anticlustering(), while kplus_anticlustering() implements the full functionality of the k-plus anticlustering approach proposed by Papenberg (2024). Some other functions are available to solve classical clustering problems. The function balanced_clustering() applies a cluster analysis under size constraints, i.e., creates equal-sized clusters. The function matching() can be used for (unrestricted, bipartite, or K-partite) matching. The function wce() can be used optimally solve the (weighted) cluster editing problem, also known as correlation clustering, clique partitioning problem or transitivity clustering.

Authors:Martin Papenberg [aut, cre], Meik Michalke [ctb], Gunnar W. Klau [ths], Juliane V. Nagel [ctb], Martin Breuer [ctb], Marie L. Schaper [ctb], Max Diekhoff [ctb], Hannah Hengelbrock [ctb], Dimitry Wintermantel [ctb], David Buczynski [ctb]

anticlust_0.8.18.tar.gz
anticlust_0.8.18.zip(r-4.7-x86_64)anticlust_0.8.18.zip(r-4.7-arm64)anticlust_0.8.18.zip(r-4.6-x86_64)anticlust_0.8.18.zip(r-4.6-arm64)anticlust_0.8.18.zip(r-4.5-x86_64)
anticlust_0.8.18.tgz(r-4.6-x86_64)anticlust_0.8.18.tgz(r-4.6-arm64)anticlust_0.8.18.tgz(r-4.5-x86_64)anticlust_0.8.18.tgz(r-4.5-arm64)
anticlust_0.8.18.tar.gz(r-4.7-arm64)anticlust_0.8.18.tar.gz(r-4.7-x86_64)anticlust_0.8.18.tar.gz(r-4.6-arm64)anticlust_0.8.18.tar.gz(r-4.6-x86_64)
anticlust_0.8.18.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION
card.svg |card.png
anticlust/json (API)

# Install 'anticlust' in R:
install.packages('anticlust', repos = c('https://m-py.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/m-py/anticlust/issues

Pkgdown/docs site:https://m-py.github.io

Datasets:

On CRAN:

Conda:

9.85 score 39 stars 3 packages 93 scripts 1.6k downloads 25 exports 5 dependencies

Last updated from:73b9c587bf. Checks:15 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK192
linux-devel-x86_64OK231
source / vignettesOK250
linux-release-arm64OK185
linux-release-x86_64OK221
macos-release-arm64OK248
macos-release-x86_64OK440
macos-oldrel-arm64OK292
macos-oldrel-x86_64OK615
windows-devel-arm64OK465
windows-devel-x86_64OK271
windows-release-arm64OK487
windows-release-x86_64OK210
windows-oldrel-x86_64OK283
wasm-releaseOK107

Exports:anticlusteringbalanced_clusteringbicriterion_anticlusteringcategorical_samplingcategories_to_binarydispersion_objectivediversity_objectiveexperimental_allocationfast_anticlusteringfeasible_and_infeasible_region_search_anticlusteringgenerate_exchange_partnersgenerate_partitionskplus_anticlusteringkplus_moment_variablesmahalanobis_distancematchingmean_sd_tabn_partitionsoptimal_anticlusteringoptimal_dispersionplot_clustersplot_similaritythree_phase_search_anticlusteringvariance_objectivewce

Dependencies:latticelpSolveMASSMatrixRANN

Anticlustering in 2025
Improving the results | Standardization | Using a better algorithm | Changing the objective function | Unequal group sizes | Further reading | Categorical variables | Objectives | Algorithms | References

Last update: 2026-09-08
Started: 2025-09-18

Using categorical variables with anticlustering
Categorical variables as numeric variables | Blocking | References

Last update: 2025-11-28
Started: 2023-06-23

Some best practices for anticlustering
References

Last update: 2024-10-08
Started: 2023-06-29

Speeding up anticlustering
The exchange algorithm | Slowing down | Getting fast: Using fewer exchange partners | fast_anticlustering() | Preclustering | Secret hack | Including categorical variables | Objective function | References

Last update: 2024-04-24
Started: 2023-06-13

Using the R package anticlust for stimulus selection in experiments
Example 1a: Maximize differences in frequency | Example 1b: Two-factorial design | Example 2: Anticlustering | Example 2b: Anticlustering on subset selection | References

Last update: 2023-10-25
Started: 2019-11-14

Readme and manuals

Help Manual

Help pageTopics
Anticlusteringanticlustering
Create balanced clusters of equal sizebalanced_clustering
Bicriterion iterated local search heuristicbicriterion_anticlustering
Completion norms for 403 French sentencesbrunel2025
Random sampling employing a categorical constraintcategorical_sampling
Get binary representation of categorical variablescategories_to_binary
Cluster dispersiondispersion_objective
(Anti)cluster editing "diversity" objectivediversity_objective
Balanced Allocation of Subjects to Treatmentsexperimental_allocation
Fast anticlusteringfast_anticlustering
Feasible and Infeasible Region search heuristicfeasible_and_infeasible_region_search_anticlustering
Get exchange partners for fast_anticlustering()generate_exchange_partners
Generate all partitions of same cardinalitygenerate_partitions
K-plus anticlusteringkplus_anticlustering
Compute k-plus variableskplus_moment_variables
Compute mahalanobis distance between two vectorsmahalanobis_distance
Matchingmatching
Means and standard deviations by group variable formatted in tablemean_sd_tab
Number of equal sized partitionsn_partitions
Optimal ("exact") algorithms for anticlusteringoptimal_anticlustering
Maximize dispersion for K groupsoptimal_dispersion
Visualize a cluster analysisplot_clusters
Plot similarity objective by clusterplot_similarity
Ratings for 96 wordsschaper2019
Three phase search with dynamic population size heuristicthree_phase_search_anticlustering
Objective value for the variance criterionvariance_objective
Exact weighted cluster editingwce