Cluster sizes are determined using the normal distribution
(\(\mu=\) num_points
\(/\) num_clusters
,
\(\sigma=\mu/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
#> [1] 190 216 355 239
sum(sizes)
#> [1] 1000