[R] Mark each group centroid in a linear discriminant analysis plot

ashz ashz at walla.co.il
Sun Nov 10 15:31:19 CET 2013


Hi,

How can I calculate and mark each group centroid in a linear discriminant
analysis plot (using ggplot2)? 


Script:
## originate from
http://r.789695.n4.nabble.com/LDA-and-confidence-ellipse-td4671308.html
require(MASS)
require(ggplot2)
iris.lda<-lda(Species ~ Sepal.Length + Sepal.Width + Petal.Length +
Petal.Width,  data = iris)
LD1<-predict(iris.lda)$x[,1]
LD2<-predict(iris.lda)$x[,2]
ggplot(iris, aes(x=LD1, y=LD2, col=iris$Species) ) + geom_point( size = 4,
aes(color = iris$Species))+theme_bw()   




--
View this message in context: http://r.789695.n4.nabble.com/Mark-each-group-centroid-in-a-linear-discriminant-analysis-plot-tp4680159.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list