Skip to content
Prev 389068 / 398506 Next

Splitting a data column randomly into 3 groups

I have a more general problem for you.

Given n items and 2 <=g <<n , how do you divide the n items into g
groups that are as "equal as possible."

First, operationally define "as equal as possible."
Second, define the algorithm to carry out the definition. Hint: Note
that sum{m[i]} for i <=g must sum to n, where m[i] is the number of
items in the ith group.
Third, write R code for the algorithm. Exercise for the reader.

I may be wrong, but I think numerical analysts might also have a
little fun here.

Randomization, of course, is trivial.

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Sat, Sep 4, 2021 at 2:13 PM AbouEl-Makarim Aboueissa
<abouelmakarim1962 at gmail.com> wrote: