Skip to content

ENH delta method and nonlinear prediction and test - #2296

Closed
josef-pkt wants to merge 9 commits into
statsmodels:mainfrom
josef-pkt:REF_delta_method
Closed

josef-pkt wants to merge 9 commits into
statsmodels:mainfrom
josef-pkt:REF_delta_method

Conversation

@josef-pkt

Copy link
Copy Markdown
Member
  • clean up and enhance NonlinearDeltaCov, move from miscmodels.count to stats
  • add LikelihoodModelResults._wald_test_nl as unit tested, experimental function, I'm not sure about API yet

see #2155 for delta method
??? issue for adding equivalent to predict_nl and test_nl in Stata
see also #2291 which has this PR as example or use case

test_deltacov_margeff shows how to redo a case of DiscreteMargins

Todos, questions

  • no unit tests for NonlinearDeltaCov.wald_test, coverage ? - test comparing to linear and margins
  • use_t: incompletely implemented, missing arguments and missing in wald_test
  • add t_test to NonlinearDeltaCov as vectorized wald test
  • caching: NonlinearDeltaCov does not cache results. My initial plan was that this is just a helper functions/class and the results are stored in the caller.
  • add testing linear constraints on top of nonlinear transformation: wald_test and ttest in summary could test a Null hypothesis for linear restriction of the nonlinear prediction or transformation. Essentially redundant because it can be encoded in the nonlinear function, but might be convenient for some use cases. nothing for this is implemented.
  • wrappers for specific use cases: _wald_test_nl is essentially a generic internal method. It's not clear to me yet how to make the API for user friendly versions of predict_nl and test_nl, especially we need the at and atexog (discrete margins) support.
  • can we keep joint (wald_test) and vectorized (t_test) usages in the same method or would it be better to split? see

and

  • compare with and unit test against Stata, check use cases

Naming: deriv, grad, or jac(obian) ?

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.04%) to 83.95% when pulling f9b29b2 on josef-pkt:REF_delta_method into 5dd2502 on statsmodels:master.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy paste noise

@josef-pkt

Copy link
Copy Markdown
Member Author

last commit shouldn't [skip ci] need tests for keyword argument renaming

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a class now not a function

Can parts be moved or shared with ContrastResults, like the model Results.t_test results?

@josef-pkt

Copy link
Copy Markdown
Member Author

separate internal helper function from user facing API decision. Merge basic functionality, get applications and enhancements later. (I need PRs where I don't need a long time to make up my mind.)

test coverage looks ok, so throw it in

@josef-pkt

Copy link
Copy Markdown
Member Author

rebased, no merge conflicts

@josef-pkt josef-pkt modified the milestones: 0.8, 0.10 Nov 1, 2017
@josef-pkt

Copy link
Copy Markdown
Member Author

rebase didn't trigger unit test runs,
it's because the last commit includes [skip ci]

@josef-pkt

Copy link
Copy Markdown
Member Author

according to last comments above, the basics should be ready to merge

Needs a rebase and code commit to trigger CI testing.

related:

eform, univariate monotonic transformation of individual params is in master but not used and not advertised
#2235 (comment)

What's the status on supporting pre-specified transformations, like like links or inverse_links/transforms?

another possible application:

@josef-pkt

Copy link
Copy Markdown
Member Author

merged in PR #7758

@josef-pkt josef-pkt closed this Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants