You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since I was just reading the section in the Stata manual for Probit
A question that was just asked on the LinkedIn Econometrics group
Logistic Regression Drops Variable of Interest
Hello. I am running a logistic regression, but one of the variables of interest has no observations
in one of the categories of the dependent variable. So, basically, for x=1, y is always 1. For x=0,
y can be both 0 or 1. When i run this model, logistic regression essentially omits this variable
because of perfect predictability. But this is a variable of interest. A friend of mine suggested
that if i introduce a random error term into x, then we can preserve the coefficient by "tricking"
stata into estimating this coefficient. So, basically, instead of x, i now have the regression with
a new variable, x1 = x + random normal with mean zero, and std div small but greater than zero.
This does indeed give me a coefficient! The question I have for this group is whether this is a
fairly well known technique or not. I searched Google but did not find any discussions about it,
so hoping that you can help me.
I think I don't like the automatic "cleaning" of the data by Stata. But we should be able to provide tools to get around corner cases like perfect separation. (After users got the exception.)
As explanation: Stata checks for perfect prediction cases, and if there is, then it drops the perfectly prediction variable and removes the affected observations.
This happens if only one of the "states" choices can be perfectly predicted. If all can be perfectly predicted, then also Stata returns with an error message.
(according to the Stata manual for Probit, and IVProbit.)
Hi, I'm new to statsmodels, and this thread. I'd like to work on this issue, and I have some related questions:
I'd like to clarify that we do want to implement functionality to raise an exception in the case of perfect separation (using techniques from Konis' thesis?), and provide tools to deal with these cases in the Logit and MNLogit methods?
Is anyone else currently working on this issue? (I'd prefer not to duplicate work.) Do I need this issue to be assigned to me to eventually make a pull request?
There are few other related issues open, IIRC.
There is also an open issue to "handle" perfect separation by penalized MLE or a Bayesian prior.
We want to warn and detect, but it is not always clear whether the default needs to be raising an exception. I added the option to turn off the perfect separation exception in Logit because I still wanted to get the results instead of a exception.
Any work would be welcome. Nobody is working on this right now, and nobody mentioned an intention to work on this. My work in cases like these, is to add some parts when I have a bit of time and something induces me to check out that neighborhood of the code.
I'm interested in what you come up with based on the work in the Konis paper. My impression from a quick read that it might not be super practical for large-ish datasets, but I'd love to be proved wrong.
Activity
josef-pkt commentedon May 29, 2014
As explanation: Stata checks for perfect prediction cases, and if there is, then it drops the perfectly prediction variable and removes the affected observations.
This happens if only one of the "states" choices can be perfectly predicted. If all can be perfectly predicted, then also Stata returns with an error message.
(according to the Stata manual for Probit, and IVProbit.)
josef-pkt commentedon Feb 28, 2015
storing a few more links to related discussion
http://www.statalist.org/forums/forum/general-stata-discussion/general/797637-how-to-deal-with-separation-in-logistic-regressions-in-stata
http://stats.stackexchange.com/questions/88226/how-to-describe-and-present-the-issue-of-perfect-separation?rq=1
http://stats.stackexchange.com/questions/11109/how-to-deal-with-perfect-separation-in-logistic-regression/68917#68917
josef-pkt commentedon Feb 28, 2015
related open issues
#659
#2282
jseabold commentedon Jul 15, 2015
Detecting perfect separation
http://ora.ouls.ox.ac.uk/objects/uuid:8f9ee0d0-d78e-4101-9ab4-f9cbceed2a2a
soumyadsanyal commentedon Jul 23, 2015
Hi, I'm new to statsmodels, and this thread. I'd like to work on this issue, and I have some related questions:
I'd like to clarify that we do want to implement functionality to raise an exception in the case of perfect separation (using techniques from Konis' thesis?), and provide tools to deal with these cases in the Logit and MNLogit methods?
Is anyone else currently working on this issue? (I'd prefer not to duplicate work.) Do I need this issue to be assigned to me to eventually make a pull request?
josef-pkt commentedon Jul 23, 2015
(I'm online only for 5 minutes, so just a brief update)
The binary models, Logit, Probit in discrete_models raise currently an exception with perfect separation, which can be optionally weakened to a warning (or turned off?)
We don't check anywhere else yet.
for MNLogit see http://stackoverflow.com/questions/31507396/mnlogit-in-statsmodel-returning-nan
GLM binary models also don't check for perfect prediction.
There are few other related issues open, IIRC.
There is also an open issue to "handle" perfect separation by penalized MLE or a Bayesian prior.
We want to warn and detect, but it is not always clear whether the default needs to be raising an exception. I added the option to turn off the perfect separation exception in Logit because I still wanted to get the results instead of a exception.
Any work would be welcome. Nobody is working on this right now, and nobody mentioned an intention to work on this. My work in cases like these, is to add some parts when I have a bit of time and something induces me to check out that neighborhood of the code.
jseabold commentedon Jul 23, 2015
I'm interested in what you come up with based on the work in the Konis paper. My impression from a quick read that it might not be super practical for large-ish datasets, but I'd love to be proved wrong.