form_homogeneous_subgroups function

Form groups and subgroups of 'homogeneous' samples as defined by certain variables and size constraints