1
$\begingroup$

I have 4 variables A (continuous), B (continuous), C (categorical-binary), and D (categorical-multinomial) which I need to split into K (known) groups. However, in addition to minimizing the distance between observations based on A and B, the groups need to be as evenly distributed possible by C and D.

I am not sure how to approach this problem- is there a way that I can use a modified version of the K-means algorithm to achieve my desired result?

$\endgroup$
0
$\begingroup$

You can use a cluster algorithm like k-means to cluster your observations according to the variables A and B. Then you somehow also have to maximize your distance according to your variables C and D. That can be achieved by setting a kernel, that minimizes the distance between A and B and maximizes the distance between C and D.

You can achieve this in R by using the kkmeans function of the kernlab package and specify a kernel function that is suitable for your purpose and minimizes the distance between A and B and maximizes the distance between C and D.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.