Confirming the dependent variable / outcome in logistic regression

I'm running logistic regressions in Python using statsmodels logit. My dependent variable is binary, 0 or 1.

How do I know whether the regression is modeling an outcome of 1 or an outcome of 0 for the dependent variable? (And, therefore, whether the coefficients correspond to an outcome of 1 or 0?)

For example, one of the parameters, age, has a positive coefficient of 0.03. How do I know whether age is positively correlated with outcome == 1, or positively correlated with outcome == 0? ​

• in statsmodels: if the response variable is numeric 0, 1, then 1 is the event, i.e. predict Prob(y=1 | x). However, if the response variable is categorical and formulas are used, then the formula conversion flips the order of 0 and 1, github.com/statsmodels/statsmodels/issues/2181 Jul 16 at 15:09

Logistic regression predicts $$P(1)$$, and we get $$P(0)$$ via $$1-P(1)$$. Remember that the GLM deals with a binomial response variable that models the probability of getting a "success", defined as $$1$$ in the usual way we define the binomial PMF.

Therefore, a coefficient of $$0.03$$ means that, for every one-unit increase in the corresponding variable, expect an increase of $$0.03$$ in the log-odds of $$1$$.

(Always keep in mind that logistic regression is predicting a log-odds (or a probability, depending how you elect to look at it), not a discrete outcome. Predicting discrete outcomes is surprisingly problematic.)

• To confirm, when you say P(1) and "log-odds of 1," by "1" you're referring to dependent_variable == 1, correct? Jul 14 at 21:07
• I am. So I follow your reasoning, what else could it be?
– Dave
Jul 14 at 21:08
• Well, I guess dependent variable could alternatively be zero. But if I understand you correctly, it sounds like the default for logistic regression is always for the model to predict P(1). Jul 14 at 21:12
• I mean the log-odds (or probability) of the event coded as $1$, yes.
– Dave
Jul 14 at 21:14