migariane / TutorialComputationalCausalInferenceEstimators

Tutorial_Computational_Causal_Inference_Estimators
MIT License
29 stars 16 forks source link

Query: zEpid non-parametric vs parametric g-formula #1

Open joannadiong opened 2 years ago

joannadiong commented 2 years ago

Hi there,

Many thanks for a really interesting paper and tutorial!

This is more a Discussion query than an Issue. In the Python code boxes,

The zEpid model specification in these boxes look identical, although Box 6 header states it's for non-parametric g-formula whereas Box 8 header is for parametric g-formula. Is this because zEpid applies parametric g-formula either way?

Parametric g-formula seems to be the default application from the docs, as I understand. Apologies if I missed something.

Thanks again.

migariane commented 2 years ago

Dear Joanna, Many thanks for your interest. :-) Yes, it is more a question regarding semantics and the comparability between software. Both boxes are identical and highlight the fact that the g-formula can be estimated non-parametrically using a fully saturated parametric regression model. Yes, zEpid estimate the g-formula non-parametrically using a parametric modeling framework but fitting a fully saturated model. Such a beautiful way to deal with data and information. I do love Statistics! The science of imperfection widely supported by mathematics the science of perfection (symetry)! (even inside fractals there is kind of a beauty of perfection in the asymetric shapes)! Kind regards, Miguel Angel

pzivich commented 2 years ago

Exactly what @migariane stated. Under the hood, zEpid's g-formula fits a GLM using statsmodels. There isn't a separate option for the nonparametric g-formula in zEpid. Instead, we can fit a saturated parametric model. The saturated parametric g-formula is equivalent to the nonparametric g-formula. My intention in how I coded the g-formula in zEpid was to have the one g-formula implementation cover both the nonparametric and parametric g-formula via the saturated model 'trick'.

joannadiong commented 2 years ago

How interesting! I did not know that; great to learn new things. Thanks very much for the clarification! Cheers, Jo

joannadiong commented 2 years ago

PS: On second thoughts, I'll reopen this Issue for a while for readers so it's not buried so deep, and the Tutorial is fairly recent. Feel free to close it when appropriate. Cheers!