Skip to contents

R port of investigation.run_treatment_effects_analysis. Returns a list with:

  • treatment_effects_summary – data.frame of ATE / ATT / ATC point estimates (SE / CI columns present but NA, matching Python).

  • cate_subgroup_estimates – data.frame of within-subgroup Hajek IPW CATEs with sandwich-style SEs and Wald 95\% CIs.

  • analysis_frame – the trimmed data.frame with attached propensity score and IPW weight columns (ps, w_ate, w_att, w_atc).

  • Convenience scalars ate / att / atc / se / ci_lower / ci_upper / n / method preserved from the previous R surface for backward compatibility.

Usage

morie_run_treatment_effects_analysis(data, treatment, outcome, covariates)

Arguments

data

data.frame containing treatment, outcome, and covariates.

treatment

Treatment column name.

outcome

Outcome column name.

covariates

Character vector of covariate column names.

Value

Named list as described above.

Examples

set.seed(1)
df <- data.frame(d = rbinom(80, 1, 0.4), x1 = rnorm(80), x2 = rnorm(80))
df$y <- df$d + df$x1 + rnorm(80)
res <- try(morie_run_treatment_effects_analysis(df, "d", "y",
                                                c("x1", "x2")))
if (!inherits(res, "try-error")) str(res, max.level = 1)
#> List of 11
#>  $ treatment_effects_summary:'data.frame':	3 obs. of  6 variables:
#>  $ cate_subgroup_estimates  :'data.frame':	0 obs. of  8 variables:
#>  $ analysis_frame           :'data.frame':	80 obs. of  8 variables:
#>  $ ate                      : num 1.13
#>  $ att                      : num 1.11
#>  $ atc                      : num 1.15
#>  $ se                       : num 0.316
#>  $ ci_lower                 : num 0.511
#>  $ ci_upper                 : num 1.75
#>  $ n                        : int 80
#>  $ method                   : chr "IPW-Hajek (ATE/ATT/ATC + CATE)"