[R] Plots from lda and predict.lda

Mat Vanderklift m.vanderklift at ecu.edu.au
Mon Apr 2 05:13:56 CEST 2007

Dear all

When plotting the results of lda and predict.lda, I expect the axis
dimensions to remain essentially the same - predict.lda projects new
observations onto linear discriminants. However, I am getting different
ranges of values along the x-axis when producing plots following each:
plot(lda) yields values in the range approximately -3 to +4, while
plot(predict.lda) yields values for the first linear discriminant in the
range approximately +4 to +10 (the commands follow). Could anybody suggest
what is happening here? (I can attach files with plots separately if

Mat Vanderklift

> library(MASS)
> Sep04 <- read.table("Sep04 dataframe.txt", header=TRUE)
> trainSep04 <- Sep04[1:125,]
> Sep04.lda <- lda(Reef ~ ., trainSep04, prior=c(1,1,1,1,1,1,1)/7)
> plot(Sep04.lda, dimen=2)
> predict.Sep04 <- predict(Sep04.lda, Sep04)
> plot(predict.Sep04$x[1:125,], main="September 2004", xlab="first linear
discriminant", ylab="second linear discriminant")

More information about the R-help mailing list