[R] best ordination method for binary variables

David L Carlson dcarlson at tamu.edu
Thu Feb 28 14:57:39 CET 2013


It is always useful to look at the data in multiple ways. The unique()
function will remove the duplicates in your data so that isoMDS will work:

> set.seed(42)
> x <- matrix(sample(0:1, 20, replace=TRUE), 10, 2)
> x
      [,1] [,2]
 [1,]    1    0
 [2,]    1    1
 [3,]    0    1
 [4,]    1    0
 [5,]    1    0
 [6,]    1    1
 [7,]    1    1
 [8,]    0    0
 [9,]    1    0
[10,]    1    1
> unique(x)
     [,1] [,2]
[1,]    1    0
[2,]    1    1
[3,]    0    1
[4,]    0    0

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of marco milella
> Sent: Wednesday, February 27, 2013 6:09 AM
> To: r-help at r-project.org
> Subject: [R] best ordination method for binary variables
> 
> Dear all,
> 
> I'm analyzing a dataset (A) of 400 cases with 11 binary variables.
> Unfortunately, several (actually a lot) of cases are identical. NA are
> also
> present.
> I want to to plot distances between cases.
> For this, I obtained a distance matrix by dist(A, method="binary"). I
> then
> analyzed the obtained distance via Principal coordinate analysis with
> cmdscale(). Results are fine.
> However, do you think this is a wrong approach? After reading the
> literature and previous posts, I noticed that non metrical MDS (via
> isoMDS
> or metaMDS) could be a more correct choice.
> The problem is that, when trying this methods, I immediately get
> problems
> due to the identity between several of mycases or the presence of NA.
> 
> Typical error messages are
> 
> *"Error in isoMDS(DistB, k = 3) : zero or negative distance between
> objects
> 1 and 2"*
> 
> or
> 
> *"Error in if (any(autotransform, noshare > 0, wascores) && any(comm <
> 0))
> { : missing value where TRUE/FALSE needed*
> *In addition: Warning message:*
> *In Ops.factor(left, right) : < not meaningful for factor"*
> 
> 
> Do you think Principal coordinate analysis on a binary distance matrix
> is a
> decent strategy?
> Thanks for any suggestion
> marco
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list