[R] discriminant analysis with lda(MASS)

Silvia Lomascolo slomascolo at zoo.ufl.edu
Mon Jun 18 17:48:19 CEST 2007


I use Widows, R version 2.4.1

I have 4 questions on lda (MASS) (code is pasted below):

1st. How can I obtain the statistics and p-value associated with
discriminant analysis? Am I supposed to calculate that manually by squaring
the svd value and looking the p value up in a table? I am writing the
following code:

training.mx<-read.table('C:\\Documents and Settings\\silvia\\My
Documents\\silvia\\paper Martin\\trainingAndvalidation.txt', header=T)
train <- sample (1:148) ##in a file with 399 cases, I am using the first 148
as a training set
table(training.mx$disperser[train])
training.df <- lda (disperser~., training.mx, subset=train)
predict (training.df, training.mx[-train,])$class

2nd. How can I get the scores for each species on the discriminant
functions? I only get the scores for the group means, but I need the values
for all species.

3rd. Is it possible to obtain confidence intervals for my groups?

4th. (this is part of a previous posting but it's related to all my previous
questions so here it goes again) When I try to plot the resulting
discriminant functions following the example I found in the help, I get an
error saying that 'panel.lda' doesn't exist. Am I supposed to create it?
Here is the code for the plot:

plot(x, panel = panel.lda, cex = 0.7, dimen=1,
     xlab = "LD1", ylab = "LD2")

Help on any or all of these questions will be greatly appreciated!

Silvia.

-- 
View this message in context: http://www.nabble.com/discriminant-analysis-with-lda%28MASS%29-tf3941130.html#a11178433
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list