zEpid icon indicating copy to clipboard operation
zEpid copied to clipboard

Replace magic-g in g-formula implementations

Open pzivich opened this issue 5 years ago • 1 comments

Both TimeFixedGFormula and TimeVaryGFormula leverage a "magic-g" factor to implement custom treatment plans (i.e. treatments aside from "all" and "none" specifications)

As discussed in #61 it is not readily clear to users that the magic-g factor exists and is necessary. While in the function documentation and on the website, it would be beneficial to be clearer. For now, I am going to attempt to make the documentation clearer. If I find an adequate solution (that works for both implementations), then I will make that transition in the future.

Bandage for Current

  • [ ] Make better documentation available on both website and function documentation

  • [ ] Create a better warning/error handler for when the magic-g is NOT specified

Requirements

  • Evaluate the data row-by-row

  • Needs to be able to handle multiple conditionals

Alternatives

  • pd.query() looks promising. However, it does not evaluate as I would hope. It returns the df[...] data. What I would like it a vector of 0 and 1 (or others depending on variable type).

  • pd.eval() look it to

pzivich avatar Jan 15 '19 00:01 pzivich

The magic-g will not be used by IterativeCondGFormula from v0.6.0 onwards. Rather the iterative conditional g-formula takes a list of treatment values. You can also generate a matrix of the treatment plan and pass that to this g-formula.

None of the other g-formula implementations have this type of behavior. I needed to use this since custom treatments are hard to specify otherwise in this g-formula

pzivich avatar Mar 30 '19 14:03 pzivich