[R] glm error: factor levels
Birgitle
birgit.lemcke at systbot.uzh.ch
Wed Jul 30 12:34:31 CEST 2008
Hello R-Users, again me!
I have a data.frame with 291 rows, 82 columns.
Tha variables in the columns are factors, numerics and ordered factors.
The response variable is a factor with two levels.
I would like to find the best model by trying every possible variable
combination using a logistic regression and comparing the AIC (still have to
find out how to do this fast and easy).
I am aware of the step function but would like to do it also without step.
But unfortunatley I have allready a problem with the first model using all
variables:
df.glm<-glm(RespVar~.,family="binomial",data=df)
I get back this:
Fehler in `contrasts<-`(`*tmp*`, value = "contr.treatment") :
Kontraste können nur auf Faktoren mit 2 oder mehr Stufen angewendet
werden
Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") :
contrasts can only be used for factors with two or more levels
There are no variables with less than two levels in my data.frame but here
are missing values (NA).
I could imagine that some observations are deleted due to missingness and
perhaps after that, some of the variables contain only one level.
I would be happy if somebody could tell me if my speculation could be true
and perhaps also how I could find out which variables I have to delete to
avoid this problem.
Many thanks in advance.
B.
-----
The art of living is more like wrestling than dancing.
(Marcus Aurelius)
--
View this message in context: http://www.nabble.com/glm-error%3A-factor-levels-tp18730487p18730487.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list