Fix for #2043.
TST: Test VAR when constant is already present
ENH: Options for behavior if constant is already present. Closes #2043.
@josef-pkt Do you have an opinion about changing the default behavior here to raise if a constant is already present? Alternatively, I can leave the current behavior and make fixes downstream, though I kinda convinced myself that the current behavior is a wart and working around it probably isn't the right thing to do.
TST: Test new add_constant behavior.
In general I think it's fine. I'm finishing up some unit tests so I can open a PR, and can look at it more carefully in an hour or so.
I'm not sure about the default, 'raise' or skip/ignore which has been our general policy so far
I just want to close #2043 with this. SIngular exog/highly collinear term handling is not addressed here. The problem is with trend='c' in VAR and there's already a constant in the model. This raises a better error message sooner rather than later. The main change here is that people relying on the do nothing behavior of add_constant will now get an error raised. I'm assuming this is a very small number of people, if any. add_trend calls add_constant internally, so that's covered.
I understand the limited change here, but I don't want to change the default again when we add full "singular" handling because then we change the behavior several times across releases.
If we know more changes are coming, then I'd rather not do incremental API changes.
For example, we could keep the default at ignore in the helper function and use the raise option when it is called in #2043
Ok, yeah. Seems like a fair enough concern and easy enough to avoid
changing the default until we know what more full-featured reduced rank
handling will look like.
Actually, I think the singular check (has already a constant) is relatively easy, although maybe not very cheap.
Kevin's original code for checking for implicit constant was just comparing the rank before and after adding the constant. If it doesn't increase by one, then a implicit or explicit constant is already in there.
REF: Handle has_constant in model.
REF: Don't change default behavior of add_constant.
BUG: Fix obvious errors for recarrays.
ENH: Add constant checks for ct and ctt.
ENH: Raise on constant for SVAR.
DOC: Add stub for 0.6.1 release fixes.
Backport PR #2093: Add user control over what happens if a constant i…
…s already present.
Fix for #2043.