[R] Contrast problem

Jane McFerren jane.mcferren at lycos.co.uk
Wed Nov 27 19:20:54 CET 2002


Hi,

I have a question regarding contrasts in linear models. I have a factor variable 
age with 4 levels, in the output of the linear model I want a coefficient for each 
level of age.

I have made sure that age is a factor but am unsure how to put age into the 
model to ensure the model knows it is a factor an dto display all levels.

I have tried doing

fit<-lm(y~C(age)+sex.....) (the dot bits are the rest of the function which I have 
cut out as its not important here)

but it only displays age as though it has one level

what am I doing wrong and how can I get R to recognise its a factor?

Thanks
Jane

------------------------------------------------------
BA flight sale now at http://www.lycos.co.uk. 
Boston, £129 rtn. including tax, Wednesday, 1pm



More information about the R-help mailing list