Displaying 2 results from an estimated 2 matches for "lda_analysis".
2009 Oct 14
1
plot discriminant analysis
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...
2009 Oct 15
1
Discriminant plot
....
I hope somebody will correct me if I am wrong.
Alain
Alejo C.S. wrote:
> Hi Alain, this is the code:
>
>
> library(MASS)
> library(mda)
>
>
> #data attached, first column "G3" group membership
>
> X <- read.table("data", header=T)
>
> lda_analysis <- lda(formula(X), data=X)
>
> plot(lda_analysis, col=palette()[X$G3])
>
> #the above plot is completely different to:
>
> plot(predict(lda_analysis)$x, type="n")
> text(predict(lda_analysis)$x, labels=predict(lda_analysis)$class,
> col=palette()[predict(lda_an...