# How do you Show a Difference between Two Groups (Clustering)

I am approaching a data problem. My data set consists of observations of (X,Y) coordinates indicating a position on some grid. There are two groups based on a variable Z. Group A is all the points where Z>10 and Group B is all the points where Z<10.

Would it be a good idea to separately cluster the 2 groups of (X,Y) coordinates, then compare the location of clusters to reach some conclusion about how Z affects the location of the points?

I want to say something statistically about how differently, if at all, the group A and group B points are clustered. So I can say that the difference is because of Z.

• I'm confused, is the value Z known for every point? If yes, why do you choose to do clustering? Overall is this more about visualizing/analyzing the data? – Erwan Oct 22 '19 at 15:22
• The dataset includes X,Y,Z features. I am plotting X and Y. I want to see how a different value of Z will affect the behavior of the X and Y variables. Think of X and Y as pixels of an image. A different value of Z will affect what pixel is chosen. That being said, I don't believe regression would work here because I am not looking for how Z affects the values of X and Y. Rather, I am looking for how Z affects the cluster locations/cluster densities of the plot of X and Y. – Bran Oct 22 '19 at 21:32
• Ah ok thanks, I thought it was the opposite (Z depending on X,Y). The first thing that comes to mind is to actually plot the points colored by Z and see how it looks like, but I guess you did that already? – Erwan Oct 22 '19 at 22:04
• Yes, I'm just looking for something that says something about significance. So I can be sure that Z does affect the locations X,Y. (BTW: Sorry for any incoherence here, but this thread has really helped me gain clarity and confidence) – Bran Oct 23 '19 at 0:30
• It's an interesting problem. I don't really know how to address it but I'm thinking maybe you could look at it this way: given a sample of points (X,Y,Z), does knowing Z helps predict other points more accurately? Not sure if it makes any sense though, it's just a thought – Erwan Oct 23 '19 at 11:55