[R] Linear Discriminant Analysis in R
cobbler_squad
la.foma at gmail.com
Thu May 27 17:28:11 CEST 2010
Joris,
You are a life saver. Based on two sample files above, I think lda should go
something like this:
vowel_features <- read.table(file = "mappings_for_vowels.txt")
mask_features <- data.frame(as.matrix(read.table(file =
"3dmaskdump_ICA_37_Combined.txt")))
G <- vowel_features[15]
cvc_lda <- lda(G~ vowel_features[15], data=mask_features,
na.action="na.omit", CV=TRUE)
ERROR: Error in model.frame.default(formula = G ~ vowel_features[15], data =
mask_features, :
invalid type (list) for variable 'G'
I am clearly doing something wrong declaring G (how should I declare
grouping in R when I need to use one column from vowel_feature file)? Sorry
for stupid questions and thank you for being so helpful!
---------
again, sample files that I am working with:
mappings_for_vowels.txt:
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20
V21 V22 V23 V24 V25 V26
1 E 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0
0 0 0 0 0 0
2 o 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0
1 0 1 0 0 0
3 I 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0
0 0 0 0 0 0
4 ^ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0
0 0 0 0 0 0
5 @ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1
0 0 0 0 0 0
and the mask_features file is:
V42 V43 V44 V45 V46
V47 V48 V49
[1,] 2.890891625 2.881188521 2.887784444 -2.882606612 -2.888877341
2.879834384 2.886483229 2.883815864
[2,] 2.763404707 2.756198683 2.761863881 -2.756827983 -2.762268531
2.754305072 2.760017050 2.758399799
[3,] 0.556614506 0.556377530 0.556247414 -0.556300910 -0.556098321
0.557495060 0.557383073 0.556867424
[4,] 0.367065248 0.366962036 0.366870087 -0.366794442 -0.366644148
0.366613343 0.366537320 0.366953464
[5,] 0.423692393 0.421835623 0.421741829 -0.421897460 -0.421659824
0.421567705 0.421465738 0.422407838
--
View this message in context: http://r.789695.n4.nabble.com/Linear-Discriminant-Analysis-in-R-tp2231922p2233333.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list