Repository navigation
const_idx handling in GEE margins and pep8 - #2833
Conversation
|
Also I modified the covariance computation logic so that the bias reduced robust covariance is not calculated unless requested (it involves n_obs x n_obs calculations so is expensive for large clusters) |
|
@josef-pkt ready for review |
|
I'll go over it tonight. thank for the ping |
|
|
||
| if self.grid: | ||
| return self.covariance_matrix_grid(endog_expal, index) | ||
| return self.covariance_matrix_grid(endog_expval, index) |
There was a problem hiding this comment.
this looks like a bug fix, which might mean insufficient test coverage.
?
There was a problem hiding this comment.
Yes, flake8 picked this up. We don't use covariance_matrix internally anymore, instead we do everything through covariance_matrix_solve, which has decent test coverage. But covariance_matrix is useful for people who want to see the actual fitted covariance matrices. I will add some tests.
There was a problem hiding this comment.
I added a regression test for the place where the bug was fixed. We don't have a generic way to run through all of the covariance structures in a test right now, so it's not easy to have simple consistency checks like this. I will add better, more systematic testing of GEE in a future PR.
|
changes look fine, (I already read through them a few days ago when I wasn't logged into github) about pep-8: did you use autoformatting? One observation, not affected by the changes here but I just saw it: |
|
I now have it pulling the correct covariance matrix in IIRC you now have generic code to handle constraints, so GEE-specific code should all go away in future refactoring. |
| elif cov_type == "naive": | ||
| ncov = cov | ||
| elif cov_type == "bias_reduced": | ||
| bc_cov = cov |
There was a problem hiding this comment.
given that bcov and ncov are also attached to the results instance, I think they also need to be transformed to the unconstrained parameter space, don't they?
bcov = self.constraint.unpack_cov(bcov)
I'll add a general question in main comment
There was a problem hiding this comment.
@kshedden Do you still want to look at this or do we merge as is?
(I'm trying to work my way through some of the PR backlog.)
There was a problem hiding this comment.
I will look at this again and ping you before we merge.
On Mon, May 30, 2016 at 12:20 AM, Josef Perktold [email protected]
wrote:
In statsmodels/genmod/generalized_estimating_equations.py
#2833 (comment)
:if mean_params is None: warnings.warn("Unable to estimate constrained GEE " "parameters.", ConvergenceWarning) return None
if cov_type == "robust":bcov = covelif cov_type == "naive":ncov = covelif cov_type == "bias_reduced":bc_cov = cov@kshedden https://github.com/kshedden Do you still want to look at this
or do we merge as is?
(I'm trying to work my way through some of the PR backlog.)—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/statsmodels/statsmodels/pull/2833/files/45086b1d4ddcc6b10d336f4efaa8db4b95cb7ec0#r65022205,
or mute the thread
https://github.com/notifications/unsubscribe/ACiww0--eJ7NduOE6UOKw0NVnmcSe-p-ks5qGmWFgaJpZM4HeiHE
.
|
question to the score test: (Now that I understand a lot more than when GEE was initially merged, I should work my way through this code again.) |
|
@josef-pkt I think this is ready to merge now. I fixed the bug you caught about reparameterizing cov_params |
| assert_allclose(result.cov_robust.shape, np.r_[4, 4]) | ||
| assert_allclose(result.cov_naive.shape, np.r_[4, 4]) | ||
| if cov_type == "bias_reduced": | ||
| assert_allclose(result.cov_robust_bc.shape, np.r_[4, 4]) |
There was a problem hiding this comment.
integers can be tested with assert_equal (there is no floating point noise)
|
I only spot checked the last commit. Looks good to me, merging |
This PR addresses comments about const_idx handling made in #2817.
Also, pep8 fixes to GEE code and tests.