Created
July 25, 2014 20:45
-
-
Save gwerbin/275a5df837dabcf74dda to your computer and use it in GitHub Desktop.
PCA & MDS demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(spls) | |
require(MASS) | |
data(prostate) | |
pca <- prcomp(prostate$x) | |
plot(pca$x,main="Principal components mapping of Prostate data",xlab="Dim 1",ylab="dim 2") | |
plot(pca$x,main="Principal components mapping of Prostate data",xlab="Dim 1",ylab="dim 2",pch=prostate$y+1) | |
sam <- sammon(dist(prostate$x)) | |
plot(sam$points,main="Sammon mapping of Prostate data",xlab="Dim 1",ylab="Dim 2",pch=prostate$y+1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment