Repository: statsmodels/statsmodels

Issue:
Confusion regarding the smf module
This code works fine as expected:

```python
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf

n = 100
data = pd.DataFrame({"y": np.random.poisson(lam=1, size=n), 
                     "x": np.random.randn(n)})

result = smf.poisson("y ~ x", data).fit()
result.summary()
```

The problem happens when the user mistakenly tries to use the `Poisson` class (which doesn't use the formula syntax, yet it is imported within the module nonetheless and will even autocomplete if the user makes the mistake of capitalizing the P) within the `smf` class as below,

```python
result = smf.Poisson("y ~ x", data).fit()
result.summary()
```

It is very easy to make this mistake and the resulting error message is quite cryptic, so I am wondering if there is a way to fix this.  It seems that the `smf` module should not directly expose those classes that don't follow the formula syntax.


Discussion:
this got lost #833
we just need `del xxx` to remove the original classes from the namespace
@josef-pkt I created a pull request for this.  I think it went through, although I'm seeing some git weirdness locally.
No need for del.  Just use `__all__` which is the standard method to limit namespace.
`__all__` still leaves the classes in the name space and is not enough.
`__all__` works for `from xxx import *` and a few other things.
`__all__` is enough that tab completion will not pick them up, which should be the goal.
Oops, you are right -- it doesn't hide from IPython.  So `del` it is.
I'm closing this as duplicate of #833

Resolving patch:
diff --git a/statsmodels/formula/api.py b/statsmodels/formula/api.py
--- a/statsmodels/formula/api.py
+++ b/statsmodels/formula/api.py
@@ -1,33 +1,28 @@
-from statsmodels.regression.linear_model import GLS
-gls = GLS.from_formula
-from statsmodels.regression.linear_model import WLS
-wls = WLS.from_formula
-from statsmodels.regression.linear_model import OLS
-ols = OLS.from_formula
-from statsmodels.regression.linear_model import GLSAR
-glsar = GLSAR.from_formula
-from statsmodels.regression.mixed_linear_model import MixedLM
-mixedlm = MixedLM.from_formula
-from statsmodels.genmod.generalized_linear_model import GLM
-glm = GLM.from_formula
-from statsmodels.robust.robust_linear_model import RLM
-rlm = RLM.from_formula
-from statsmodels.discrete.discrete_model import MNLogit
-mnlogit = MNLogit.from_formula
-from statsmodels.discrete.discrete_model import Logit
-logit = Logit.from_formula
-from statsmodels.discrete.discrete_model import Probit
-probit = Probit.from_formula
-from statsmodels.discrete.discrete_model import Poisson
-poisson = Poisson.from_formula
-from statsmodels.discrete.discrete_model import NegativeBinomial
-negativebinomial = NegativeBinomial.from_formula
-from statsmodels.regression.quantile_regression import QuantReg
-quantreg = QuantReg.from_formula
-from statsmodels.duration.hazard_regression import PHReg
-phreg = PHReg.from_formula
-from statsmodels.genmod.generalized_estimating_equations import (GEE,
-     OrdinalGEE, NominalGEE)
-gee = GEE.from_formula
-ordinal_gee = OrdinalGEE.from_formula
-nominal_gee = NominalGEE.from_formula
+import statsmodels.regression.linear_model as lm_
+import statsmodels.discrete.discrete_model as dm_
+import statsmodels.regression.mixed_linear_model as mlm_
+import statsmodels.genmod.generalized_linear_model as glm_
+import statsmodels.robust.robust_linear_model as roblm_
+import statsmodels.regression.quantile_regression as qr_
+import statsmodels.duration.hazard_regression as hr_
+import statsmodels.genmod.generalized_estimating_equations as gee_
+
+gls = lm_.GLS.from_formula
+wls = lm_.WLS.from_formula
+ols = lm_.OLS.from_formula
+glsar = lm_.GLSAR.from_formula
+mixedlm = mlm_.MixedLM.from_formula
+glm = glm_.GLM.from_formula
+rlm = roblm_.RLM.from_formula
+mnlogit = dm_.MNLogit.from_formula
+logit = dm_.Logit.from_formula
+probit = dm_.Probit.from_formula
+poisson = dm_.Poisson.from_formula
+negativebinomial = dm_.NegativeBinomial.from_formula
+quantreg = qr_.QuantReg.from_formula
+phreg = hr_.PHReg.from_formula
+ordinal_gee = gee_.OrdinalGEE.from_formula
+nominal_gee = gee_.NominalGEE.from_formula
+gee = gee_.GEE.from_formula
+
+del lm_, dm_, mlm_, glm_, roblm_, qr_, hr_, gee_


Test patch: