[R] test logistic regression model

Gábor Malomsoki gm@|om@ok|1980 @end|ng |rom gm@||@com
Sun Nov 20 16:01:41 CET 2022


Dear all,

i have created a logistic regression model,
 on the train df:
mymodel1 <- glm(book_state ~ TG_KraftF5, data = train, family = "binomial")

then i try to predict with the test df
Predict<- predict(mymodel1, newdata = test, type = "response")
then iget this error message:
Error in model.frame.default(Terms, newdata, na.action = na.action, xlev =
object$xlevels)
Factor  "TG_KraftF5" has new levels

i have tried different proposals from stackoverflow, but unfortunately they
did not solved the problem.
Do you have any idea how to test a logistic regression model when you have
different levels in train and in test df?

thank you in advance
Regards,
Gabor

	[[alternative HTML version deleted]]



More information about the R-help mailing list