Skip to contents

Run Gibbs sampler for the random moderator placement design

Usage

prepost_gibbs(
  formula,
  data,
  prepost,
  moderator,
  covariates,
  iter = 1000,
  thin = 1,
  burn = 0,
  offset = 0,
  monotonicity = TRUE,
  stable = TRUE,
  saturated = TRUE,
  priors
)

Arguments

formula

A formula with syntax y ~ t, where y is the (unquoted) name of the outcome and t is the (unquoted) name of the treatment.

data

A data.frame containing variables in the formula, moderator, and covariates arguments.

prepost

A one-sided formula with syntax ~ z, where z is the indicator variable for whether the moderator was measured pre- or post-treatment.

moderator

A one-sided formuala with syntax ~ d, where d is the (unquoted) name of the moderator variable for the CATE.

covariates

A one-sided formula with syntax ~ x1 + x2, where the right-hand side variables signify which covariates the Gibbs will use to try and narrow the bounds.

iter

Integer indicating the number of iterations for the Gibbs sampler.

thin

Integer indicating how often the Gibbs sampler should save a draw.

burn

Integer indicating how many iterations should be performed before saving draws in the Gibbs sampler.

offset

A numeric value indicating the center of the prior distribution for the covariate coefficients.

monotonicity

A logical signifying whether the model assumes monotonicity.

stable

A logical signifying whether the model assumes that the the pre vs post indicator does not affect the moderator under the control condition for treatment.

saturated

A logical indicating whether the coefficients on the covariates are allowed to vary by the principal strata.

priors

A list object containing the priors for the Gibbs sampler. Priors include beta.precision, psi.precision, alpha, y.alpha, and y.beta.

Value

A list object containing Gibbs posterior quantities of interest and parameters.

Examples

x <- "alfa,bravo,charlie,delta"