# Compare means of two groups with a variable that has multiple sub-group

I was unable to understand how to compare multiple mean values in each group. Within the subgroup the mean values influence each other (If one changes, the other changes automatically).

I collected travel distance and the mode of transportation choice at two different locations. There are 32 people in each location with "x" different modes. A person can choose one mode and record their travel distance.

How should I compare to see if the travel distances traveled by different modes of these two groups are significantly different? If it is categorical data, I know I have to use chi square, but does the t-test work here? I believe the t-test is to compare two groups with one mean in each group. But I have 2x separate mean values (one for the each mode and two locations).

You should neither use chi-squared (which is suitable for frequency data) nor t-test (which is meant to compare two means).

Here your measure is numerical scale data (not just count) and you have two factors and one possible interaction:

• Location (two levels)
• Mode of transportation (more than two...)
• And the interaction of both.

What you should try to do is an ANOVA (you have to check some assumption related to the nature of your data see here).

That will allow to study the effect of location and mode independently and optionally how each factor impact the effect of the other (that is the interaction).