In this simplified example, I have five variables for each individual. The data is normalized, with mean 0 and sd 1 in each variable.
I would like to divide this data into two groups with equal size and I'd like the mean for each variable to be as close to zero as possible (because since data is normalized, this would mean that the groups are as similar as possible).
I don't know any theory about that kind of problem. My only solution so far would be to randomly divide them millions of times, and selecting the one with smaller distance between the means of each group.
Could you point me to what kind of theory should I read to face this problem in a more optimal way?
One example of data like this in R would be:
set.seed(123)
A <- matrix(runif(100), 20, 5)
A <- scale(A) #normalize
rownames(A) <- letters[1:20]
colnames(A) <- paste0("x",1:5)