-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix coeftable
for saturated linear models
#458
Conversation
`coeftable` failed for saturated `LinearModel`s due to trying to compute F and T distributions with zero DOF.
Codecov Report
@@ Coverage Diff @@
## master #458 +/- ##
==========================================
+ Coverage 84.12% 85.12% +0.99%
==========================================
Files 7 7
Lines 819 827 +8
==========================================
+ Hits 689 704 +15
+ Misses 130 123 -7
Continue to review full report at Codecov.
|
I don't think the NaNs are right here. I guess the standard errors and t-values are already correct, i.e. Inf and zero respectively. I believe the CI should also just be |
Actually that was my first thought, but I changed to NaN when I noticed that GLMs used that already and that R did the same. But I agree it sounds mathematically more correct to use Inf, 1.0 and 0.0. This changes the behavior of |
@andreasnoack I had forgotten this PR. OK to merge? |
@nalimilan I think the infinite CIs make sense here for a saturated model, but when the model becomes "oversaturated" i.e. rank deficient, then we return NaNs for the test statistics, right? I guess that's still coherent -- in the pivoted case, the coefficients are set to zero and there's not really values for the associated errors, i.e. the errors are Not A Number. In the saturated case, it's just that the uncertainty is infinite. |
@nalimilan make a patch bump and then we can immediately tag a release 😄 |
Good point. For rank-deficient models, the PR used NaN for the t-value but not for the p-value and the CI. I've pushed a commit to fix this, with a test for I've also bumped the minor version. That seems appropriate given that this PR changes the behavior a bit in use cases that are already supported in the current release, so this isn't just a small bugfix. |
@nalimilan I agree with the minor instead of patch release. Maybe @dmbates can comment on the origin of this convention and whether everything still makes sense? The one advantage for |
@palday Let's merge? |
coeftable
failed for saturatedLinearModel
s due to trying to compute F and T distributions with zero DOF.Fixes #456.