Response consists of pairwise distances: how to address non-independence? How to deal with situations in which the response variable consists of pairwise differences within each experimental treatment? Here are two examples to put my question into context:


*

*pairwise distances among prey in presence or absence of a predator:


*pairwise distances between trees within a number of plots across a gradient of water content in the soil:

I will focus on the latter example, represented in the second image. Let's say that I have N forest plots. Each of the plots differ in the mean water content in their soil (my predictor). All the pairwise distances between trees within each plot (my response variable) are known. (To take tree abundance out of the picture let's say that all forest plots contain an equal number of trees). How to test for a correlation between mean water content in the soil and pairwise distances between trees? The pairwise distances between trees within each plot are not independent, so a linear model does not seem adequate. Specifying "plot" as a random effect in a mixed effect model would help, but it does not address specifically the non-independence of pairwise distances. Should I specify some form of autocorrelation in the data and, if so, what type?
 A: There was a discussion with Luca Rindi, Jacopo Cerri, and Marco Sigovini on a different platform that answered my question: I report it here. In order to test for a correlation between two variables, such as water content and distance among trees, the variables must be compared at the same scale. In other words, given the experimental design that I described, each plot must be associated with a single value of water content and a single value of distance, namely the mean of all the pairwise distances between trees in that plot. As a result, given that only the mean distance between individuals in each plot is used in the analysis, whether the individual pairwise distances within a certain plot are independent from each other or not does not affect the analysis.
Two side-notes:


*

*the example as I described it is pseudoreplicated: without replicates for each level of soil moisture there is a confusion between the effect of soil moisture and that of plot identity.

*I used the distance between trees as a rough measure of the patchiness of their distribution. There are better ways to quantify spatial patchiness: see here and here for some theory, here for a case study, and here for an implementation in R.

