I have a data for a group of people with attributes - age , gender , customerscore to create the data use code below -
names=paste('H',1:100)# name of people
age <- round(urnorm(n = 100, mean = 50, sd = 15, lb = 24, ub = 75))
customerscore=urnorm(n = 100, mean = 175, sd = 20, lb = 54, ub = 225)
Gender <- sample(c("Male","Female"),100, replace=TRUE, prob=c(0.46, 0.54))
dummy.data=data.frame(names,age,closures,Gender)
Now i want to divide this group of people into 3 groups which are as homogeneous as possible across the three attributes i.e say if there are 33 females , they are split not necessarily equally as 11 in each group but whatever max is possible so as to allow averages for both customerscore and age to be similar for each group .
I checked normal sampling , split function etc related questions however couldn't really split into closely match three groups. Would there be a method where i can specify the importance of attribute in splitting , saying for example that age is more important to be similar in three groups , that average age and its distribution should be same across three groups , followed by similar closures average and then whatever best gender split can be done .
Aucun commentaire:
Enregistrer un commentaire