Skip to contents

Calculate draws of binary responses from posterior predictive distribution from the Bayesian G-computation method using Hamiltonian Monte Carlo.

Usage

calc_gcomp_stan(strategy, ipd, ald, ...)

Arguments

strategy

A list specifying the model strategy, including:

formula

A linear regression formula object.

family

A family object specifying the distribution and link function (e.g., binomial).

iter

Number of iterations for the MCMC sampling.

warmup

Number of warmup iterations for the MCMC sampling.

chains

Number of MCMC chains.

ipd

Individual-level data

ald

Aggregate-level data

Value

A list of \(y^*_A\) and \(y^*_C\) posterior predictions:

`0`

Posterior means for treatment group C.

`1`

Posterior means for treatment group A.

Examples

if (FALSE) { # \dontrun{
strategy <- list(
  formula = outcome ~ treatment + age,
  family = binomial(),
  iter = 2000,
  warmup = 500,
  chains = 4
)
ipd <- data.frame(treatment = c(0, 1), outcome = c(1, 0), age = c(30, 40))
ald <- data.frame()
calc_gcomp_stan(strategy, ipd, ald)
} # }