# Probability of what is being predicted in glm

In documentation to glm I read: "For binomial and quasibinomial families the response can also be specified as a factor (when the first level denotes failure and all others success)" Does it mean that probability of failure or success is being modeled?

I'm trying to apply simple logistic model to "german credit scoring" dataset where there are levels "good" and "bad". To get correct results (higher probability means higher likelihood of being good) I have to assume that Failure=Good and Success=Bad. This works, but it is really counterintuitive. I interpret this as - this will model probability of Failure (failed to be bad).

require(ggplot2)

names(german_data) <- c('ca_status','mob','credit_history','purpose','credit_amount','savings',
'present_employment_since','status_sex','installment_rate_income','other_debtors',
'present_residence_since','property','age','other_installment','housing','existing_credits',
'job','liable_maintenance_people','telephone','foreign_worker','gb')

str(german_data)

german_data$gb <- factor(german_data$gb,levels=c(2,1),labels=c("bad","good"))

levels(german_data$gb)[1] table(german_data$gb)

german_data\$prob <- predict(model,newdata=german_data, type="response")

ggplot(data=german_data) + geom_boxplot(aes(y=prob,x=gb))  + coord_flip()


The probability of 'success' is what's being modelled, in glm & in a fairly common terminology: though it really doesn't matter; you get equivalent models however you code the different levels of the response (the coefficients simply switch sign).
In any case, the way you've set it up in your example bad is the first level ('failure')—good is therefore 'success'. And even if you're modelling the probability of something bad—a production defect, a death—you don't have to call it a success, you can just call it what it is.