Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
BUG: patsy raises with zero constraint #89
Why does patsy raise a ValueError in this case?
It looks like a perfectly valid degenerate case.
patsy\constraint.py", line 62:
(In my opinion patsy should not enforce statistics, but can warn instead.)
added a commit
Jul 9, 2016
I don't quite understand what you're trying to do here, but I guess I agree that there's no reason to rule out degenerate constraints like this.
There's another similar case that we also error out on right now: constraint matrices with zero rows. Currently the patch in #90 alters patsy to allow for constraints to have a row with all-zero coefficients, but it still doesn't allow for constraints with no rows at all. But semantically, I guess this would be an "always true" constraint, similar to
I never ran into the empty, zero rows constraints. But in many cases, the consistent empty array handling is convenient.
In the case of t_test, after commenting out the zero rows check in patsy:
repr and string summary of test results raises an exception, but all the computation look like they work correctly based on np.linalg and dot behavior with empty arrays.
So, from the statsmodels side the zero row exception could also be removed. (we have to fix the string summary to fully support it)
the above is for OLS with just numpy arrays, but it works the same way with formulas.
all zeros constraint, that I ran in before but, AFAIR, wasn't needed in final design for that (constrained estimation):