pzivich / zEpid

Epidemiology analysis package
http://zepid.readthedocs.org
MIT License
141 stars 33 forks source link

Add option to include weights in GFormula #25

Closed pzivich closed 6 years ago

pzivich commented 6 years ago

Need to add option for weights in g-formula. Would allow for sampling weights or other options (IPCW / IPMW)

pzivich commented 6 years ago

Tentative plan: Include optional argument weights in zepid.causal.gformula.TimeFixedGFormula and zepid.causal.gformula.TimeVaryGFormula

Use statsmodels GEE to estimate each model. This is because GLM uses integer based weights. GEE allows the more dynamic weights. It would allow for both integer and non-integer weights. The disadvantage is that GEE takes a little longer to fit. Overall, should not slow down the MC simulation procedure too much

pzivich commented 6 years ago

Completed for TimeFixedGFormula. Will be part of v0.3.2 release

I need to think a little more about TimeVaryGFormula and what should be done about weights that vary over time (in regards to the MC process)

pzivich commented 6 years ago

TimeVaryGFormula uses the initial weights. IPCW should probably be avoided anyways since you can directly model censoring into the g-formula (I believe this is the recommendation).

All that is left is to test to make sure it works as intended

pzivich commented 6 years ago

Check was just seeing if usage of weights statement throws any errors. It didn't. I don't have a data set to check the results against yet though. That is for future.

Will be released as part of v0.3.2