Skip to content

Commit

Permalink
Update Basic_example.Rmd
Browse files Browse the repository at this point in the history
  • Loading branch information
n8thangreen authored Dec 15, 2023
1 parent faca3c3 commit 85cb6c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vignettes/Basic_example.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,19 @@ $$

The difference between Bayesian G-computation and its maximum-likelihood counterpart is in the estimated distribution of the predicted outcomes. The Bayesian approach also marginalizes, integrates or standardizes over the joint posterior distribution of the conditional nuisance parameters of the outcome regression, as well as the joint covariate distribution.

Draw a vector of size $N*$ of predicted outcomes $y*z$ under each set intervention $z* \in \{0, 1\}$ from its posterior predictive distribution under the specific treatment. This is defined as $ p(y*_{z*} | \mathcal{D}_{AC}) = \int_{\beta} p(y*_{z*} | \beta) p(\beta | \mathcal{D}_{AC}) d\beta$ where $p(\beta | \mathcal{D}_{AC})$ is the posterior distribution of the outcome regression coefficients $\beta$, which encode the predictor-outcome relationships observed in the _AC_ trial IPD. This is given by:
Draw a vector of size $N^*$ of predicted outcomes $y^*_z$ under each set intervention $z^* \in \{0, 1\}$ from its posterior predictive distribution under the specific treatment. This is defined as $p(y^*_{z^*} \mid \mathcal{D}_{AC}) = \int_{\beta} p(y^*_{z^*} \mid \beta) p(\beta \mid \mathcal{D}_{AC}) d\beta$ where $p(\beta \mid \mathcal{D}_{AC})$ is the posterior distribution of the outcome regression coefficients $\beta$, which encode the predictor-outcome relationships observed in the _AC_ trial IPD. This is given by:

$$
p(y*_{z*} \mid \mathcal{D}_{AC}) = \int_{x*} p(y* \mid z*, x*, \mathcal{D}_{AC}) p(x* \mid \mathcal{D}_{AC})\; dx*
p(y^*_{^z*} \mid \mathcal{D}_{AC}) = \int_{x^*} p(y^* \mid z^*, x^*, \mathcal{D}_{AC}) p(x^* \mid \mathcal{D}_{AC})\; dx^*
$$
$$
= \int_{x*} \int_{\beta} p(y* \mid z*, x*, \beta) p(x* \mid \beta) p(\beta \mid \mathcal{D}_{AC})\; d\beta \; dx*
= \int_{x*} \int_{\beta} p(y^* \mid z^*, x^*, \beta) p(x^* \mid \beta) p(\beta \mid \mathcal{D}_{AC})\; d\beta \; dx^*
$$
In practice, the integrals above can be approximated numerically, using full Bayesian estimation via Markov chain Monte Carlo (MCMC) sampling.

The average, variance and interval estimates of the marginal treatment effect can be derived empirically from draws of the posterior density.

We can draw a vector of size $N*$ of predicted outcomes $y^*_z$ under each set intervention $z*$ from its posterior predictive distribution under the specific treatment.
We can draw a vector of size $N^*$ of predicted outcomes $y^*_z$ under each set intervention $z^*$ from its posterior predictive distribution under the specific treatment.

```{r hat_Delta_stats_gcomp_stan}
hat_Delta_stats_gcomp_stan <- hat_Delta_stats(AC.IPD, BC.ALD, strategy = strategy_gcomp_stan())
Expand Down

0 comments on commit 85cb6c2

Please sign in to comment.