clusizes: Determine cluster sizes, i.e., the number of points in each...

View source: R/module.R

clusizesR Documentation

Determine cluster sizes, i.e., the number of points in each cluster

Description

\loadmathjax

Cluster sizes are determined using the normal distribution (\mjeqn\mu=μ= num_points \mjseqn/ num_clusters, \mjeqn\sigma=\mu/3σ=μ/3), and then assuring that the final cluster sizes add up to num_points via the fix_num_points function.

Usage

clusizes(num_clusters, num_points, allow_empty)

Arguments

num_clusters

Number of clusters.

num_points

Total number of points.

allow_empty

Allow empty clusters?

Value

Number of points in each cluster (vector of length num_clusters).

Note

This function is stochastic. For reproducibility set a PRNG seed with set.seed.

Examples

set.seed(123)
sizes <- clusizes(4, 1000, TRUE)
sizes
sum(sizes)

clugenr documentation built on Aug. 8, 2025, 6:05 p.m.