I have a categorical response which i want to predict, so i am in the process of developing a logistic model. I am using k-fold cross-validation for model selection. The first model, which was just an intercept model is throwing negative fitted values.
So i tried adding just 2 predictors to understand what was causing this, but the model with the 2 predictors is also predicting negative probabilities.
Below is the code that i used:
logistic_null1 <- glm(SeriousDlqin2yrs ~ 1, family=binomial(), data=trainingdata) logistic_null1 <- glm(SeriousDlqin2yrs ~ age + income, family=binomial(), data=trainingdata)
I checked if may be the response Y is not a factors but doesn't seem to be the case either
> class(trainingdata$SeriousDlqin2yrs)  "factor" > check3 <- as.data.frame(predict(logistic_null1, testdata)) > summary(check3) predict(logistic_null1, testdata) Min. :-4.609 1st Qu.:-3.047 Median :-2.700 Mean :-2.703 3rd Qu.:-2.346 Max. :-1.601
What could cause this