I checked your data. Now I have to get some sense out of your code. You do :
G <- vowel_features[15]

cvc_lda <- lda(G~ vowel_features[15], data=mask_features,
na.action="na.omit", CV=TRUE)

Firstly, as I suspected, you need to select a column by using
vowel_features[,15] . Mind the comma! Essentially, your data frame is a list
and a matrix. You select by using [x,y] with x being the row number and y
being the column number.

Essentially, your code says :
cvc_lda=lda(vowel_features[,15]~vowel_features[,15]...)

You're modelling a variable on itself which gives an error. What do you want
to do in fact? If I take a look at your first code, it appears as if you
want to do this :

cvc_lda <- lda(G~ ., data=mask_features,na.action="na.omit", CV=TRUE)

The dot indicates you want to model G in function of all variables in the
dataset mask_features. Ain't going to work, as the dimensions are completely
wrong.

> dim(mask_features)
[1] 671  52
> dim(vowel_features)
[1] 254  26
>

For lda, you need a dataset that has following structure :
mydata
group    V1   V2   V3   V4 ...
0           x1    y1   z1   q1 ...
1           x2    y2   z2   q2 ...
...

So you can do lda(group~V1+V2+V3+V4+..., data=mydata,...)

For example :

# make some random data
x <- rep(c(0,1),50)
y1 <- rnorm(100,x)
y2 <- rnorm(100,1-x)

# combine it in a dataframe
mydata <- data.frame(x,y1,y2)
str(mydata) # look at the structure, you should have something similar
head(mydata) # look the values, this shows you whether it all worked

# example of lda function
my.lda <- lda(x~y1+y2,data=mydata,CV=T)
summary(my.lda)

Take a look at your data again, and first figure out which data you actually
want to use. Basically, for every observation in G you need a set of linked
observations in some variables. But as it is now, it's impossible to link
one dataframe with the other.

Cheers
Joris

On Sun, May 30, 2010 at 7:00 AM, cobbler_squad <la.f...@gmail.com> wrote:

>
> Hi Janis,
>
> As you have suggested below is the output for the following:
>
> test.vowel <- vowel_features[,1:10]
> test.mask <- mask_features[,1:10]
> dput(test.vowel)
> dput(test.mask)
>
> --- NOTE: outputs are limited
>
> >>test_vowel  ---- first 12 columns are all zero (total of 26 columns)
>     V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
> 1    0  0  0  0  0  0  0  0  0   0
> 2    0  0  0  0  0  0  0  0  0   0
> 3    0  0  0  0  0  0  0  0  0   0
> 4    0  0  0  0  0  0  0  0  0   0
> 5    0  0  0  0  0  0  0  0  0   0
> 6    0  0  0  0  0  0  0  0  0   0
> 7    0  0  0  0  0  0  0  0  0   0
> 8    0  0  0  0  0  0  0  0  0   0
> 9    0  0  0  0  0  0  0  0  0   0
> 10   0  0  0  0  0  0  0  0  0   0
>
> >>test_mask (sample output for first 6 columns and 5 rows)
>
>             V1          V2                    V3                  V4
> V5          V6
> 1   0.034495155 0.990218632 0.601464511 0.014837676 0.058299799 0.818202398
> 2   0.683688879 0.541566798 0.898061753 0.008456439 0.800863858 0.381366477
> 3   0.464978895 0.844494807 0.281241401 0.290183593 0.552412608 0.158107894
> 4   0.200058599 0.270115497 0.179173377 0.341301213 0.672338934 0.322934948
> 5   0.595020534 0.633111358 0.861024861 0.811241462 0.326562913 0.363330793
>
>
> >>dput(test.vowel)
> structure(list(V1 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L), V2 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L), V3 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L), V4 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L), V5 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L), V6 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L), V7 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L), V8 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L), V9 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L), V10 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L, 0L)), .Names = c("V1", "V2", "V3", "V4", "V5",
> "V6", "V7", "V8", "V9", "V10"), class = "data.frame", row.names = c(NA,
> -254L))
>
> >>dput(test.mask)
> structure(list(V1 = c(0.034495155, 0.683688879, 0.464978895,
> 0.877838275, 0.943014871, 0.163438168), V2 = c(0.990218632, 0.541566798,
> 0.025567579, 0.159811845, 0.13874224, 0.752357297, 0.669662897,
> 0.854803677, 0.28129096, 0.858919573, 0.98992922, 0.980733255,
> 0.452405459, 0.376828532, 0.901208552), V3 = c(0.601464511, 0.898061753,
> 0.38395498, 0.923324665, 0.529832526, 0.182135661), V4 = c(0.014837676,
> 0.166132726, 0.893089168, 0.45962114, 0.018438501, 0.667720635
> ), V5 = c(0.058299799, 0.800863858, 0.552412608, 0.672338934,
> 0.185407787, 0.691367432), V6 = c(0.818202398, 0.381366477, 0.158107894,
> 0.322934948, 0.363330793, 0.161321704, 0.052999774, 0.513440813,
> 0.402895033, 0.201576687, 0.076826481), V7 = c(0.642136394, 0.099776129,
> 0.148801865, 0.603051825, 0.440594157, 0.215038249, 0.531623479,
> 0.534920743, 0.45784502, 0.080887221), V8 = c(0.016004048, 0.519115043,
> 0.149317949, 0.088362708, 0.705002368, 0.185590863, 0.434963787,
> 0.847410734, 0.78777694, 0.443995646, 0.53903599), V9 = c(0.400620271,
> 0.918472003, 0.446820588, 0.310981412, 0.734013866, 0.172112916
> ), V10 = c(0.532136091, 0.350028839, 0.40424688, 0.607395545,
> 0.392450857, 0.306530929, 0.756277707, 0.63606622, 0.718866192,
> 0.258778101)), .Names = c("V1", "V2", "V3", "V4", "V5", "V6",
> "V7", "V8", "V9", "V10"), class = "data.frame", row.names = c(NA,
> -671L))
>
>
> Thank you once more for your help. I really can not say it enough.
>
> ps. original files i work with are attached.
>
> Cobbler.
>
> http://r.789695.n4.nabble.com/file/n2236083/3dMaskDump.txt 3dMaskDump.txt
> http://r.789695.n4.nabble.com/file/n2236083/vowel_features.txt
> vowel_features.txt
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Linear-Discriminant-Analysis-in-R-tp2231922p2236083.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
joris.m...@ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to