Logistic Regression in R with GLM giving negative probabilities even with type already as "response" I'm trying to verify the assumptions of logistic regression in R. To do this I first computed the probabilities as in the following code for the sample dataset here:
data <- read.csv('log_reg_example.csv', header=TRUE, fill=TRUE, na.strings=c("", "NA"))
data <- na.omit(data)

model <- glm(data$outcome ~ data$f1 + data$f2 + data$f3
    
probabilities <- predict(model, type = "response")

print("Probabilities")
print(probabilities)

predicted.classes <- ifelse(probabilities > 0.5, "pos", "neg")

logit <- log(probabilities/(1-probabilities))
print(logit)

However, some of these probabilities turned out to be negative negative which is causing problems when I try to compute the logit. How is it possible that there are negative probabilities? I've looked at many answers on here that just suggest to use "response" type but I already had that from the beginning.
Any ideas?

Note the Usage section of the help page to ?glm:

glm(formula, family = gaussian, ...

That is, the default value of the family parameter is gaussian. By default, glm() fits a "normal" regression with a conditional normal distribution. And of course, fits from such a model can be negative.
To run a logistic regression, replace your command with
model <- glm(data$outcome ~ data$f1 + data$f2 + data$f3, family=binomial)

