Repository navigation
BUG: GEE fit_history - #5789
BUG: GEE fit_history#5789
Conversation
|
Also closes #5786 |
| assert_almost_equal(score_results["df"], | ||
| mod_lr.score_test_results["df"]) | ||
|
|
||
| for f in False, True: |
There was a problem hiding this comment.
Informative variable name for f, brackets around list?
| _ = mod.compare_score_test(res_sub) | ||
|
|
||
| # Parent and submodel are the same dimension | ||
| with assert_warns(UserWarning): |
There was a problem hiding this comment.
Pytest.warns, match kwarg
| fam = sm.families.Tweedie(var_power=2, eql=True) | ||
| model1 = sm.GLM(y, x, family=fam) | ||
| result1 = model1.fit(method="newton") | ||
| result1 = model1.fit(method="newton", scale=scale) |
There was a problem hiding this comment.
Is this related to the rest of the Pr?
There was a problem hiding this comment.
before this fades into distant memory, any thoughts here?
Codecov Report
@@ Coverage Diff @@
## master #5789 +/- ##
==========================================
- Coverage 82.45% 82.41% -0.04%
==========================================
Files 594 594
Lines 93689 93707 +18
Branches 10357 10361 +4
==========================================
- Hits 77249 77229 -20
- Misses 14042 14074 +32
- Partials 2398 2404 +6
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #5789 +/- ##
==========================================
+ Coverage 82.45% 82.47% +0.02%
==========================================
Files 594 595 +1
Lines 93689 93790 +101
Branches 10357 10357
==========================================
+ Hits 77249 77354 +105
+ Misses 14042 14040 -2
+ Partials 2398 2396 -2
Continue to review full report at Codecov.
|
|
|
||
| # It is easy to forget to set the scale parameter. Sometimes | ||
| # this is intentional, so we warn. | ||
| if isinstance(self.family, families.Gaussian) and scale is None: |
There was a problem hiding this comment.
GEE also allows other families with scale != 1
https://www.statsmodels.org/dev/_modules/statsmodels/genmod/generalized_estimating_equations.html#GEE.estimate_scale
lists the families with scale=1, instead of the complement set
in general there should be a scale option as in GLM, e.g. to handle purely overdispersed Poisson (i.i.d. with scale!=1).
| qler1 = result1.qic() | ||
| qler2 = result2.qic() | ||
| with warnings.catch_warnings(): | ||
| warnings.simplefilter("ignore") |
There was a problem hiding this comment.
does this warn consistently and/or intentionally? i.e. could be pytest.warns?
| mod_sub = gee.GEE(endog, exog, group) | ||
| res_sub = mod_sub.fit() | ||
| mod = gee.GEE(endog, exog, group) | ||
| _ = mod.compare_score_test(res_sub) |
There was a problem hiding this comment.
could part of this block be outside of the pytest.warns context?
| assert_almost_equal(score_results["p-value"], | ||
| mod_lr.score_test_results["p-value"]) | ||
| assert_almost_equal(score_results["df"], | ||
| mod_lr.score_test_results["df"]) |
There was a problem hiding this comment.
future reference, the lint-compatible version of this is one of:
assert_almost_equal(score_results["df"],
mod_lr.score_test_results["df"])
assert_almost_equal(
score_results["df"],
mod_lr.score_test_results["df"])
We can't delete fit_history after fitting the model (while transferring it to the results), because we may need to call update_params or other methods on the parent model that write to the fit history.
Also add some warnings.