[R-sig-eco] some MDS and R problems

Dave Roberts dvrbts at ecology.msu.montana.edu
Thu Jun 17 02:01:52 CEST 2010


Arnaldo,

     Given that NMDS operates essentially on rank distances, small 
variations in dissimilarity generally have low impact.  I rarely have 
points with zero dissimilarity on quantitative indices, but it sometimes 
happens on presence/absence based indices.  If you have a dissimilarity 
object named dis, I just do

 > dis[dis==0] <- 0.0001
 > res <- nmds(dis)

Following Jari's argument about the other point's contribution to 
stress, I think fudging one dissimilarity is a better solution than 
dropping out a point

Dave Roberts

Arnaldo Russo wrote:
> Hi all,
> 
> I'm executing some multivariate exploratory annalysis, with vegan and MASS
> packages.
> 
> Some problems are not solved for me at this moment. I have read all past
> discussions over MDS problems.
> 
> In my studies occurs a situation that some samples are equal each other, and
> this results in zero dissimilarities.
> 
> I tryed with no success, use the stepacross function. So, in this case I
> changed one of these zero dissimilarities values for a minimum (1e-5). Some
> of these modifications are different than "stepacross" or same isoMDS(x.dist
> + 1e-5)  (proposed by Jari oksanen to 'lie' to isoMDS? When I delete a
> sample I do not loose some weight?
> 
> Changing one of those zero dissimilarities and using zerodist = "add" option
> of metaMDS, it passed the current error (zero or negative distance between
> objects).
> 
> Someone could explain the function posted by Gavin Simpson (Jan 12, 2010;
> 05:45pm Re: Non-metric multidimensional scaling (NMDS) help). I didn't get
> some result.
> 
> If there is a good reason, and you want to include all samples, then
> you'll need to come up with a means for handling them. metaMDSdist allow
> you to add a small value to the zero dissimilarities. The details are in
>> the code, but effectively all zero distances are replaced by half the
>> smallest non zero distance. You could do a similar replacement yourself
>> if you feel this is warranted and/or justified.
>>
>> minDij <- min(Dij[Dij > 0) / 2
>> Dij[Dij <= 0] <- minDij
>>
>> Will do this replacement if Dij is your matrix (replace Dij with
>> whatever the name of your matrix is). Then supply the new matrix to
>> metaMDS. "
>>
> 
> 
> When I use unique function as #x.dist <- dist(unique(X))
> this cutted some of my samples that I do not know. I can't see my variables
> in the plot. Some help?
> 
> Cheers, Arnaldo.
> 
> 
> epi<- read.table("epi.txt", h=TRUE,row.names=1)
> 
> library('vegan')
> library('MASS')
> 
> epi.<- as.matrix(epi)
> 
> dissim1<- vegdist(epi., method="jaccard", binary=TRUE)
> dissim1.mds<-metaMDS(dissim1,k=2)
> 
> plot(dissim1.mds,type="n")
> text(dissim1.mds, labels=as.character(row.names(epi)))
> 
> #epi
> sample    sp1    sp2    sp3    sp4    sp5    sp6    sp7    sp8    sp9
> sp10    sp11    sp12    sp13    sp14    sp15    sp16    sp17    sp18    sp19
> 1E    1    0    1    0    0    0    0    0    0    0    0    0    0    0
> 0    0    0    0    0
> 2E    0    0    1    0    1    0    0    0    0    0    0    0    0    0
> 0    0    0    0    0
> 3E    1    0    1    0    0    0    0    0    0    0    0    0    0    0
> 0    0    0    0    0
> 4E    1    0    1    0    1    0    0    0    0    0    0    0    0    0
> 0    0    0    0    0
> 5E    1    0    0    0    0    0    0    0    0    0    0    0    0    0
> 0    0    0    0    0
> 6E    1    0    0    0    0    0    0    0    0    0    0    0    0    0
> 0    0    0    0    0
> 7M    1    0    1    0    0    0    1    0    0    0    0    0    0    0
> 0    0    0    0    0
> 8E    1    0    0    0    0    0    1    0    0    0    0    0    0    0
> 0    0    0    0    0
> 11E    1    0    0    0    1    0    1    0    0    0    0    0    0    0
> 0    0    0    0    0
> 12E    0    0    0    0    0    1    0    0    0    0    0    0    0    0
> 0    0    0    0    0
> 13E    0    0    0    0    0    0    1    0    0    0    1    1    0    0
> 0    0    0    0    0
> 14E    0    0    1    0    0    0    0    0    0    0    0    1    0    0
> 0    0    0    0    0
> 15E    1    0    0    0    0    0    1    0    0    0    0    0    1    0
> 0    0    0    0    0
> 17E    0    0    0    0    1    0    1    0    1    0    0    0    0    0
> 0    0    0    0    0
> 18E    0    0    0    0    0    0    1    0    0    0    0    0    0    0
> 0    0    0    0    0
> 20E    1    0    0    0    1    0    0    0    0    0    0    0    0    0
> 0    0    0    0    0
> 21E    1    0    0    0    0    0    0    0    0    0    0    0    0    1
> 0    0    0    0    0
> 22E    1    0    0    0    1    0    0    0    1    0    0    0    0    0
> 0    0    0    0    0
> 23E    1    0    1    1    1    0    0    0    0    0    0    0    0    0
> 0    0    0    0    0
> 27E    1    0    0    1    1    0    0    0    0    0    0    0    0    0
> 0    0    0    0    0
> 28E    1    0    0    0    1    0    1    1    0    0    1    0    0    0
> 0    0    0    0    0
> 30E    1    1    0    0    1    0    0    0    0    0    0    0    0    0
> 0    0    0    0    0
> 31E    0    0    0    0    0    0    0    0    0    0    0    0    0    0
> 1    0    0    0    0
> 32E    1    0    0    0    0    0    0    0    1    0    0    0    0    0
> 0    0    0    0    0
> 9E    0    0    0    0    0    1    1    1    1    1    0    0    0    0
> 0    0    1    0    0
> 10E    0    0    1    0    0    1    1    0    1    1    1    0    0    0
> 0    1    0    1    1
> 
> ------
> Arnaldo D`Amaral Pereira Granja Russo
> Instituto Ambiental Boto Flipper
> www.institutobotoflipper.com.br
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



More information about the R-sig-ecology mailing list