# Comparing the responses of two groups to a same test

I have a very basic question concerning how to compare the responses of two groups of subjects, group = A and group = B, to a same test. The responses are stored in x.

My starting dataset is in the following form:

id    group    x
1       A     15
2       A     17
3       A     22
...

50      B     22
51      B     12
52      B     13

...


My initial idea was to split x into two variables xA and xB, and then to sort both of them according to their group, like this:

    xA      xB
15      12
17      13
22      22
...     ...


Then I wanted to run a simple Pearson's test between the newly created xA and xB.

To me this strategy seems rather artificial: I am sorting the variables before making the comaparison, which makes very likely to find some sort of linear dependence...

I am interested in evaluating whether there is some sort of accordance between the subjects of the two grous in answering to the test. I also thought to adopt a Wilcoxon test on the equality of the medians of the two variables.

Which strategy would you suggest?

-

I think the problem you describe might be due to putting the data into two "columns" -- Stata (and many other stats packages) then presumes that the ordering of rows is informative (i.e. represent paired data, which as discussed is not appropriate here). So Stata is probably trying to do a Wilcoxon signed-ranks test (analog to a paired t-test) whereas you actually want a Wilcoxon ranked-sums test (aka Mann-Whitney test). So your original data format would work -- command in Stata would be ranksum x, by(group) – James Stanley Jan 15 '13 at 0:17