Binomial GLM using caret

I would like to put Binomial GLM on a specific dataset. Using glm (..., family = binomial) everything works fine, but I would like to do it with the traint train () function. Unfortunately I am getting an unexpected error that I cannot get rid of.


MissUSA <- MissAmerica08[,c(2,4,6,7,8,10)]
formula<-cbind(Top10, 9-Top10)~.
glmfit <- glm(formula=formula,data=MissUSA,family=binomial())

trainfit<-train(form=formula,data=MissUSA,trControl=trainControl(method = "none"),   method="glm",  family=binomial()) 


The error I am getting is: "Error: nrow (x) == length (y) is not TRUE"


source to share

1 answer


does not support grouped data for binomial result. You can expand the data into a factorial variable that is binary (Bernoulli). Also, if you do, you don't need to use family=binomial()

in the call train





All Articles