balance_scatter: balance_scatter

View source: R/matched_set_obj.R

balance_scatterR Documentation

balance_scatter

Description

Visualizing the standardized mean differences for covariates via a scatter plot.

Usage

balance_scatter(
  non_refined_set,
  refined_list,
  xlim = c(0, 0.8),
  ylim = c(0, 0.8),
  main = "Standardized Mean Difference of Covariates",
  pchs = c(2, 3),
  covariates,
  data,
  x.axis.label = "Before refinement",
  y.axis.label = "After refinement",
  ...
)

Arguments

non_refined_set

a matched.set object produced by setting 'refinement.method' to "none" in 'PanelMatch'

refined_list

a list of one or two matched.set objects

xlim

xlim of the scatter plot. This is the same as the xlim argument in plot

ylim

ylim of the scatter plot. This is the same as the ylim argument in plot

main

title of the scatter plot. This is the same as the main argument in plot

pchs

one or two pch indicators for the symbols on the scatter plot. See plot for more information

covariates

variables for which balance is displayed

data

the same time series cross sectional data set used to create the matched sets.

x.axis.label

x axis label

y.axis.label

y axis label

...

optional arguments to be passed to plot

Details

balance_scatter visualizes the standardized mean differences for each covariate. Although users can use the scatter plot in a variety of ways, it is recommended that the x-axis refers to balance for covariates before refinement, and y-axis refers to balance after refinement. Users can utilize parameters powered by plot in base R to further customize the figure.

Author(s)

In Song Kim <insong@mit.edu>, Erik Wang <haixiao@Princeton.edu>, Adam Rauh <amrauh@umich.edu>, and Kosuke Imai <imai@harvard.edu>

Examples

# get a matched set without refinement
sets0 <- PanelMatch(lag = 4, time.id = "year", unit.id = "wbcode2",
                    treatment = "dem", refinement.method = "none",
                    data = dem, match.missing = FALSE,
                    covs.formula = ~ I(lag(y, 1:4)) + I(lag(tradewb, 1:4)),
                    size.match = 5, qoi = "att",
                    outcome.var = "y",
                    lead = 0:4, forbid.treatment.reversal = FALSE)

# get a matched set with refinement using CBPS.match, setting the 
# size of matched set to 5
sets1 <- PanelMatch(lag = 4, time.id = "year", unit.id = "wbcode2",
                    treatment = "dem", refinement.method = "mahalanobis",
                    data = dem, match.missing = FALSE,
                    covs.formula = ~ I(lag(y, 1:4)) + I(lag(tradewb, 1:4)),
                    size.match = 5, qoi = "att",
                    outcome.var = "y",
                    lead = 0:4, forbid.treatment.reversal = FALSE)

# get another matched set with refinement using CBPS.weight
sets2 <- PanelMatch(lag = 4, time.id = "year", unit.id = "wbcode2",
                    treatment = "dem", refinement.method = "ps.weight",
                    data = dem, match.missing = FALSE,
                    covs.formula = ~ I(lag(y, 1:4)) + I(lag(tradewb, 1:4)),
                    size.match = 10, qoi = "att",
                    outcome.var = "y",
                    lead = 0:4, forbid.treatment.reversal = FALSE)


# use the function to produce the scatter plot
balance_scatter(non_refined_set = sets0$att,
              refined_list = list(sets1$att, sets2$att),
              data = dem,
              covariates = c("y", "tradewb"))
# add legend 
legend(x = 0, y = 0.8,  
legend = c("mahalanobis",
           "PS weighting"),
y.intersp = 0.65,
x.intersp = 0.3,
xjust = 0,
pch = c(1, 3), pt.cex = 1,
bty = "n", ncol = 1, cex = 1, bg = "white")




insongkim/PanelMatch documentation built on June 10, 2022, 8 p.m.