There is dagR package fro graph but commands are not very clear and i couldn't get any good commands for G-computation also, if anybody have, it would be appreciated.
I am not aware of any R package to implement the parametric g-formula (g-computation). This is something on my wish list to do but haven't gotten around to it. We have a SAS macro for facilitating implementation of this method with some documentation that you can access here: http://www.hsph.harvard.edu/causal/software/. There is also apparently a stata package available: http://www.stata-journal.com/article.html?article=st0238
I've attached a paper which describes the principle behind this method written at an accessible level for fairly general types of questions and a description of the algorithm that is agnostic to platform. It can be a lot to code but not hard. Just a series of a regressions then using the estimated densities under the fitted model parameters to generate many "histories" under a hypothetical intervention. This paper also illustrates how one can think about using a priori knowledge of the data structure in place of arbitrary parametric models when available.
Hi Dharma, This paper (full-text available on researchgate) has an appendix with R code for g-computation: https://www.researchgate.net/publication/50419814_Implementation_of_G-Computation_on_a_Simulated_Data_Set_Demonstration_of_a_Causal_Inference_Technique
The only R package i've used for DAGs is dagR.
Article Implementation of G-Computation on a Simulated Data Set: Dem...