Repository: statsmodels/statsmodels

Issue:
ConditionalLogit not available in version 0.13.1 of statsmodels
#### ConditionalLogit is not available in version 0.13.1 of statsmodels

[This is my first time using statsmodels (thank you so much btw for such great program) and I have no problem estimating some logit models using statsmodels but the conditionallogit  model is not available at all in my configuration and I get the following error:


![image](https://user-images.githubusercontent.com/95703515/148813661-3297c74c-435a-401c-8fa5-a29eb6e66c3d.png)

My current configuration/versions are:
Python 3.8.12
Numpy 1.22.0
Statsmodels 0.13.1

Also, I already tried by reinstalling statsmodels and I confirmed that ConditionalLogit is not installed by running the following:
![image](https://user-images.githubusercontent.com/95703515/148814065-68d0d5f0-4382-42bf-972a-43ce0b8a6ed7.png)
 

Thank you so much.

Adrian



Discussion:
Looks like it has not been added to the api modules

try
`from  statsmodels.discrete.conditional_models import ConditionalLogit`
As general tip: 
we can search the docs and find the full path
https://www.statsmodels.org/dev/generated/statsmodels.discrete.conditional_models.ConditionalLogit.html
The full path can be used to check if something is available in your version.

But that is also not always conclusive, because sometimes we also forget to add new functionality to the documentation.
(in that case only searching the code helps)


> Looks like it has not been added to the api modules
> 
> try `from statsmodels.discrete.conditional_models import ConditionalLogit`

Hi Josef,
thanks for this tip and for the quick reply.
Best.
Adrian

Resolving patch:
diff --git a/statsmodels/api.py b/statsmodels/api.py
--- a/statsmodels/api.py
+++ b/statsmodels/api.py
@@ -3,6 +3,9 @@
 __all__ = [
     "BayesGaussMI",
     "BinomialBayesMixedGLM",
+    "ConditionalLogit",
+    "ConditionalMNLogit",
+    "ConditionalPoisson",
     "Factor",
     "GEE",
     "GLM",
@@ -70,6 +73,12 @@
 
 from . import datasets, distributions, iolib, regression, robust, tools
 from .__init__ import test
+from ._version import get_versions
+from .discrete.conditional_models import (
+    ConditionalLogit,
+    ConditionalMNLogit,
+    ConditionalPoisson,
+)
 from .discrete.count_model import (
     ZeroInflatedGeneralizedPoisson,
     ZeroInflatedNegativeBinomialP,
@@ -122,7 +131,6 @@
 from .tools.tools import add_constant, categorical
 from .tools.web import webdoc
 from .tsa import api as tsa
-from ._version import get_versions
 
 __version__ = get_versions()["version"]
 del get_versions
diff --git a/statsmodels/formula/api.py b/statsmodels/formula/api.py
--- a/statsmodels/formula/api.py
+++ b/statsmodels/formula/api.py
@@ -1,5 +1,6 @@
 import statsmodels.regression.linear_model as lm_
 import statsmodels.discrete.discrete_model as dm_
+import statsmodels.discrete.conditional_models as dcm_
 import statsmodels.regression.mixed_linear_model as mlm_
 import statsmodels.genmod.generalized_linear_model as glm_
 import statsmodels.robust.robust_linear_model as roblm_
@@ -26,10 +27,16 @@
 nominal_gee = gee_.NominalGEE.from_formula
 gee = gee_.GEE.from_formula
 glmgam = gam_.GLMGam.from_formula
+conditional_logit = dcm_.ConditionalLogit.from_formula
+conditional_mnlogit = dcm_.ConditionalMNLogit.from_formula
+conditional_poisson = dcm_.ConditionalPoisson.from_formula
 
-del lm_, dm_, mlm_, glm_, roblm_, qr_, hr_, gee_, gam_
+del lm_, dm_, mlm_, glm_, roblm_, qr_, hr_, gee_, gam_, dcm_
 
 __all__ = [
+    "conditional_logit",
+    "conditional_mnlogit",
+    "conditional_poisson",
     "gee",
     "glm",
     "glmgam",


Test patch: