-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indexable model #167
base: master
Are you sure you want to change the base?
Indexable model #167
Conversation
Codecov Report
@@ Coverage Diff @@
## master #167 +/- ##
==========================================
- Coverage 84.78% 82.28% -2.51%
==========================================
Files 9 9
Lines 493 508 +15
==========================================
Hits 418 418
- Misses 75 90 +15
Continue to review full report at Codecov.
|
I think this might begin to address a larger problem we have. Although we have the ability to go from a formula to a model, we don't have a way to do the reverse. I know this is difficult to ensure because it's up to packages like GLM.jl and MixedModels.jl to support this sort of behavior, but if we want to be able to plot the results of |
I like this idea generally, and it's related to other discussions about overhauling the modeling API (e.g., requiring that |
Presumably this would be a fall back, returning a Named Tuple for just the statistics models are required to have, if any, right? Most packages would have to write their own |
After looking at #32 it seems like we want to move towards the formula interface and less so |
Related issue is #111, which would be extremely useful. |
I'm reviving this. David do you have anything in mind for how exactly this should work? The inter-linking of PRs and Issues here suggests this problem is likely in a chicken-or-the-egg state. Is there concrete groundwork that really has to be done before we can implement this feature more? |
What would this look like for |
I don't know! Probably something like
But my knowledge of all of this is pretty weak. @Tokazama I agree that #111 would be super useful here. It would make it a lot easier to index into a model. |
Just realized that R's outputs are indexable via heavy use of named arrays
I regret having let this languish. Hopefully I can pick it up soon. |
This is a very short PR that serves as a test for a feature that I think would be nice in StatsModels. It allows you to index a model by a
Term
.It is motivated by Stata functionality like
_b[`var']
which allows you to, get thebeta
coefficient for the column represented byvar
. This is really useful when making tables and graphs programatically.My approach is to take in a model and a
AbstractTerm
. Then check if theAbstractTerm
matches, roughly, something in the model. If it does, match, it returns aNamedTuple
with the coefficient name, coefficient, and the standard error.Note that in the last line
Term(:x)
is not aContinuousTerm
orCategoricalTerm
, I just match thex.sym
paramter.