-
Notifications
You must be signed in to change notification settings - Fork 23
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
Feature/add patsy formulas #60
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a total stan/patsy n00b here, so don't feel like I can CR at a higher level and talk about the functionality, but here are a few suggestions/comments regarding the coding style.
survivalstan/survivalstan.py
Outdated
value in pars.items()])) | ||
return(lhs_formula) | ||
|
||
def _gen_surv_formula(rhs_formula, event_col, time_col=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe pull this and all of the other functions above into the SurvivalStanData
since I believe they are ony being used in that context. If you think that would make things crowded for a single class, maybe it is worth implementing a utility class that you init with a formula once then can use for further sanity checks, e.g.:
formula = FormulaChecks(formula)
if formula.has_lhs():
...
Changes Unknown when pulling 2dee964 on feature/add-patsy-formulas into ** on dev**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments - let's catch up briefly offline so I can get some background?
self.subject_id = Id('subject') | ||
self.timepoint_id = Id('timepoint') | ||
self.group_id = Id('group') | ||
self._type = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comments explaining what _type
and _grouped
are?
Any news on this? It would be very cool! |
Have migrated this work to PR #77 |
Some code refactoring in order to support using patsy formulas for LHS as well as RHS spec. Closes #52
Models can now use the following syntax:
Optional parameters to
surv
includegroup=
andsubject=
.The previous syntax is still also supported:
Moved a fair amount of data-processing into the
survivalstan.formulas
module, which extends patsy syntax to support the above. For example, thepatsy.ModelDesc
module includes the stan-data dict which gets passed to pystan.stan for sampling.This ipynb tests early versions of this code and may help demonstrate how the elements in
formulas.py
fit together.