Repository navigation
ENH: Gaussian process regression - #4691
Conversation
|
This pull request introduces 1 alert when merging 3bd98db into 6611e87 - view on lgtm.com new alerts:
Comment posted by lgtm.com |
Codecov Report
@@ Coverage Diff @@
## master #4691 +/- ##
=========================================
+ Coverage 81.98% 82% +0.01%
=========================================
Files 588 590 +2
Lines 93151 93512 +361
Branches 10325 10368 +43
=========================================
+ Hits 76371 76681 +310
- Misses 14406 14430 +24
- Partials 2374 2401 +27
Continue to review full report at Codecov.
|
|
@kshedden How soon do you want to merge this? Do you have a notebook example? I only skimmed parts of the PR. |
|
No big rush on this. It's fully maximum likelihood, so different from GEE-Gaussian where the covariance parameters are estimated separately and plugged in. I will try to add an example. |
|
This pull request introduces 2 alerts when merging 91353eb into 4c601f6 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
|
@josef-pkt, I would like to merge this soon if no objections. I have used it a lot and it has held up pretty well. |
|
Do you have an example with usage? There are no unit tests for |
|
I'm trying out the formula test case for t_test to work, I need to patch the results/model instance ( Is there a reason why |
|
Here is a simulation that shows how this can be used: |
|
the only problem on travis that I can see is one unrelated XPASS in one environment |
|
comparing to GEE bse with cov_type='naive': There will be a few more comments for changes, e.g. add fittedvalues and resid to results instance, which I guess have the standard definition as predict() and endog - predict() I'm still trying to understand this a bit better. |
|
The covariance matrix is also parametric. The whole thing is a finite dimensional (parametric) MLE, joint for mean and covariance. The parameterization of the covariance matrix is taken from Paciorek and Schervish, but the implementation would easily allow for other parametric covariance models, e.g. AR or Matern. |
|
It reminds me a bit of Stata's xtgls https://www.stata.com/manuals13/xtxtgls.pdf except that you have an MLE version. I think it might be better to find a name that indicates MLE with heteroscedasticity and correlation. I also compared with ols with cluster robust standard errors (differences look about in the same range as changing seeds for random. gp might have on average smaller bse, and it should have a bit more accurate mean parameter estimates)
I don't understand the parametric covariance part. The GaussianProcessRegression terminology is really confusing me. |
| raise ValueError("groups is a required argument") | ||
|
|
||
| if subset is not None: | ||
| warnings.Warn("'subset' is ignored") |
There was a problem hiding this comment.
pydev is red here and lines 308, 646, 649
Warn shouldn't be capitalized
| score[0:pm] += np.dot(self.exog[ix, :].T, dcr) | ||
|
|
||
| # The derivatives for the standard deviation parameters. | ||
| rx = np.outer(resid[ix], resid[ix]) |
There was a problem hiding this comment.
My guess is that repeated indexing here is costly.
It would be better to get the indexed array once and keep it during the iteration in the loop
e.g. use resid_i = resid[ix] at the beginning of the loop
similarly with other arrays that don't change during the loop iteration, e.g. sd[ix], sm[ix] are used 4 times each
(I'm spot checking not reviewing line by line)
|
maybe something like maybe a name with I read the description in the ProcessRegression more carefully, and it is clearly written, it's just the use of an unqualified |
|
I'd like to have |
f1e096a to
6dfb57c
Compare
|
|
||
| from scipy.stats.distributions import norm | ||
| df["t"] = df.coef / df["std err"] | ||
| df["P>|t|"] = norm.cdf(2 * (1 - np.abs(df.t))) |
There was a problem hiding this comment.
Is this correct?
shouldn't this be the usual 2 * norm.sf(np.abs(f.tvalues))
|
LGTM. |
This is an implementation of maximum likelihood joint estimation of mean and covariance structures for clustered data, using gaussian process-style covariance specifications.