Hi Alain, thanks for the fast response. I've the same results with iris
data, but when I use my data (mentioned in the first message), I have
different results.

Regards,

Alejo

2009/10/14 Alain Guillet <alain.guillet@uclouvain.be>

> Hi,
>
> I did it with
>
> Iris <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]), Sp =
> rep(c("s","c","v"), rep(50,3)))
> train <- sample(1:150, 75) table(Iris$Sp[train])
> z <- lda(Sp ~ ., Iris, prior = c(1,1,1)/3, subset = train)
>
> Then I did plot(z,xlim=c(-10,10),ylim=c(-10,10)) before drawing
> points(predict(z)$x,
> col=palette()[predict(z)$class],xlim=c(-10,10),ylim=c(-10,10)) and all the
> points are superimposed. The only difference I found was the different x-
> and y-axis when I drew them separately, i.e.
> plot(z)
> plot(predict(z)$x, col=palette()[predict(z)$class])
>
>
> Alain
>
>
>
> Alejo C.S. wrote:
>
>> I'm confused on how is the right way to plot a discriminant analysis made
>> by
>> lda function (MASS package).
>> (I had attached my data fro reproduction). When I plot a lda object :
>>
>> X <- read.table("data", header=T)
>>
>> lda_analysis <- lda(formula(X), data=X)
>>
>> plot(lda_analysis)
>>
>> #the above plot is completely different to:
>>
>> plot(predict(lda_analysis)$x, col=palette()[predict(lda_analysis)$class])
>>
>> that should be the same graph than the first?
>>
>> In the second case, I use predict function to obtain the LD1 and LD2
>> coordinates of lda_analysis (predict(lda_analysis)$x) and it's respective
>> class (predict(lda_analysis)$class), but it seems that the classes are
>> different:
>>
>> table(X$G3, predict(lda_analysis)$class)
>>
>>        B    G   M
>>  B  29    0    3
>>  G    0  26   2
>>  M   4    0  46
>>
>>
>> any clues?
>> Regards,
>>  ------------------------------------------------------------------------
>>
>> ______________________________________________
>> 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.
>>
>>
>
> --
> Alain Guillet
> Statistician and Computer Scientist
>
> SMCS - Institut de statistique - Université catholique de Louvain
> Bureau c.316
> Voie du Roman Pays, 20
> B-1348 Louvain-la-Neuve
> Belgium
>
> tel: +32 10 47 30 50
>
>

	[[alternative HTML version deleted]]


