 And now that Pierre Legendre has really set the stage for the rest of the course, we can turn to those techniques that are specifically devoted to the analysis of spatial structures, where the geographic locations of the sites are explicit. And the first one of those will be the Mantel Corellogram. Mantel Corellogram, what is Mantel and what is a Corellogram? Of course to explain, I'll have to first to present those two notions to you so that everything is clear. First of all, what is the Corellogram? The Corellogram is a graphical representation of spatial or temporal for that matter, temporal correlations between sites computed for a range of distance classes. And these spatial or temporal correlations measure how much the sites resemble their neighbors or increasing spatial distances, meaning how does a site resemble its closest neighbors and then its second closest neighbors and the second distance class and so on and so forth until you have covered your whole sampling area. Now, how does it work? I'll first present an intuitive example with actually calculating the correlation not in the appropriate way but in a way that is close to it simply that you understand how it works with something that you already know. Let's say you have a simple case where you got data from a transect and you are looking for the values of a single variable. Here, for instance, the density of soil cores in grams per cubic centimeter. Let's say you may have for some obscure reason, it's not important here, along that transect you will have such fluctuating values of densities. Maybe you have some kind of mosaic of different types of soil that may produce something like this. A coronagram will compare the values of density for this example by progressively offsetting, displacing the series with respect to itself. So, let's say just for now that we do this with a Pearson's correlation coefficient because actually one of those coefficients that are used, Moran's i, is very close to it. So, I'll stick with Moran's Pearson's correlation coefficient because everybody here knows what a simple correlation is. So, at lag 0, I have simply here twice this vector of density that the two vectors are completely superimposed. At lag 0, it means, of course, that the correlation is 1. You correlate the vector with itself. And now, as you see, we increase the lag. So, I shift this series with respect to the other by one unit. It's simple in this case. Actually, I have this series of values shifted by one value along my transactive. I have taken one point every meter. It would be shifted by one meter. And I recompute Pearson's correlation coefficients. Of course, I lose one value at each end of the series. And so, I get a correlation which is lower than the other one. And I go on with this procedure. I shift again, shift again, shift again, each time computing my correlation. And then, I display those correlations. Of course, I have to stop at some point because of the lack of values. Here, as you see, I have stopped at lag 15 for this example here because I have only five common values left to compute my correlation. Of course, at some point, you have to stop. So, in the situation that I have here with this periodicity in my data, after that, I shall draw my correlations with respect to the lags. And this is my correlogram. This correlogram shows you, starting with one, that at lag one and two, we still have positive correlation, meaning that at a range of two meters, values tend to be rather similar to their neighbors. But if I go further down in my lags, you see, for instance, here that at lags five, four, five and six, I have negative correlations, meaning that for the original data, I have reached a point where the high values here and here and there, well, there we lose them, correspond in fact to the, well, when you have lag at some point here, correspond to low values. So this means negative correlations. You have displaced your series to such a point where positive values here, at a lag of five, if you take any positive values here, or well, if you sample them, but any high values here, you're likely to have a correspondence with the low value and the reverse is true as well for the next bump or trough in the series. So the correlogram here shows you the relationship among sites for those lags one and five. And of course, when you are again in phase with the periodicity that I had in my fictitious example, then you go back to positive correlation and here you see, you appreciate the distance between the bumps. You'll say, well, superficially this looks like the data themselves. Of course, in real cases, situations are not always that clear and often you may not have necessarily such kind of structures as well. And there is a chapter and a section in Pierre's book explaining this in more detail with examples of different spatial structures and how they occur or how they are visible or they can be derived from correlograms. You get the point? Okay, this was for one dimension. We had a transect, but it can be generalized to two dimensions. With two dimensions, you compute a matrix of Euclidean distances among sites and I mean among the geographical locations of the sites, not among the response data. So Euclidean distance in this specific case corresponds to geographic distance. If you have x, y coordinates in meters or kilometers, then Euclidean distance between any two points give you the geographic distance or straight line distance between those two points. And this is what we want because what we do after that, we have to have lags as in my linear example. Then to obtain those lags, we have to group those distances in two classes. For instance, here I have an exert or matrix of Euclidean distances and I can set lags, for instance, from... I don't remember where the limits are. This is not very important here, but I think below one meter distance between the points, this was distance class one. Yes, it looks like that. So here everything that is below one gets class distance one. The first range, the first neighbors are defined in the radius of one meter around each point on your sampling surface. And then the distances between one and two meters get distance class two in this simple example here. So everything that is between one and two, not included the limit I think, gets value two and so on. And in this example, we had the fourth distance classes between three and four, third distance between two and three meters and then fourth distance class here. And now from that information, going back to your values in the response matrix for your data, you can do the same, meaning computing, correlating the values of your points inside each of those distance classes. And this is done, as I told you, by something, well, by two different, the most common measures of what is called here spatial autocorrelation, more spatial. For the data themselves, this autocorrelation contains every correlated information. The spatial correlation measures are the most frequent ones, are Moran's eye and Gary's C. So without having, going into much detail here, you have those comparisons for lags between pairs of points that belong to the same distance classes. I get here a weight of one. The other one's, again, zero. And then you do this for each distance class. But basically, again, without commenting the formulas themselves, consider that Moran's eye is very close to Pearson's arc correlation for all practical purposes. It behaves the same way. Although the expectation is not strictly zero, but the value of that for given amount of observation is quite close to zero. And Gary's C behaves close to a measure of distance, actually, a measure of, so the value is larger than when the correlation is less or when it goes to negative. It doesn't go to negative, but in any case, it behaves like something like a distance. So the smaller the value and the higher the correlation among points in Gary's C. It's more like the example I showed you before. Okay? So in really a couple of words, this is what a measure of correlation, spatial correlation is, and a correlogram. But now we deal with multivariate data. So how could we do this? Here is where the Mantel correlogram comes at the front. But of course, here again, we'll first see what a Mantel test is because this is what is behind the Mantel correlogram. A Mantel test has a sulfurous reputation, for good reasons, because it has been used and misused in many, many circumstances. And Pierre will come back to that at the closing talk of this course tomorrow. Or I guess you will spend quite a amount of time. So maybe I'll shorten a couple of, go over a couple of slides that mentioned the main message about this. Well, what is the principle of a Mantel test? It's a linear correlation between dissimilarity matrices. So you take your dissimilarity matrices, you unroll them, you make a vector of all those values, for the two dissimilarity matrices relating of course the same set of objects, and you compute a correlation. You cannot test this by the usual T-test, say, for Pearson's correlation because of problems of dependencies each distance in a dissimilarity matrix is dependent from all the others and so on and so forth. But now let's first go to the hypothesis. The hypothesis for a Mantel test, the null hypothesis, is that the dissimilarities among objects in matrix Y are not linearly correlated with the corresponding dissimilarities in the other matrix. H1 being that there is a correlation between the two, and generally this H1 is one-tailed on the right part of the distribution because when something happens, then it is that your dissimilarity in one set is linked positively to the dissimilarity. The more dissimilarity your objects are, dissimilar your objects are in one, and it's likely that if anything happens, then they are more dissimilarity matrix as well. Because a reversed correlation in that case would be next to impossible to interpret, so I may have to reword this into one-tailed H1 hypothesis. The original, well, Natan Mantel published this test in 1967, and it was about a relationship in epidemiology where he tried to see whether there was a relationship between the geographical distances among outbreaks of diseases and the time separating those outbreaks. So here his thinking was really about distances in temporal or geographical in this case, in both matrices, and at least so far as he was concerned could not be expressed in raw data in that case. That may have to be re-inspected today, but in any case it was at this time what he thought. Let's have a small example here of how it is computed. Let's start with this simple Mantel statistic, and I deliberately now tailor the small example with one matrix with a kind of ordinary kind of dissimilarity that you may compute with a jackard index or a percentage difference or whatever, and you get those dissimilarities, upper or lower triangular, it's of course unimportant, they are symmetrical. And on the other side, I have here a matrix of distance classes. So you see where I will be leading to. This is the kind of right-hand matrix matrix that I shall be using in Mantel's correlogram, like the kind of matrices of distance classes that we used before in the ordinary or univariate correlograms. So here you have this thing, and how does it work? So the function, well, the Mantel computation is really easy. You just have to multiply all those values together. So 0.25 times 1, which is here, 0.43 times 0 and so on and so forth through the whole matrix here, and you sum up all those values, which in this specific example gives 1.19, this has no interest whatsoever the value itself, except that in our case it is the true value, meaning the observed one. And this will be compared to a reference distribution that is computed by permutations. It cannot be done in a... Well, I guess there is a... Is there a parametric version of Mantel? I think of it seems to have... Oh, either well, or maybe a normal approximation when you have really big data sets, I think it's that. But the real one, you test it by permutation. Beware, however. I told you that it was corresponding to... Maybe you take those rows, put them, well, columns and put them as a vector. Here you unroll them and you put them together to compute the Mantel statistic, but the permutation is not done among those values, or it can be done in a restricted way that in fact corresponds to permuting the original values, not the ones in the distance or the similarity matrix, but in the origin and data matrices. It corresponds to permuting those ones and then recomputing the distances. So the permutable units are actually the true observed... The observations and not the distances or the similarities themselves. But this is a technical point. And actually the standardized Mantel statistic that is now used is this time the exact equivalent of Pearson statistics, which is actually a standardized way. You see that it's still the same formula, but you standardize your values by the mean and the standard deviation here. So for the principle. So you have now a mean of comparing the similarity matrices together, not comparing the raw data. But please, now, from now on, remember that comparing the similarity matrices or comparing raw data is not the same at all. And this is the point that Pierre will be stressing tomorrow. So I'll go quickly over the following warning slides about this point because Pierre will go in more detail about that. Simply remember that the variance of community composition table is not the same as the variance of a dissimilarity matrix. And this is the core of it all. Because many strange things have been done with Mantel tests in the literature. But the one application where the Mantel statistic is still useful and we did simulation and we wrote a paper that was published in 2012. I think I forgot to put the reference here. It's on Pierre's side in any case. Just look for that. It's called something like the Mantel Corellogram useful for ecological investigation or something like that. So how does it work? It works the way I just showed you before for one class. So the principle is you compute a standardized Mantel statistic between your dissimilarity matrix and first a matrix containing ones for... Well, we are in dissimilarity. So containing actually zeros for the class where you are. And no, we don't have that. No, otherwise it would become negative. Okay, so for zeros for your distance class and ones for the other one. And then you do the same, but changing... You test this and you do the same but changing the right-hand matrix here for putting the zeros and the ones where the second class versus all the others are. And the same for the third class and the fourth class until you have covered your whole range. The expectation of the Mantel statistic like the one of Pearson statistic is zero. So you will get negative correlations or Mantel statistics when you are negatively correlated and positive ones when you are positive. So it amounts to interpreting the Corellogram the same way as my first intuitive example shown before in the Univariate case. In R, you can do this using function mantel.corellog in vegan. The only data necessary are a response dissimilarity matrix and either the geographical coordinates of the sites or a matrix of geographical distances, meaning nuclear distance built upon those x, y or x coordinates. Well, if you want to avoid problems because I don't know why I had problems last night when I for the last time tested this before coming to you this morning, it may be better to provide the matrix of geographical distances instead of the raw x, y value. For the left-hand matrix, you have to provide your distance matrix anyway. But for the right-hand one, it's supposed, mantel.corellog is supposed to accept the x, y coordinates and run the distance, compute the distance matrix by itself but for whatever reason last night it didn't work. I have updated the zip file containing all our practical material last night according to this so that two days practical in my version of it now contain the corrected form. Of course, another point here if the data contains a linear trend, you have to detrend them before computing this analysis. And this is also true for most spatial analysis that we will do. Again, I told you this when I spoke about the detrending a couple of days ago. I mentioned that all those sophisticated methods of data analysis actually should be used at their full potential to detect finer scale processes and not those trivial trends that go over the whole range of your area. So you detrend them by just removing the linear trend with an LM function. LM in this case works as well for whole matrices. So let's have a little example here. You see here that I work on the Zoribatid-Mite data set. So I first transform my data, I helinger transform them in this example and then I detrend them. Look how easy it is to run a linear detrending on a data set. You just take the residuals of your linear model of your matrix. I have specified those here that this is supposed to be a matrix and this is a data frame, but here it was already but oh, did I? Yes, yes, of course. And this is now my detrending. My detrending has begun. This is a linear regression actually with XY coordinates. So I do this regression and I take the residuals and these are my detrending, my data. And then I compute my correlogram here with the function Mantel correlog where I take, okay, you may not have seen this way of computing a distance matrix. This function, this belongs to the base of R and it compute the Euclidean distance. So you're just, in this case, these things I have helinger transform my data while they have been detrended after one but they are still helinger transform. So I compute within this, without having to create intermediate objects that are useless anyway, a distance matrix from my helinger, detrended helinger transform my data and the other one being the distance. Here I have been careful. I have also computed the distance matrix, geographical distance matrix upon my XY data here and I then display the result. The numerical result looks like this where you have the classes that have been computed with automatical lads. These have been computed internally but you could change them and it gives you the class index since the distances were in meters, those are the middle of each of those classes in meters and here are the number of dissimilarities within each class. There is an important information there and you have those mental correlation values, 0.13, 0.11, don't be afraid by the low values of the mental correlations, it's always so, so the values themselves are unimportant. What is important here is to see that they change signs at some point and here they are highly significant in the positive values and they become significantly negative values as well. Now I'll show you how it displays but after that I have just a couple of words about those corrected values which are the ones you have to look for here, corrected p-values. This is our correlogram. The values we saw before and the black squares are for the significant auto-correlation values or mental correlation values and the white ones are non-significant. In our case here, you see it looks different from my first example. It's quite typically the kind of correlogram you would obtain when you have a gradient in your data because first at close distances when you have a gradient, in your surface, along one or a couple of axes, then close, when you take sampling cores or whatever, in this case it was soil cores, close to one another, they are likely to resemble each other because you are in the same conditions and then when you get farther apart, the pairs of cores are progressively farther apart, they become progressively different until at a point where, since you are at a scale broad enough, you are likely to, when you take one core at some point and another at, say, 5 meters or 3 or 4 meters apart, you are likely to find two quite different situations so the communities will be different as well and this is reflected in those negative correlations here which are significant. At the end it tends always to level out but this is mainly because you are beginning to lack distances and you need to test your spatial correlation correctly so for all practical purposes, like you see here, it's even not tested, at some point you stop testing because you have not enough information to do it properly. Now just a word to finish about multiple testing. I already mentioned that topic comparing it with the storing of dices when it was mentioned that if you have not one but several tests to run on the same situation, let's be very general here, then if each of your tests is done with a rejection level of alpha 0.05, for instance, then of course at the end you are very likely to have had at least one, if you have made enough tests you are very likely to have at least one of those tests rejecting your null hypothesis by why it should not have been done. This is the normal type 1 error of any test. So in the case of a Corellogram, you have as many tests as you have lags where you have done your test. So this is a typical case where you simply run your test and don't correct your p-values or your rejection level, which is the same but being from the opposite direction, then you are likely to consider too many values as significant. So the solution is to correct the level of rejection or the p-value in the opposite direction, which is the same. The most drastic way of correcting those values is called a Bonferroni correction where you divide the global threshold of rejection of H0 by the number of tests you are doing. So in our case, the Corellogram will be globally declared significant if at least one of the seven, since we had seven autocorrelation values is significant at a corrected alpha level of 0.05 divided by seven, which is 0.007. I could have done the reverse meaning I could have multiplied the p-values of the test by seven and checked against 0.05. You can do it both ways, of course, the results are completely equivalent. You can verify that globally this correction levels out the chances and you globally get the targeted risk by computing this you have a 1 minus 0.0. This is based on the binomial distribution. I won't go into detail, but if you do this computation you check that the global chances of accepting H0 when it is true is indeed 0.95. So this is correct. However, this is a very conservative, again, no politics here, very conservative correction, meaning that it tends to not reject H0 often enough. And this means you have a lack of power. So you have the reverse problem. Of course it is valid, but you have not so much power. So other types of corrections have been proposed and this is especially the case where when the values of the various tests are related somehow like in this case of the correlogram. And an interesting one is the home correction which has been applied to the correlogram here. So in the home correction you run the K tests, you order the probabilities in increasing order, beginning by the smallest one, and you correct each significance level stepwise, beginning from the first one, by dividing it by 1 plus the number of remaining tests in the ordered series. So how does it look like? This is my last slide for today. Let's say here we have six fictitious autocorrelation probability values here. Six because there was a number of things I could put in this slide while having sufficiently large writing here that everybody can see it clearly. So let's say this could have been an autocorrelogram with six values with probabilities 1.001, etc. You see the values here. So if you don't make any corrections and you test at the 5% rejection level, you have those 1, 2, 3, 4, 5 out of 6 would be deemed significant. If you apply the Bonferroni correction, Bonferroni correction says you have to reject H0 only if the p-value is equal to or smaller than 0.05 divided by those six number of tests, which is 0.0083. So Bonferroni would reject H0 only here, here, and here. And now the home correction, which is a little bit in between, not so drastic, so conservative, you order them in increasing order of probability. So you have two equal ones here at the beginning and then it is this one and this and this and this. So just those one sorted in increasing. And now for each of those, you compute the threshold. So the first one is still the Bonferroni. You have still six values here. So the rejection level is still 0.0083 here. But then for the rest of them, here you have still five to test. So you divide 0.05 by five, which gives 0.01 and then by four, by three, by two, and by one. Okay, so it relaxes the correction according to the number of tests that are remaining to be done. And finally, with this one, you see that we are somewhere in between here. So we reject H0 clearly for those 2.001 tests here. And then still for this one and this one, but then you lose that value, which is really too close to the 0.05 level, the uncorrected level, and is likely to be the result of a type one error because of the number of tests you have done. Okay? I guess it's time to finish this morning and I remind you, do we do it now? Okay? Everybody is now requested to go to the terrace and we have her or his best smile for the group photograph. Take a lot of funny pictures up there.