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
Add G-formula #10
Comments
Thoughts on how to allow custom specification: Allow input to be a str object like Don't know how i feel about this solution. The user would HAVE to specify |
This is the solution I am going to use. It works well in my testing. User will need to specify Still might want to add in checks to see whether user specified |
For Basically, I think the user will need to specify which variables are lagged and what they correspond to. A dictionary where the keys are the variables and the values are the columns of the lagged variables. With this addition, I should have some executable code for both g-formulas. TODO: testing (compared to 722), see if there is any way to make it easier for the user, optimize run time (I am particularly concerned about the time-varying g-formula since it does a lot of operations |
Also functional forms for continuous covariates that are predicted are another complex issue... Not sure how to fix that yet |
Ugly solution and probably confusing is to use Not happy with this as the solution, however I am going to proceed since I don't know another solution yet. Functional forms for time-varying confounders is not great... While not the most elegant solution, it should give the user a lot of control to specify. However it will get cumbersome for very complicated recodings. However, it might just be better to write a quick function and call that through this |
As somewhat expected, the time-varying g-formula takes a while to run. Memory error occurs with the sort_values functionality I need to look into some ways to minimize the draw (and speed everything up if possible) |
Time-varying G-formula works. A little slow and pulls too much memory. Currently uses |
Have a working version of both versions of the G-formula. Closing this issue since they have both been added to the GitHub page. Still have the TODO list in the TimeVary file itself. At this stage, implementation is still experimental and has not been verified |
One lofty goal is to implement the G-formula. Would need to code two versions; time-fixed and time-varying. The Chapter by Robins & Hernan is good reference. I have code that implements the g-formula using pandas. It is reasonably fast.
TODO: generalize to a class, allow input models then predict, need to determine how to allow users to input custom treatment regimes (all/none/natural course are easy to do), compare results (https://www.ncbi.nlm.nih.gov/pubmed/25140837)
Time-fixed version will be relatively easy to write up
Time-varying will need the ability to specify a large amount of models and specify the order in which the models are fit.
Note; I am also considering reorganizing in v0.2.0 that IPW/g-formula/doubly robust will all be contained within a folder caused causal, rather than adding to the current ipw folder
The text was updated successfully, but these errors were encountered: