How to detect a quasi separation problem for a data set? Suppose that we have a two-column data set. One column consists of a hundred x=0 and a hundred x=1, whereas the other one consists of y's (1 or 0 response). Besides, suppose that the P(Y=1|X=0) = 0.001 and P(Y=1|X=1) = 0.05. When fitting a logistic model (glm(y ~ x)) to this data set, why are we having a quasi separation problem here?
My doubts are as follows:
Since P(Y=1|X=0) = 0.001, we have P(Y=0|X=0) = 0.999. On the other hand, P(Y=1|X=1) = 0.05, so P(Y=0|X=1) = 0.95. As a result, we would see Y=0 with a very high chance when x=0 or 1. Why does this situation imply a quasi separation problem?
Next, why log[(0.05/0.95)/(0.001/0.999)] = 4 is the theoretical coefficient of x in the model?
Thanks.
 A: To answer you second question: the coefficient is called the log odds ratio, and this is a very apt name as it is literaly the logarithm of the ratio of odds. The odds is the expected number of successes per failure. So if x=1 and and there are $n_1$ persons with x=1 then we expect to find $.05n_1$ successes and $(1-.05)n_1$ failures, so we expect $\frac{.05n_1}{(1-.05)n_1}=.05/.95=1/19\approx.053$ successes per failure. Similarly the odds of success is $.001/(1-.001)=1/999\approx.001$ when x=0. So the odds of succes is $\frac{.05/.95}{.001/(1-.001)}=\frac{1/19}{1/999}=999/19\approx 53$ times larger when x=1 compared to the odds of succes when x=0. This is the odds ratio. If we take the natural logarithm of that we get $\ln(999/19) \approx 4$, which is the number you were looking for.
A: Quasi-separation occurs when one cell has a 0 in it. Since the population probability of one cell in the model you show is 0.001, unless the sample is quite large it is likely that this cell will have 0 in the sample. 
As to your second question - well, that is how coefficients are calculated in logistic regression. See any good book on the subject; e.g. Kleinbaum and Klein
