[R] SOS! error in GLM logistic regression...

Ben Bolker bolker at ufl.edu
Wed Jul 15 02:16:38 CEST 2009




losemind wrote:
> 
> Hi all,
> 
> Could anybody tell me what happened to my logistic regression in R?
> mylog=glm(mytraindata$V1 ~ ., data=mytraindata, family=binomial("logit"))
> 
> It generated the following error message:
> 
> Error in model.frame.default(Terms, newdata, na.action = na.action,
> xlev = object$xlevels) :
>   factor 'state1' has new level(s) AP
> 
> 
> 

Hard to say:

>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.

 Can you give us a reproducible example, i.e. your data or a subset thereof
that
we can use to generate the same error message?

By the way,

glm(V1 ~ ., data=mytraindata, family=binomial)

should work equally well (you don't need to specify mytraindata$ before V1,
and the logit is the default link for the binomial family)

  Ben Bolker

-- 
View this message in context: http://www.nabble.com/SOS%21-error-in-GLM-logistic-regression...-tp24489300p24489949.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list