Skip to contents

Reports group / period sample sizes, outcome distributions, and baseline covariate balance (standardised mean differences).

Usage

morie_did_diagnostics(
  data,
  outcome,
  treatment,
  post,
  covariates = NULL,
  cluster = NULL
)

Arguments

data

A data frame containing the outcome, treatment, post and any covariate columns.

outcome

Name of the outcome column.

treatment

Name of the binary (0/1) treatment-group column.

post

Name of the binary (0/1) post-period column.

covariates

Optional character vector of covariate column names.

cluster

Optional cluster ID column for CR1 standard errors.

Value

A list with sample_sizes, outcome_stats, covariate_balance.

Details

For richer covariate-balance reporting (variance ratios, KS statistics, love plots) prefer cobalt::bal.tab / cobalt::love.plot.

Examples

set.seed(8)
n <- 300
d <- rbinom(n, 1, 0.5); p <- rbinom(n, 1, 0.5)
y <- 1 + 0.3 * d + 0.4 * p + 0.5 * d * p + rnorm(n, sd = 0.5)
df <- data.frame(y = y, d = d, post = p)
out <- morie_did_diagnostics(df, "y", "d", "post")
str(out, max.level = 1)
#> List of 3
#>  $ sample_sizes     : 'table' int [1:2, 1:2] 76 84 71 69
#>   ..- attr(*, "dimnames")=List of 2
#>  $ outcome_stats    :'data.frame':	4 obs. of  8 variables:
#>  $ covariate_balance: NULL