Using models to compute the law of total probabilities #1128
Replies: 1 comment
-
This isn't really a G-computation is done by running avg_predictions(mY, variables = "A") This computes the predictions of Y under each value of A and averages each over the empirical distribution of C, which is exactly what Ashley describes as g-computation on p15 in the formula starting with |
Beta Was this translation helpful? Give feedback.
-
I am going through an example of the parametric G-formula here (in the PDF it starts on page 16). We simply want to use the G-formula for time-invariant exposures, to compute the marginal mean of the outcome.
In the PDF the author explains why we can use models and predictions to implement the law of total probability. The key is modeling each of exposure, confounder, and outcome, using predictions from the previous steps.
I do not understand then, how I can simply use$C$ and $A$ , just for $Y$ , and yet I believe this is how to implement the parametric G-formula with
marginaleffects::avg_predictions(mY)$estimate
to obtain the same result (which is not really the same, since the 3rd decimal is different). I did not provide a model formarginaleffects
. I feel ashamed for the simplicity of this issue but I really do not understand.@vincentarelbundock @ngreifer @ainaimi
Beta Was this translation helpful? Give feedback.
All reactions