Handle case of negative model_ss for IV2SLS#101
Handle case of negative model_ss for IV2SLS#101jsr-p wants to merge 2 commits intoStatsReporting:masterfrom
Conversation
|
Hi @jsr-p , thanks for reporting this! I am not sure I have no preference, do you? |
|
When I tried to exclude it another error got raised later on while it assumes that I do not have any preferences 😄 |
I think (but I should double check) that to omit it you should just set it to
Well, if the goal is (some form of) enlightening, I would go for the negative one. Except I should understand how to compute it. |
|
Hmm, thinking more about it, and actually opening up the good ol' c&t book + the documentation of The problem in the IV case can be seen here in the source code. The I.e. the solution is actually simpler :=) |
Update resid_std_error linearmodels Update resid_std_error linearmodels
When using the package I got an
ValueError: math domain errorwhen creating a table forIV2SLSmodels.The reason for this is that we take the
sqrtwhen computing theresid_std_errorand in my case, the model_ss was negative.Yes, the residual sum of squares (
model_ss) can be negative in the context of IV estimation; see this great answer.This PR creates a function that handles this case.
However, I am not sure whether setting it to
nanis the best solution, although at least this signals to the user that themodel_ssis not interpretable; it should be dropped altogether for IV models.