This function estimates Mantel-Haenszel risk difference and average treatment effect.

robincar_mh(
  df,
  treat_col,
  response_col,
  strata_cols,
  estimand = "ATE",
  ci_type = "mGR"
)

Arguments

df

A data.frame with the required columns

treat_col

Name of column in df with treatment variable. Must be binary

response_col

Name of the column in df with response variable

strata_cols

Names of columns in df with strata variables

estimand

A character string specifying the estimand. One of "MH" or "ATE" (default). See Details

ci_type

A character string specifying the type of confidence interval. One of "GR", "mGR" (default), "Sato"

Details

The estimand of interest can be either Mantel-Haenszel risk difference or Average Treatment Effect (ATE). The latter is the default option of `estimand`. When `estimand="ATE"`, `ci_type` is limited to the modified Greenland variance estimator (mGR). Otherwise, Greenland's variance estimator (GR) and Sato's variance estimator are optional.

Examples

df <- RobinCar:::data_sim
df$y_bin = ifelse(df$y>2.5, 1, 0)
robincar_mh(df = df[df$A!=2,],
            treat_col = "A",
            response_col = "y_bin",
            strata_cols = c("z1", "z2"),
            estimand = "MH",
            ci_type = "mGR")
#> Treatment group contrasts based on Mantel-Haenszel risk difference
#> Estimand: Mantel-Haenszel risk difference
#> Stratified by z1, z2
#> SE calculated via modified Greenland's estimator
#> 
#> Contrasts:
#> # A tibble: 1 × 4
#>   contrast    estimate     se `pval (2-sided)`
#>   <chr[1d]>      <dbl>  <dbl>            <dbl>
#> 1 treat 1 - 0    0.144 0.0369        0.0000936