[R] your suggestions in MRMs

Sarah Goslee sarah.goslee at gmail.com
Wed Apr 8 21:14:09 CEST 2015


Kristi,

You're completely missing the point, I think.

Instead of providing X,Y coordinates in the sample dataset graze
within the ecodist package, I provided one location, X if you'd like,
called sitelocation.

If you look at the example in ?MRM,

data(graze)
LOAR10.mrm <- MRM(dist(LOAR10) ~ dist(sitelocation) + dist(forestpct),
data=graze, nperm=100)

This is a toy example,with only one species, geographic distance, and
another potential explanatory variable.

dist(LOAR10) - species distance; you'd use whatever set of species
you're studying

dist(sitelocation) - geographic distance, you'd use your x and y
coordinates as in dist(xy.matrix)

dist(forestpct) - you'd use whatever variable or variables are
appropriate for your study


I concealed the location of these sites BEFORE I made the data public,
which is why there's one location variable instead of x,y coordinates.

Each row of graze is a single site, with some information associated.

You don't need to conceal your location for your own analysis. You
just need to use the appropriate data within the dist() command to
calculate the distances, and with the appropriate distance metrics if
Euclidean isn't appropriate for your data.

Reading the papers cited in ?MRM might help you understand the logic a
bit better.

Sarah


On Wed, Apr 8, 2015 at 3:01 PM, Kristi Glover <kristi.glover at hotmail.com> wrote:
> Hi Sarah,
> Thanks for the reply. I again looked at the example, but I did not find the
> way to calculate the location variable. All example in the document
> ("ecodist") has the Euclidean distance. did not find the example to conceal
> the absolute location. There are some example:
> page 21 and 22 : iris.md <- distance(iris[,1:4], "mahal"): it is calculated
> distance matrix using four variables (I understood this one)
> page 26: space.d <- distance(space, "eucl"), here space is XY coordinate, so
> on
>
> I am just wondering how I can conceal my absolute location (XY) and make my
> data compatible to your data set so that I can use your functions. I am
> sorry for bothering you, Sarah.
>
> example of my data set: column names (site, XY coordinates, temp, years)
>
> site1, 25.01;34.78 (XY cordicnate), 35degree celcius; year2001
>
> site1, 25.01;34.78 (XY cordicnate), 33degree celcius; year2002
>
> site2, 25.05; 35.56 (XY coordinate); 37degree celcius; year2001
>
> site2, 25.05; 35.56 (XY coordinate); 32degree celcius; year2002
>
>
>
> Thanks
>
>
>
> =======
>
>
>> Date: Wed, 8 Apr 2015 14:23:27 -0400
>> Subject: Re: [R] your suggestions in MRMs
>> From: sarah.goslee at gmail.com
>> To: kristi.glover at hotmail.com
>> CC: r-help at r-project.org
>>
>> Kristi,
>>
>> The row names are utterly arbitrary. Each row is a separate site, and
>> sitelocation is a location variable (both intended to conceal the
>> absolute location, which is confidential since it's on private
>> property). It is NOT the Euclidean distance, nor is a row representing
>> a pair of sites.
>>
>> If you look at the full example, dist() is used to calculate the
>> Euclidean distance as part of the MRM code.
>>
>> Sarah
>>
>> On Wed, Apr 8, 2015 at 1:49 PM, Kristi Glover <kristi.glover at hotmail.com>
>> wrote:
>> > Hi R Users,
>> > I was trying to perfom multiple regression on resemblance matrices
>> > (MRMs). This technique in avaiable in "ecodist" package and looked at the
>> > example data to know how I need to organize my data set. I think the data is
>> > distance matrix but I was wondering the rows name. For example, there are
>> > (these are the subset of the data of "graze")
>> > sitelocation forestpct
>> > 1.1.2001 12.187743 63.88
>> > 1.2.2001 12.186077 71.33
>> > 2.1.2001 12.406362 72.45
>> > 2.2.2001 12.416265 77.13
>> > 3.1.1998 8.409213 18.35
>> >
>> > if we look at the first row, 1.1.2001: sitelocation (column) is 12.187..
>> > which is the euclidean distance between two points (XY cordinates). But I
>> > was confused at the row name where 1.1.2001 which is to me is site1 and
>> > site1 of 2001. Isn't it supposed to be "0" if both are the same site. I
>> > think I misunderstood it. Any one can help me about what it is?
>> >
>> > I put the example for your reference
>> >
>> > install.packages("ecodist")
>> > library(ecodist)
>> > data(graze)
>> > graze[1:5,1:2]
>> >
>> > Thanks for your help
>> >
>> > KG
>> >
>>
>>
>> --
>> Sarah Goslee
>> http://www.functionaldiversity.org



-- 
Sarah Goslee
http://www.stringpage.com
http://www.sarahgoslee.com
http://www.functionaldiversity.org



More information about the R-help mailing list