[R-sig-eco] specifying a "chord" distance matrix in metaMDS
Jari Oksanen
jari.oksanen at oulu.fi
Wed Sep 22 20:50:37 CEST 2010
On 22/09/10 21:42 PM, "Mike Rennie" <mikerennie.r at gmail.com> wrote:
> Hi all,
>
> I have been running principal coordinates analysis on a "chord" distance
> matrix (stand normalized for some) using cmdscale. I am trying now to do
> this with metaMDS but running into some issues.
>
> I can execute the code by specifying the distance matrix, and it works
> fine...
>
> obj.nmds<-metaMDS(dist.mat, k=4)
>
> FYI, I got the chord distance matrix as follows:
>
> dist.mat<-vegdist(decostand(as.matrix(orig.dat), "norm"),"euclidean")
>
> I get a solution, and can get at all the site scores in the object dist.mat.
> However, I also want species scores, which means I need to specify the
> starting dataset in the command.
>
> My question is: how do I specify the chord distance as a command in metaMDS?
> I've tried a bunch of things that don't work. I know my code should
> eventually look something like:
>
Mike,
obj.nmds <- metaMDS(decostand(orig.data, "norm"), "euclid", k=4,
zerodist="add", autotrans=FALSE)
> obj2.nmds<-metaMDS(orig.dat, distance = "something that specifies chord
> distance", k=4, zerodist="add", autotransform = FALSE, wascores=TRUE)
>
> It's the "something that specifies chord distance" that I'm having trouble
> with. R seems to want a string descriptor there, and I want to give it the
> call to vegdist but it doesn't look like it wants to let me. If I try and
> submit the call to vegdist, e.g.,
>
> obj2.nmds<-metaMDS(orig.dat, distance =
> vegdist(decostand(as.matrix(orig.dat), "norm"),"euclidean"), k=4,
> zerodist="add", autotransform = FALSE, wascores=TRUE)
>
>
> I get an error saying "invalid distance method".
>
> Surely there's a way around this, but it seems like a coding issue which is
> why I'm not including example data.
>
> Any thoughts?
>
> Mike
>
> PS- I also gather from reading other posts that I should loop this 50 times
> or so to make sure I don't end up on some local solution?
If it doesn't converge, continue with
obj.nmds <- update(obj.nmds, previous = obj.nmds)
cheers, Jari Oksanen
More information about the R-sig-ecology
mailing list