Re: [R] LDA and confidence ellipse

2013-07-12 Thread Lluis
Thanks again



--
View this message in context: 
http://r.789695.n4.nabble.com/LDA-and-confidence-ellipse-tp4671308p4671427.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


[R] LDA and confidence ellipse

2013-07-11 Thread Lluis
Hi,

I wish to add confidence ellipse on my LDA result of the iris data set.
Therefore:
Is there statistical logic to do that as I only wish it to make the species
separation more visable?
How can I add it to the script below  (ggplot): 
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()   

Could someone please help me. Thank you very much.



--
View this message in context: 
http://r.789695.n4.nabble.com/LDA-and-confidence-ellipse-tp4671308.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] LDA and confidence ellipse

2013-07-11 Thread arun
Hi,
May be this helps:
require(MASS)
require(ggplot2)
iris.lda-lda(Species ~ Sepal.Length + Sepal.Width + Petal.Length + 
Petal.Width,  data = iris) 
datPred-data.frame(Species=predict(iris.lda)$class,predict(iris.lda)$x)

library(ellipse)
dat_ell - data.frame()
for(g in levels(datPred$Species)){
dat_ell - rbind(dat_ell, 
cbind(as.data.frame(with(datPred[datPred$Species==g,], ellipse(cor(LD1, LD2), 
 scale=c(sd(LD1),sd(LD2)), 
 
centre=c(mean(LD1),mean(LD2),Species=g))
}

ggplot(datPred, aes(x=LD1, y=LD2, col=Species) ) + geom_point( size = 4, 
aes(color = 
Species))+theme_bw()+geom_path(data=dat_ell,aes(x=x,y=y,color=Species),size=1,linetype=2)
  


A.K.


Hi, 

I wish to add confidence ellipse on my LDA result of the iris data set. 
Therefore: 
Is there statistical logic to do that as I only wish it to make the species 
separation more visable? 
How can I add it to the script below  (ggplot): 
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()   

Could someone please help me. Thank you very much.

__
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.


Re: [R] LDA and confidence ellipse

2013-07-11 Thread Lluis
Hi,

Thanks works like magic.

BTW
What is the confidence ellipses probability used?



--
View this message in context: 
http://r.789695.n4.nabble.com/LDA-and-confidence-ellipse-tp4671308p4671357.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] LDA and confidence ellipse

2013-07-11 Thread arun
Hi,
No problem.
The default should be 0.95
?ellipse()
level: The confidence level of a pairwise confidence region.  The
  default is 0.95, for a 95% region.  This is used to control
  the size of the ellipse being plotted.  A vector of levels
  may be used.

A.K.




- Original Message -
From: Lluis l.r...@gmx.us
To: r-help@r-project.org
Cc: 
Sent: Thursday, July 11, 2013 3:15 PM
Subject: Re: [R] LDA and confidence ellipse

Hi,

Thanks works like magic.

BTW
What is the confidence ellipses probability used?



--
View this message in context: 
http://r.789695.n4.nabble.com/LDA-and-confidence-ellipse-tp4671308p4671357.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


__
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.