[R] Linear Discriminant Analysis in R

cobbler_squad la.foma at gmail.com
Mon Jan 4 22:18:42 CET 2010


Dear R-gurus,

Here is what I need to do..

I have two .txt files  that are in a matrix form (each looks something like
this: 
0.033482	0.02238		0.026677	
0.034553	0.023226	0.028855	
0.035017	0.023262	0.02941	
0.036262	0.023306	0.029706	
0.037252	0.024644	0.032053
)


I need to write a code such that it pulls these two matrices into a data
frame and then runs the LDA and compares the classification results of the
two stimuli against one another. I am not sure how to do that at all, but
here is what I have thus far (not sure about the syntax 100%)


# lda, nnet, prcomp, etc are in the MASS library
library(MASS)

# pull matrices (made by 3dmaskdump) into a data frame
#first file
L_heap_hoop_4 <-
data.frame(as.matrix(t(read.table(file="L_Heap_4_top_ten.txt")))*100000,syll
= c(rep("heap")) <~~~ NEED specification here
#second file
L_heap_hoop_4 <-
data.frame(as.matrix(t(read.table(file="L_Hoop_4_top_ten.txt")))*100000,syll
= c(rep("hoop")) <~~~ NEED specification here

# run the LDA and compare the clasification results of the two stimuli
against one another
table(lda(syll ~ ., L_heap_hoop_4, CV =TRUE)$class,$syll)

....

any input would be highly appreciated.
-- 
View this message in context: http://n4.nabble.com/Linear-Discriminant-Analysis-in-R-tp998567p998567.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list