Hi trzeszutek,
Another approach you might want to look at is the clustergram:
http://www.r-statistics.com/2010/06/clustergram-visualization-and-diagnostics-for-cluster-analysis-r-code/

<http://www.r-statistics.com/2010/06/clustergram-visualization-and-diagnostics-for-cluster-analysis-r-code/>
Cheers,
Tal

----------------Contact
Details:-------------------------------------------------------
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------




On Wed, Aug 18, 2010 at 6:20 PM, trzeszutek <rzes...@mcmaster.ca> wrote:

>
> Hello All,
>
> I'm having some trouble figuring out what the clearest way to plot my
> k-means clustering result on an my existing MDS.
>
> First I performed MDS on my distance matrix (note: I performed k-means on
> the MDS coordinates because applying a euclidean distance measure to my raw
> data would have been inappropriate)
>
> canto.MDS<-cmdscale(canto)
>
> I then figured out what would be my optimum k-value by plotting the within
> sums of squares for K1-K15
>
> > wss <- (nrow(canto.MDS)-1)*sum(apply(canto.MDS,2,var))
> > wss[2] <- sum(kmeans(canto.MDS,centers=2)$withinss)
> > wss[3] <- sum(kmeans(canto.MDS,centers=3)$withinss)
> > wss[4] <- sum(kmeans(canto.MDS,centers=4)$withinss)
> > wss[5] <- sum(kmeans(canto.MDS,centers=5)$withinss)
> > wss[6] <- sum(kmeans(canto.MDS,centers=6)$withinss)
> > wss[7] <- sum(kmeans(canto.MDS,centers=7)$withinss)
> > wss[8] <- sum(kmeans(canto.MDS,centers=8)$withinss)
> > wss[9] <- sum(kmeans(canto.MDS,centers=9)$withinss)
> > wss[10] <- sum(kmeans(canto.MDS,centers=10)$withinss)
> > wss[11] <- sum(kmeans(canto.MDS,centers=11)$withinss)
> > wss[12] <- sum(kmeans(canto.MDS,centers=12)$withinss)
> > wss[13] <- sum(kmeans(canto.MDS,centers=13)$withinss)
> > wss[14] <- sum(kmeans(canto.MDS,centers=14)$withinss)
> > wss[15] <- sum(kmeans(canto.MDS,centers=15)$withinss)
>
> > plot(1:15, wss, type="b",xlab="Number of Clusters", ylab="Within groups
> > sum of squares")
>
> I found my "elbow" at K=7 so i performed k-means for K=7 and attached the
> cluster designations to my MDS data frame:
>
> > fit<-kmeans(canto.MDS,7)
> > canto.kmeans<-data.frame(canto.MDS, fit$cluster)
>
> Now my problem is that I want to plot the MDS with coloured points
> (according to population designation, which I can do) but overlay some sort
> of silhouette or oval to make the cluster assignment clear (which will be
> different from the population designation). Is there some sort of function
> akin to "points" that can do this for me?
>
> Attached is my plot for within sums of squares and an example of the MDS
> plot on which I want to plot cluster assignment.
>
> Thanks in advance for your assistance,
>
> Tom
>
> __________________________________________________________________________________________
>
> Tom Rzeszutek
> MSc. Candidate
> rzes...@mcmaster.ca
>
> The NeuroArts Lab (neuroarts.org)
> McMaster University
> Department of Psychology, Neuroscience and Behaviour
> 1280 Main St. W
> Hamilton, ON, Canada
> L8S 4K1
>
>
> http://r.789695.n4.nabble.com/file/n2330000/withinSS.png
> http://r.789695.n4.nabble.com/file/n2330000/MDS.png
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Plotting-K-means-clustering-results-on-an-MDS-tp2330000p2330000.html
> Sent from the R help mailing list archive at Nabble.com.
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to