Multidimensional Scaling
I've 5x14 data matrix. I'm using the MDS to get a perceptual map. I can do the MDS properly & get the result.
But my problem is in MDS we can map either row or column variables. Is it possible to map both row & column variable using MDS.
The code I used is the following:
perp<-read.csv("E:\\Projects\\Combined_3.csv")
ads.dis<-dist(perp)
perp_mds <- cmdscale(ads.dis, 开发者_如何学JAVAk = 2,eig=TRUE)
x <- perp_mds$points[,1]
y <- perp_mds$points[,2]
plot(x,y, xlab = "Coordinate 1", ylab = "Coordinate 2", type = "n")
text(x,y, labels = rownames(perp))
I'll be grateful if somebody can help me with the coding.
Regards, Ari
In general, the answer is no, not with cmdscale()
. All that cmdscale()
has knowledge of is the dissimilarity between objects. In the vegan package, there is function capscale()
which is a constrained version of principal coordinates analysis (PCoA aka MDS), but can be used for normal PCoA. It can place both the objects and the variables in a biplot-like figure:
require(vegan)
data(varespec)
mod <- capscale(varespec ~ 1)
plot(mod)
But do note that PCoA with the euclidean distance is the same as PCA, which also could be used and will naturally plot both the objects and the variables:
plot(rda(varespec))
or using base R functions
mod2 <- prcomp(varespec)
biplot(mod2)
Or did you mean the non-metric version of MDS?
精彩评论