# R lda() graphing with two groups - histogram or scatterplot?

I am using a discriminant function analysis to see which environmental variables best discriminate my study wetlands into those occupied by a species and those not occupied.

I have 23 wetlands and 11 environmental variables and am interested in distinguishing two groups: occupied wetlands vs unoccupied wetlands. I am using R and the MASS package function lda().

Because I am only interested in two groups, only one linear discriminant function is produced. I am therefore interested to know what the appropriate way to graph the data is?

I am able to produce both a scatter plot or a histogram (see below). I would prefer the scatter plot but then this is LD1 plotted against an arbitrary x-axis (essential the x-axis goes from 1 to 23 (my number of sites), the y-axis is the range of the discriminant function values, and then the first site is assigned to x=1 and its discriminant function value is plotted). Is it therefore not appropriate to use a scatter plot in this situation? I assume also in this case then you cannot calculate a 95% confidence interval ellipse...?

#code for my discriminant analysis
hab.lda <- lda(grp ~ ., data=hab_std)

hab.lda.values <- predict(hab.lda, hab_std)
hab.class <- predict(hab.lda)$class #create a histogram of the discriminant function values ldahist(data = hab.lda.values$x[,1], g=grp)

#create a scatterplot of the discriminant function values
plot(hab.lda.values$x[,1], type="n", xlim=c(0,30), ylab=c("LDA Axis 1")) text(hab.lda.values$x[,1], row.names(hab_std),  col=c(as.numeric(hab.class)+10))
abline(v=0, lty="dotted")
abline(h=0, lty="dotted")


I have spent a lot of time searching for an answer online and in the literature but have found no satisfying answer. Thus advice on the correct way to plot the data would be greatly appreciated!

Here are the pictures of the a) scatterplot b) histogram  – Pete
Mar 26, 2015 at 16:52
• Okay, they are now added to the post.
– tsms
Mar 27, 2015 at 20:17