# Hypothesis test on data with confounding spatial clustering

This is a bit of an elaboration on a question I posted earlier, since I feel like my approach to the problem as a whole is probably quite flawed.

Suppose I have a set of treatment and control cells, each with a position in space and some response value. I would like to know whether the treatment cells are significantly more similar in their responses than controls. However, the analysis is complicated by the fact that:

• Across all cells there is some tendency for the responses of pairs of nearby cells to be more similar
• My treatment cells are also significantly clustered in space

So far, I have tried to find an upper bound on the probability of the null hypothesis using a bootstrap test:

1. For each possible pair of treatment cells, find a group of matched control pairs whose spatial distance is less than or equal to that of the treatment pair. The number of pairs that satisfy this criterion will vary depending on which treatment pair I'm considering.
2. Find the rank of each treatment pair within its distribution of matched control pairs and normalize it to between 0 and 1
3. Take the mean of the normalized ranks across groups as my 'real' score.
4. Bootstrap a null distribution by drawing randomly from each set of possible normalized ranks and taking the mean.
5. The normalized rank of the 'real' score within this null distribution gives me my p-value.

Since I only consider control pairs whose distance is <= that of the treatment pair, this ought to be a very conservative test. However, if I were to consider control pairs whose distance is the same as the treatment pair to within +/- some tolerance, I will end up choosing control pairs that are, on average, more distant than the treatment pair (because the treatment pairs are spatially clustered there will tend to be a greater number of control pairs that are more distant than the treatment pair).

Is there a better way of doing this analysis? I'm sure I must be missing something very obvious!

• Is there a danger that an underlying spatial feature is a significant factor - beyond just the issue that close cells have similar scores? As the treatment cells are clustered in space, if they are unluckily in a zone that happens to impact on the response, it won't be possible to distinguish the effects. – Peter Ellis Apr 13 '13 at 2:15
• I though about this - fortunately I don't think it's a particularly likely scenario in my case. – ali_m Apr 13 '13 at 19:02