Repository navigation
WIP: fit_constrained - #1714
WIP: fit_constrained#1714
Conversation
|
test failures: python 3: print in junk function (draft for another example based on randhi) TestPoissonConstrained 1a and 2a look like convergence failures on one python 2.7 |
|
The last commit added start_params, but used it only in one of the two non-converging test cases. |
|
no StringIO import on python 3 |
tests for GLM.fit_constrained and llnull
|
TravisCI failure: I attached the auxiliary, transformed results to the regular results instance. I didn't attach it in Poisson.fit_regularized |
|
No, unrelated to fit_regularized (unit tests don't check that case) |
There was a problem hiding this comment.
don't keep monkeys in the unit tests :)
|
It took me a while to find out why my changes don't work anymore for the GLM-logit test case. |
|
How can they put a close button where there is supposed to be a cancel comment button. |
silence warning in test (unless DEBUG)
GLM fit_constrained: overwrite history (not nice)
|
@jseabold @kshedden I'm about done here, or as far as I want to go in this PR only Poisson and GLM for now If the _wrap functions that modifies an existing model work out, then I think we can add more of those that without needing to incorporate them in every model. Pinv/PCR for non-linear models (Poisson and GLM again) would be my next transform candidate. |
|
Ready for the green button, when TravisCI comes back green Follow-up will be extension to other models, and getting a pattern and naming for |
|
missing: adding to release notes |
ENH: fit_constrained for Poisson and GLM, and standalone
ENH: fit_constrained for Poisson and GLM, and standalone
add constrained fitting to models
starting with generic setup and Poisson as example.
OLS was test example for transformation, but has separate RestrictedGLS implementation, PR #1673
currently only count models and GLM have offset
using correction to endog instead of offset is not implemented in the function
(I have a separate example code for that, linear case is more related to RestrictedGLS PR)
Those two need to be overwritten in the creation of the results instance.
I would prefer generic results creation see REF DRYing fit methods #1615, but will start with a full test case for Poisson.
use_t=Truemaybe no problem: Likelihood function doesn't change, we just evaluate it at the constrained parameters.
need to check what kshedden did for score test in GEE.
code duplication:
base.TransformRestrictionhas the same purpose as Kerby's version in GEE. I haven't checked if the result is identical.Unit tests
I have added more test results from Stata that haven't been use so far, unconstraint, and constraint with
vce(robust)optionI don't know what
vce(robust)does in Stata, and I haven't figured out yet how to add sandwich robust covariances to GLM. Stata also allows HAC and cluster robust vce in GLM.follwow-up
transform_params_constraintthat obtains restricted parameters from the unrestricted parameters (approximate in non-linear models, similar to Wald test)examples/try_fit_constrained.pycontains example with application to linear model (OLS) and example fortransform_params_constraint