[R-sig-eco] Mantel correlogram?

Sarah Goslee sarah.goslee at gmail.com
Tue Mar 12 14:57:46 CET 2013


Kathy,

It's really better to use dput() as suggested, and to keep the reply
on the r-sig-eco mailing list so that others can both contribute to
and benefit from the discussion.

That also avoids the problem of expecting others to be able and
willing to open attachments.

So given a portion of your sample data provided with dput(), here's
how to create and plot a Mantel correlogram. This is pretty much
identical to the worked example in the help for mgram().

You'd probably benefit from reading the Intro to R that comes with
your R installation and is available online. I don't think your
troubles have much to do with mgram() itself.

I don't know how you want to combine your data for all sampling dates;
you could simply use rbind() but that's rather simplistic.


library(ecodist)

# a small subset of your data
aprData <- structure(list(x = c(0.835, 0.835, 2.505, 2.505, 3.68, 3.68,
5.845, 5.845, 7.515, 7.515, 9.185, 9.185, 0.835, 0.835, 3), y = c(8.75,
8.25, 8.75, 8.25, 9.75, 9.25, 9.75, 9.25, 9.75, 9.25, 8.75, 8.25,
7.75, 7.25, 6.75), Cmic = c(1734.497, 1677.772, 1679.34, 1464.895,
1787.466, 1672.751, 1952.623, 1874.111, 1728.851, 1910.611, 1733.986,
1758.636, 1790.217, 1653.951, 1754.646)), .Names = c("x", "y",
"Cmic"), class = "data.frame", row.names = c(NA, -15L))

# first calculate the distance matrices using the
# appropriate metric for your data

aprSpace.ed <- dist(aprData[, c("x", "y")])
aprCmic.ed <- dist(aprData[, "Cmic"])

aprCmic.mgram <- mgram(aprCmic.ed, aprSpace.ed)

# default mgram plot
plot(aprCmic.mgram)

Sarah


On Tue, Mar 12, 2013 at 8:36 AM, Kathleen Regan <kath.regan at gmail.com> wrote:
> Dear Sarah,
>
> I will attach a sample Exel file from one date to this email. The plot is 10
> x 10m, I have 60 samples/date, and 6 dates. No missing data. The problem is
> that for some of the microbial soil variables, my 50 cm lag distances
> weren't really close enough for fitting good semivariograms, although for
> others we have been able to generate reasonable ones.
>
> Would you prefer that I send you the .txt file?
>
> Kathy
>
>
> On Tue, Mar 12, 2013 at 12:44 PM, Sarah Goslee <sarah.goslee at gmail.com>
> wrote:
>>
>> Hi Kathy,
>>
>> It's easiest to answer questions like that if you provide enough of
>> your data to create a reproducible example, like:
>> dput(head(mydata, 15))
>>
>> But it sounds like you may just need subset(), rather than this being
>> a question about Mantel correlograms per se.
>>
>> A Mantel correlogram is a good choice if your hypothesis is expressed
>> in terms of distances, rather than in terms of raw data. It can't
>> magically make up for insufficient data: if you don't have enough data
>> to calculate a meaningful semivariogram, you also don't have enough to
>> calculate a meaningful Mantel correlogram.
>>
>> Sarah
>>
>> On Tue, Mar 12, 2013 at 7:27 AM, Kathleen Regan <kath.regan at gmail.com>
>> wrote:
>> > I would like to use the package "ecodist" to compute Mantel correlograms
>> > for particular variables for each of 6 different time points. Each
>> > sample
>> > at each time point has  unique x and y coordinates on a plot. I have
>> > saved
>> > a test file as a matrix, and can read in R that "x" and "y" as well as
>> > my
>> > variables of interest are all present in the matrix file.
>> >
>> > I just don't know how to write the command for a Mantel correlogram for
>> > (e.g.) Cmic (one variable) for a particular sampling date, as well as
>> > Cmic
>> > for all 6 sampling dates (which, if they could be plotted all on one
>> > graph
>> > would be super.)
>> >
>> > The point of this is to see how Cmic (and other variables) changes in
>> > both
>> > space and time over my plot. I will then look at other belowground
>> > variables and aboveground plant biomass data for each date in the same
>> > way.
>> >
>> > I'm not even sure Mantel correlograms are the best choice here, but
>> > sadly,
>> > my lag distances for my samples aren't close enough together for me to
>> > get
>> > nice semivariograms. Originally I had hoped to have both conventional
>> > stats
>> > for changes over time coupled with maps to show changes in space at each
>> > time point. It was suggested to me that Mantel correlograms would be an
>> > alternative way to visualize spatial variability on my plot.
>> >
>> > I apologize in advance for my clumsiness with R. I have read the
>> > Legendre
>> > and Goslee papers, have studied (as best I can) both the books and the
>> > online info for this package, but since I have no (absolutely NO)
>> > experience with program languages, the help is often impenetrable to me.
>> >
>> > Any and all suggestions most welcome!
>> >
>> > Thanks very much -Kathy
>> >
>> > --
>> > Kathleen Regan
>> >
>> > University of Hohenheim
>>
>>


-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-sig-ecology mailing list