I have written a logistic regression routine using the Newton-Ralphson algorithm in VBA for use in a class that I teach which uses primarily EXCEL. I want the algorithm to test for complete and quasi-separation of data points and display a descriptive error message to the user when this is encountered (very much like SAS does. (Unlike SAS, I want my algorithm to just display the error message and stop - Not even provide the questionable model results)).
I have some idea how to go about testing for complete separation:
However, my methods require identifying each explanatory variable as either continuous or indicator beforehand and only then test for complete separation based on the data type (continuous vs. indicator). Can you anyone suggest an algorithm for detecting complete separation that would work for both continuous and indicator variables?
For quasi-separation, I am unsure how to measure the degree of quasi-separation (When I read the SAS documentation, I find no information on how SAS identifies the quasi-separation condition):
1) How to measure the degree of quasi-separation for each explanatory variable? Is there a single approach that is appropriate for both continuous and indicator explanatory variables?
2) How to combine these into a single measure of quasi-separation for the entire set of explanatory variables (the model as a whole)?
3) What degree of quasi-separation is problematic to the extent that the Newton-Ralphson estimates become unreliable and the warning/error message should be displayed?
Any assistance is appreciated.