# Predicted probability values from Logistic regression are negative [closed]

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) [1] "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 ## closed as off-topic by gung♦, Silverfish, Nick Cox, John, Christoph HanckMar 29 '16 at 9:38 This question appears to be off-topic. The users who voted to close gave this specific reason: • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – gung, Silverfish, Nick Cox, John, Christoph Hanck If this question can be reworded to fit the rules in the help center, please edit the question. • Questions about how R code works are off topic here. In addition, please consider reading the documentation (?predict.glm). In particular, note the type argument & its default. – gung Mar 28 '16 at 22:25 • @gung: sorry about that. I was not sure whether it was because of my code or if such a scenario was possible in logistic. – Raj Mar 28 '16 at 22:26 • You have negative predicted values on the log odds scale. When you convert them into probabilities, they will be in the interval$(0,\ .5)\$. – gung Mar 28 '16 at 22:28

From ?predict.glm, you can read that by default the type of prediction will be the link function (log odds for logistic regression) instead of probabilities.
predict(logistic_null1, testdata, type="response")