Is a logistic regression biased when the outcome variable is split 5% - 95%? I am building a propensity model using logistic regression for a utility client. 
My concern is that out of the total sample my 'bad' accounts are just 5%,  and the rest are all good. 
I am predicting 'bad'. 


*

*Will the result be biassed? 

*What is optimal 'bad to good proportion' to build a good model?

 A: I disagreed with the other answers in the comments, so it's only fair I give my own. Let $Y$ be the response (good/bad accounts), and $X$ be the covariates.
For logistic regression, the model is the following:
$\log\left(\frac{p(Y=1|X=x)}{p(Y=0|X=x)}\right)= \alpha + \sum_{i=1}^k x_i \beta_i $
Think about how the data might be collected:


*

*You could select the observations randomly from some hypothetical "population"

*You could select the data based on $X$, and see what values of $Y$ occur.


Both of these are okay for the above model, as you are only modelling the distribution of $Y|X$. These would be called a prospective study.
Alternatively:


*

*You could select the observations based on $Y$ (say 100 of each), and see the relative prevalence of $X$ (i.e. you are stratifying on $Y$). This is called a retrospective or case-control study.


(You could also select the data based on $Y$ and certain variables of $X$: this would be a stratified case-control study, and is much more complicated to work with, so I won't go into it here).
There is a nice result from epidemiology (see Prentice and Pyke (1979)) that for a case-control study, the maximum likelihood estimates for $\beta$ can be found by logistic regression, that is using the prospective model for retrospective data.
So how is this relevant to your problem?
Well, it means that if you are able to collect more data, you could just look at the bad accounts and still use logistic regression to estimate the $\beta_i$'s (but you would need to adjust the $\alpha$ to account for the over-representation). Say it cost $1 for each extra account, then this might be more cost effective then simply looking at all accounts.
But on the other hand, if you already have ALL possible data, there is no point to stratifying: you would simply be throwing away data (giving worse estimates), and then be left with the problem of trying to estimate $\alpha$.
A: Asymptotically, the ratio of positive to negative patterns is essentially irrelevant.  The problem arises principally when you have too few samples of the minority class to adequately describe its statistical distribution.  Making the dataset larger generally solves the problem (where that is possible).
If this is not possible, the best thing to do is to re-sample the data to get a balanced dataset, and then apply a multiplicative adjustment to the output of the classifier to compensate for the difference between training set and operational relative class frequencies.  While you can calculate the (asymptotically) optimal adjustment factor, in practice it is best to tune the adjustment using cross-validation (as we are dealing with a finite practical case rather than an asymptotic one).
In this sort of situation, I often use a committee of models, where each is trained on all of the minority patterns and a different random sample of the majority patterns of the same size as the minority patterns.  This guards against bad luck in the selection of a single subset of the majority patterns.
A: In theory, you will be able to discriminate better if the proportions of "good" and "bad" are roughly similar in size.   You might be able to move towards this by stratified sampling, oversampling bad cases and then reweighting to return to the true proportions later. 
This carries some risks.  In particular your model is likely to be labelling individuals as "potentially bad" - presumably those who may not pay their utility bills when due.  It is important that the impact of errors when doing this are properly recognised: in particular how many "good customers" will be labelled "potentially bad" by the model, and you are less likely to get the reweighting wrong if you have not distorted your model by stratified sampling.   
A: There are many ways in which you can think of logistic regressions. My favorite way is to think that your response variable, $y_i$, follows a Bernoulli distribution with probability $p_i$. An $p_i$, in turn, is a function of some predictors. More formally:
$$y_i \sim \text{Bernoulli}(p_i)$$
$$p_i = \text{logit}^{-1}(a + b_1x_1 + ... +b_nx_n)$$
where $\text{logit}^{-1} = \frac{\exp(X)}{1+\exp(x)}$
Now does it matter it you have low proportion of failures (bad accounts)? Not really, as long as your sample data is balanced, as some people already pointed. However, if your data is not balanced, then getting more data may be almost useless if there is some selection effects you are not taking into account. In this case, you should use matching, but the lack of balance may turn matching pretty useless. Another strategy is trying to find a natural experiment, so you can use instrumental variable or regression disconinuity design.
Last, but not least, if you have a balanced sample or there is no selection bias, you may be worried with the fact the bad account is rare. I don't think 5% is rare, but just in case, take a look at the paper by Gary King about running a rare event logistic. In the Zelig package,in R, you can run a rare event logistic.
A: Okay so I work in Fraud Detection so this sort of problem is not new to me. I think the machine learning community has quite a bit to say about unbalanced data (as in classes are unbalanced). So there are a couple of dead easy strategies that I think have already been mentioned, and a couple of neat ideas, and some way out there. I'm not even going to pretend to know what this means for the asymptotics for your problem, but it always seems to give me reasonable results in logistic regression. There may be a paper in there somewhere, not sure though.
Here are your options as I see it:


*

*Oversample the minority class. This amounts to sampling the minority class with replacement until you have the same number of observations as the majority class. There are fancy ways to do this so that you do things like jittering the observation values, so that you have values close to the original but aren't perfect copies, etc.

*Undersample, this is where you take a subsample of the majority class. Again fancy ways to do this so that you are removing majority samples that are the closest to the minority samples, using nearest neighbor algorithms and so forth.

*Reweight the classes. For logistic regression this is what I do. Essentially, you are changing the loss function to penalize a misclassified minority case much more heavily than a misclassified majority class. But then again you are technically not doing maximum likelihood.

*Simulate data. Lot's of neat ideas that I've played with here. You can use SMOTE to generate data, Generative Adversarial Networks, Autoencoders using the generative portion, kernel density estimators to draw new samples.


At any rate, I've used all of these methods, but I find the simplest is to just reweight the problem for logistic regression anyway. One thing you can do to gut check your model though is to take: 
-Intercept/beta
That should be the decision boundary (50% probability of being in either class) on a given variable ceteris paribus. If it doesn't make sense, e.g. the decision boundary is a negative number on a variable that is strictly positive, then you've got bias in your logistic regression that needs to be corrected.
