balance_plot: Assess balance in covariate distribution graphically.

Description Usage Arguments Value Examples

View source: R/propensity.R

Description

Assess balance in covariate distributio and assess ability to adjust for differences in covariates by treatment status.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
balance_plot(
  data,
  x,
  w,
  matched_indices = NULL,
  method = "Normalized difference",
  threshold = 0.2,
  colors = NULL,
  title = NULL
)

Arguments

data

a dataframe object containing the variables and values.

x

a list of character vectors specifying the covariates.

w

a character vector describing the treatment variable.

matched_indices

a data frame of two columns, one of treatment indices and one of matched (produced by propensity_match).

method

a character vector specifying the method for which to assess balance in covariate distributions across treatment and control groups.

threshold

the threshold to plot. Default is 0.2.

colors

an optional vector of two specifying the colors for the control and treatment groups, respectively.

title

an optional plot title.

Value

a ggplot object.

Examples

1
2
3
4
5
6
7
8
9
data(lalonde)

p <- propensity_score(lalonde, y = "re78", w = "treat")
matched_indices <- propensity_match(lalonde, w = "treat", p = p, max_distance = .00001)

vars <- names(lalonde)
covariates <- vars[!vars %in% c("re78", "treat")]

balance_plot(lalonde, x = covariates, w = "treat", matched_indices = matched_indices)

jackcollison/causality documentation built on Dec. 20, 2021, 8:05 p.m.