I'm trying to perform ANCOVAs in R 1.14, on a Mac OS X, but I can't figure out what I am doing wrong. Essentially, I'm testing whether a number of quantitative dental measurements (the response variables in each ANCOVA) show sexual dimorphism (the sexes are the groups) independently of the animal's size (the concomitant variable). I have attached a 13-column matrix as a data frame (so far, so good). But then I tried to do this:>model<-lm(ln2~sex*ln1)or this:>model<-lm(ln2~sex+ln1)and got this: Warning message: - not meaningful for factors in: Ops.factor(y, z$residuals) which I don't understand. (In my matrix, ln2 is the name of the second column, a response variable, and ln1 is the name of the first column, a concomitant variable. Sex is the rightmost column, indicating sex. The first 14 rows are measurements for male individuals, and the next 13 rows are measurements for female individuals.) The data output is bizarre, too--it's just so long, and everything begins with "ln 11" or "ln 12". How can I fix this? I have another question: If possible I would like to use a robust fit algorithm to fit the data. When I attempt to do this, substituting rlm() for lm(), the program returns another message: Error in rlm.default(x, y, weights, method = method, wt.method = wt.method, : 'x' is singular: singular fits are not implemented in rlm What is a singular fit and why is it, apparently, undesirable? I am new to R and any help would be greatly appreciated. Thanks so much, Rebecca Sealfon
rebecca.sealfon at duke.edu writes:> I'm trying to perform ANCOVAs in R 1.14, on a Mac OS X, but I can't figure out?! There's no version 1.14 of R.> what I am doing wrong. Essentially, I'm testing whether a number of > quantitative dental measurements (the response variables in each ANCOVA) show > sexual dimorphism (the sexes are the groups) independently of the animal's size > (the concomitant variable). I have attached a 13-column matrix as a data frame > (so far, so good). But then I tried to do this: > > >model<-lm(ln2~sex*ln1) > > or this: > > >model<-lm(ln2~sex+ln1) > > and got this: > > Warning message: > - not meaningful for factors in: Ops.factor(y, z$residuals) > > which I don't understand. (In my matrix, ln2 is the name of the second column, > a response variable, and ln1 is the name of the first column, a concomitant > variable. Sex is the rightmost column, indicating sex. The first 14 rows are > measurements for male individuals, and the next 13 rows are measurements for > female individuals.) > > The data output is bizarre, too--it's just so long, and everything begins with > "ln 11" or "ln 12". How can I fix this?My best guess is that you have a data error so that ln1 and ln2 are not read as numeric variables. Nonstandard codes for missing will do that to you, for instance. -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907